Pages

Saturday, December 11, 2010

Active Database Duplication

In Oracle 11g, the live source database can be copied over the network to the duplicate database instance without the need of a backup. RMAN automates the following steps in duplicating operation.

Duplicate the password file.
Creates a default server parameter file.
Copies the latest control file.
Mounts the controlfile.
Copies the datafiles.
Performs incomplete recovery.
Opens the duplicate database with RESETLOGS option.

Run the commands on the server running the duplicate database.

$ export ORACLE_SID=<dupdb>
$ rman TARGET sys/password@<sourcedb> AUXILIARY / cmdfile=backupdb.cmd

$ cat backupdb.cmd

run {
                DUPLICATE TARGET DATABASE TO '<dupdb>'
                FROM ACTIVE DATABASE
                PASSWORD FILE
                SPFILE
                PARAMETER_VALUE_CONVERT='<sourcedb>','<dupdb>'
                SET CONTROL_FILES='<controlfile1_path>','<controlfile2_path>'
                SET DB_FILE_NAME_CONVERT='<source_dir>','<dup_dir>'
                SET LOG_FILE_NAME_CONVERT='<source_dir>','<dup_dir>'
                SET DB_UNIQUE_NAME='<dupdb>'
                SET SGA_MAX_SIZE='<size>'
                SET SGA_TARGET='<size>'
                NOFILENAMECHECK;
       }

To create standby database

run {
                ALLOCATE CHANNEL c1 TYPE DISK;
                ALLOCATE CHANNEL c2 TYPE DISK;
                ALLOCATE AUXILIARY CHANNEL s1 TYPE DISK;
                DUPLICATE TARGET DATABASE FOR STANDBY
                FROM ACTIVE DATABASE
                PASSWORD FILE
                SPFILE
                PARAMETER_VALUE_CONVERT='<sourcedb>','<dupdb>'
                SET CONTROL_FILES='<controlfile1_path>','<controlfile2_path>'
                SET DB_FILE_NAME_CONVERT='<source_dir>','<dup_dir>'
                SET LOG_FILE_NAME_CONVERT='<source_dir>','<dup_dir>'
                SET DB_UNIQUE_NAME='<dupdb>'
                SET LOG_ARCHIVE_MAX_PROCESSES=10
                SET FAL_SERVER='<sourcedb>'
                SET STANDBY_FILE_MANAGEMENT=AUTO
                SET LOG_ARCHIVE_DEST_2='SERVICE=<sourcedb> LGWR SYNC NOAFFIRM VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=<sourcedb>;
     }

             


No comments:

Post a Comment