Friday, March 21, 2008

Standby Database Creation

Steps to create the physical standby database:
1. Take the backup of production database
2. Create standby controlfile
3. Copy the backup, standy controfile and init.ora files to standby box
4. Create necessary directories
5. Edit the init.ora file
6. Mount the database
7. Restore the database
8. Start the recovery

1. Take the backup of production database
rman> run {
allocate channel c1 type disk format '/backup/%d_rman_bkp_%T_p%p_s%s' maxpiecesize 1800M;
allocate channel c2 type disk format '/backup/%d_rman_bkp_%T_p%p_s%s' maxpiecesize 1800M;
allocate channel c3 type disk format '/backup/%d_rman_bkp_%T_p%p_s%s' maxpiecesize 1800M;
allocate channel c4 type disk format '/backup/%d_rman_bkp_%T_p%p_s%s' maxpiecesize 1800M;
backup as compressed backupset databse plus archivelog;
}

2. Create standby controlfile
sql> alter database create controlfile as '/backup/standby_controlfile.ctl';

3. Copy the backup, controfile and init.ora files to standby box
use ftp or scp to copy the files

4. Create necessary directories
$ mkdir adump bdump cdump udump datafiles controlfiles redofiles archive

5. Edit the init.ora file
a. Change controfile path
b. Change the paths of all dump_dest parametes
c. Change the LOG_ARCHIVE_DEST path
d. Add below 3 parametes
DB_FILE_NAME_CONVERT='/old_path1/','/new_path1/' ,'/old_path2/','/new_path2/'
LOG_FILE_NAME_CONVERT='/old_path/','/new_path/'
STANDBY_FILE_MANAGEMENT='AUTO'

6. Mount the database
sql> startup mount pfile='init.ora'

7. Restore the database
rman> run {
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
restore database;
}

8. Start the recovery
sql> alter database recover manged standby database disconnect;

No comments: