The overview:
•Turn on force logging
• Backup the primary database
• Copy files to standby site
• Set parameters on the physical standby database
• Start the standby database
• Configure Oracle Net
• Set parameters on the primary database
• Start the transport of redo
The details:
Create a standby database with RMAN:
0. Create directories as needed on standby server: $ORACLE_HOME/admin/$ORACLE_SID/bdump,udump,cdump, etc
1. Create a password file on standby host
$ORACLE_HOME/bin/orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password=change_on_install
2. Configure listeners and tnsnames on both servers; start listeners, verify sql*net connectivity
- Enable dead connection detection by setting the SQLNET.EXPIRE_TIME parameter in the SQLNET.ORA parameter file on the standby system. For example:
SQLNET.EXPIRE_TIME=10 <- this is in minutes when the system will check for a dead client connection
3. Force logging on the primary database:
ALTER DATABASE FORCE LOGGING;
4. Ensure the primary database is in archivemode:
5. Backup the database manually or via RMAN
6. Create a standby controlfile (must be done after the backup) - use RMAN where possible
alter database create standby controlfile as '$ORACLE_HOME/dbs/init$ORACLE_SID_sb.ora';
Since we are using RMAN backups - use rman:
RMAN> backup current controlfile for standby;
7. Create init.ora for primary
SQL> create pfile='$ORACLE_HOME/dbs/init$ORACLE_SID.ora' from spfile;
8. Copy Files to standby host:
- backup files, init.ora, standby control file
9. On standby server(s) , Create an init.ora file, modify dump file locations, use convert file names if needed:
##########################################
### For duplicating the database
###########################################
DB_FILE_NAME_CONVERT=(/global/oracle2/oradata2/$ORACLE_SID/system*,/global/oracle/oradata1/$ORACLE_SID/system*,
/global/oracle2/oradata2/$ORACLE_SID/undotbs*,/global/oracle/oradata2/$ORACLE_SID/undotbs*,
/global/oracle2/oradata2/$ORACLE_SID/tools*,/global/oracle/oradata3/$ORACLE_SID/tools*,
/global/oracle2/oradata2/$ORACLE_SID/users*,/global/oracle/oradata4/$ORACLE_SID/users*)
LOG_FILE_NAME_CONVERT=(/global/oracle2/oradata2/$ORACLE_SID/redo01.log,/global/oracle/oradata1/$ORACLE_SID/redo01.log,/global/oracle2/oradata2/T
EST1/redo02.log,/global/oracle/oradata2/$ORACLE_SID/redo02.log,/global/oracle2/oradata2/$ORACLE_SID/redo03.log,/global/oracle/oradata3/$ORACLE_SID/red
o03.log)
10. Create the spfile from the init.ora
SQL> create spfile from pfile='init$ORACLE_SID_dup.ora';
File created.
11. start the aux database - nomount
startup nomount
12. Start RMAN with a connection to the primary and duplicate databases (and rman catalog if using)
*****
*** NEEDS TO HAVE THE EXACT DIRECTORY OF THE BACKUPS ON THE SOURCE SYSTEM
***
$ rman target sys/change_on_install@$ORACLE_SID.us.net auxiliary sys/change_on_install@$ORACLE_SID.emea.net
++++++++++++++++++++++++++++++++++++++++++++++++++
rman target sys/change_on_install@CPTST.SEVENSPACE.NET auxiliary sys/change_on_install@CPDR
+++++++++++++++++++++++++++++++++++++++++++
RMAN>
RMAN> DUPLICATE TARGET DATABASE FOR STANDBY;
13. Put standby is managed recovery mode:
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
14. modify primary db to enable archiving to standby site:
SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=CPDR' SCOPE=BOTH;
SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=ENABLE SCOPE=BOTH;
15. test that the logs get applied:
ALTER SYSTEM ARCHIVE LOG CURRENT;
16. set standby arch dest:
ALTER SYSTEM SET standby_archive_dest='LOCATION=/global/oracle/oradump1/$ORACLE_SID/archive/standby' SCOPE=BOTH;
****
17. On the standby database, query the V$ARCHIVED_LOG view to verify the archived redo log was applied.
SQL> SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOG;
*************