12cR1 RAC Posts — 8b : DUPLICATE DATABASE FOR STANDBY

Continuing the previous post, where I have done the pre-setup…(A reminder : This is a SingleInstance Standby on FileSystem for a RAC Database with a PDB on ASM) On the SingleInstance Node (for the Standby database) Precreate the required folders for the database (and redo and control) files (I later realised that the “onlinelog” folders for the SEED and PDB are not required) [oracle@oem132 ~]$ cd /u01/app/oracle/oradata[oracle@oem132 oradata]$ mkdir STBY[oracle@oem132 oradata]$ cd STBY[oracle@oem132 STBY]$ mkdir datafile[oracle@oem132 STBY]$ mkdir onlinelog[oracle@oem132 STBY]$ mkdir 44bbc69ce8f552aee053334ea8c07365[oracle@oem132 STBY]$ mkdir fd9ac20f64d244d7e043b6a9e80a2f2f[oracle@oem132 STBY]$ cd 44*[oracle@oem132 44bbc69ce8f552aee053334ea8c07365]$ mkdir datafile tempfile[oracle@oem132 44bbc69ce8f552aee053334ea8c07365]$ cd ../fd*[oracle@oem132 fd9ac20f64d244d7e043b6a9e80a2f2f]$ mkdir datafile tempfile[oracle@oem132 fd9ac20f64d244d7e043b6a9e80a2f2f]$[oracle@oem132 STBY]$[oracle@oem132 STBY]$ cd /u01/app/oracle/fast_recovery_area[oracle@oem132 fast_recovery_area]$ mkdir STBY[oracle@oem132 fast_recovery_area]$ cd STBY[oracle@oem132 STBY]$ mkdir onlinelog[oracle@oem132 STBY]$ mkdir 44bbc69ce8f552aee053334ea8c07365[oracle@oem132 STBY]$ mkdir fd9ac20f64d244d7e043b6a9e80a2f2f[oracle@oem132 STBY]$ cd 44*[oracle@oem132 44bbc69ce8f552aee053334ea8c07365]$ mkdir onlinelog[oracle@oem132 44bbc69ce8f552aee053334ea8c07365]$ cd ../fd*[oracle@oem132 fd9ac20f64d244d7e043b6a9e80a2f2f]$ mkdir onlinelog[oracle@oem132 fd9ac20f64d244d7e043b6a9e80a2f2f]$[oracle@oem132 STBY]$ Note that the names of the two folders for the SEED and the PDB are in *lower

Oracle startup and shutdown script: very famous (dbora) ;)

This is the most complete dbora script i came up with, i used linux subsystem and pid file for complete status workings… please have a look and n point out if there is anything to be done further in it…   #!/bin/sh # chkconfig: 345 55 25 # /etc/init.d/dbora # Description: Starts and stops the Oracle database and listener # Author: ConArtist # Date: 21/04/14 # source function library .

Performing Oracle RMAN Cold backup

Cold backup is done when database is not open. While performing cold backup using RMAN the database need to be in MOUNT mode. This is because RMAN needs the data file details which are available while database is in MOUNT mode.

Cold backup is also called consistent backup. This is because before bringing the database in MOUNT mode, the database is first shutdown with IMMEDIATE or TRANSACTIONAL option. This means that database sequence number are all synchronised.

Below are the steps to do RMAN cold backup to an external drive in Linux.

Step1: Mount the external drive
Step2: Run rman_cold_backup.sh in nohup.

The content of rman_cold_backup.sh is below:

#!/bin/sh
# Set Oracle Environment for DB
#. ~/.bashrc
. ~/.bash_profile

echo
echo “`date` – Started `basename $0`”
echo

export NLS_DATE_FORMAT=’DD-MON-YY HH24:MI:SS’
rman target /
run {
shutdown immediate;
startup mount;
allocate channel prmy1 type disk format ‘/media/full_backup_%d_%s_%p’;
allocate channel prmy2 type disk format ‘/media/full_backup_%d_%s_%p’;
allocate channel prmy3 type disk format ‘/media/full_backup_%d_%s_%p’;
allocate channel prmy4 type disk format ‘/media/full_backup_%d_%s_%p’;
BACKUP CURRENT CONTROLFILE format ‘/media/ctrl_file_%d_%s_%p’;
BACKUP AS COMPRESSED BACKUPSET DATABASE;
release channel prmy1;
release channel prmy2;
release channel prmy3;
release channel prmy4;
alter database open;
}
EOF
if [ $? -eq 0 ]
then
echo “=====================”
echo “RMAN Backup Completed”
echo “=====================”
else
echo “==================”
echo “RMAN Backup Failed”
echo “==================”
exit 1
fi

echo
echo “`date` – Finished `basename $0`”
echo

As this backup is a cold backup the, the archive log files will be not required to restore and recover the database. Hence archive log files are not added.

However if you wish to take backup of arrive logs as well you can change

BACKUP AS COMPRESSED BACKUPSET DATABASE;

To

BACKUP AS COMPRESSED BACKUPSET DATABASE PLUS ARCHIVELOG;

In the above script.

Remember to run the script in nohup.
Also remember to check there is enough space in the external drive.