There are a few ways to set up oracle standby database, In any ways, please make sure you have the following ready:
- remote login is enabled, both primary and standby SYS password are the same, this can be set using orapwd.
- log shipping is enabled on primary, define the proper TNS entry, set log_archive_dest_x, and set log_archive_dest_state_x to enable.
- The pfile or spfile is ready on standby database.
1. Using storage level replication
On primary database, put the database in backup mode. This is to make sure the copy replicated to standby environment is consistent.
In storage, split the replication. Stop backup mode on primary database:SQL> alter database begin backup;
Create standby controlfiile:SQL> alter database end backup;
Copy the controlfile backup to standby servers, restore the controlfile.RMAN> backup current controlfile for standby format '/tmp/stdby_ctrol_%U';
SQL> startup nomoun;RMAN> catalog start with '/tmp/stdby_ctrol';RMAN> restore controlfile from '/tmp/stdby_ctrol_blahblah';
Mount the standby database, and enable redo apply.
Note: Please make sure do NOT sync back the standby environment on storage level again, otherwise it will destroy the standby database.SQL> alter database mount standby database;SQL> recover managed standby database disconnect;
2. Using RMAN duplicate.
connect to primary database and standby databse.
$ rman target / AUXILIARY SYS/sys_pwd@sbdbRMAN> DUPLICATE TARGET DATABASE FOR STANDBY NOFILENAMECHECK;