Monday, February 12, 2018

ORA-01152: file 1 was not restored from a sufficiently old backup

on DR site after creating the DR database I am not able to start it and getting the error below:

[oracle@serv01n01 (db1apd1) dbs]$ srvctl start database -d db1apd
PRCR-1079 : Failed to start resource ora.db1apd.db
CRS-5017: The resource action "ora.db1apd.db start" encountered the following error:
ORA-10458: standby database requires recovery
ORA-01152: file 1 was not restored from a sufficiently old backup
ORA-01110: data file 1: '+DATA/DB1APD/DATAFILE/system.915.967902569'
. For details refer to "(:CLSN00107:)" in "/u01/app/grid/diag/crs/serv01n01/crs/trace/crsd_oraagent_oracle.trc".

CRS-2674: Start of 'ora.db1apd.db' on 'serv01n01' failed
CRS-2632: There are no more servers to try to place resource 'ora.db1apd.db' on that would satisfy its placement policy
[oracle@serv01n01 (db1apd1) dbs]$


After looking at the primary site. I have noticed that the log_archive_dest_state_2 is reset so I need to enable it to get the recovery working. Because it is reset so no new logs are going to DR and DR site is not able to recover the database up to latest point in time. Hence getting the error.

SQL> show parameter log_archive_dest_state_2

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_state_2             string      RESET
SQL>
SQL>
SQL> alter system set log_archive_dest_state_2='enable' scope=both sid='*';

System altered.

SQL>


Once the parameter is enabled on primary site, I have tried starting the database on DR and it worked.

[oracle@serv01n01 (db1apd1) dbs]$ srvctl start database -d db1apd
[oracle@serv01n01 (db1apd1) dbs]$

--Issue fixed. 

Sunday, February 4, 2018

Wifi setup with raspberry pi zero w headless

Trying to start raspberry pi zero but I do not have the micro USB keyboard and mouse but wanted to setup the wifi.

These instructions are while using the memory card on mac.

Solution is when we setup the image we need to put the memory card in the mac and then run the following


HarvarindersMBP:boot hdh$ pwd
/Volumes/boot

touch /Volumes/boot/ssh
touch /Volumes/boot/wpa_supplicant.conf

vi /Volumes/boot/wpa_supplicant.conf

country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
    ssid="SSID"
    psk="password"
    key_mgmt=WPA-PSK
}




Once done then insert the card in the raspberry pi and start it and it will get an ip using wifi.

Done!!!



Friday, February 2, 2018

Creating user in UNIX and cloning the user

Add group to the user with -a (append to the group list)

sudo usermod -a -G vboxsf harvey

To close the user create a script like this


harvey@hvb:~/hscripts$ vi clone-user.sh
#!/bin/bash
SRC=$1
DEST=$2
BLANK=" "

SRC_GROUPS=$(id -Gn ${SRC} | sed "s/${SRC}${BLANK} //g" | sed "s/ ${SRC}//g" | sed "s/ /,/g")
SRC_SHELL=$(awk -F : -v name=${SRC} '(name == $1) { print $7 }' /etc/passwd)

useradd --groups ${SRC_GROUPS} --shell ${SRC_SHELL} --create-home ${DEST}
passwd ${DEST}



run it to clone 
Syntax 

sudo ./clone-user.sh source_user target_user

It will ask the password for the new user

sudo ./clone-user.sh harvey michael


Done!!!