Register | Login

ORACLE DATAGUARD FAILOVER

Posted by venky (#109) 2549 days ago (Editorial)

6.2 Failover from the Primary to the Standby Database (Disaster Recovery)
Perform following tasks to do failover:

1. Identify and resolve any archivelog gaps. On the standby database server, execute the following statement:
SQL> select * from v$archive_gap;
no rows selected
If this query returns any rows, copy the archivelogs file to the primary site and check whether is is applied using the methods described

2. copy any archived redo logs missing from the standby server
If possible, query the primary database to find the sequence number of the last archived redo log file.
SQL> select unique thread# as thread, max(sequence#) over (partition by thread#) as last from v$archived_log;
THREAD LAST
--------------------
1996
Copy any archived redo logs from the primary database server that contain sequence numbers higher than the highest sequence number on the standby database server and register them.

SQL > alter database register physical logfile ’;

3. Initiate the failover operation on the physical standby database. Note that when this statement is executed, the Primary database is rendered permanently unusable.
To relocate the now active standby database on the Primary server, a cold backup and restore process is required.

SQL> alter database recover managed standby database finish;
Database altered.

4. Convert the physical standby database to the primary role
SQL>shutdown immediate;
ORACLE instance shut down.

SQL> startup nomount pfile=
ORACLE instance started..

SQL> alter database mount standby database;

SQL> select * from v$recover_file;

SQL> recover standby database;
Below is an example of the result for the previous statement.
ORA-00279: change 7634722 generated at 10/13/2004 15:03:30 needed for thread 1
ORA-00289: suggestion : /u09/oradata/DBNAME/DB NAME001001S01997.ARC
ORA-00280: change 7634722 for thread 1 is in sequence #1997
Specify log: {=suggested | filename | AUTO | CANCEL}
SQL> auto (first try ‘auto’ to let the database roll forward. If there is no next archivelog file (because none was generated), you can then cancel the recovery)
SQL> cancel
Media recovery cancelled.
Rename the online redo log file path if standby database server is different from production database server.


SQL> alter database activate standby database;
Database altered.
Note that this step will reset the redo logfiles.

5. After activating the Standby database
SQL> shutdown;
ORACLE instance shut down.
Modify the initdbname.ora file as follows:
log_archive_start = true
log_archive_dest_1 = "location=/u09/oradata/DB NAME/arch"
log_archive_dest_state_1=enable
log_archive_dest_2 = "service=DB NAME reopen=60"
log_archive_dest_state_2=defer
log_archive_format= DB NAME%T%TS%S.ARC

6. Then restart the database:
SQL> startup pfile=
ORACLE instance started.
Database mounted.
Database opened.

SQL> alter system switch logfile;
System altered.
Database opened.
SQL> alter system switch logfile;
System altered.
The statement will create a log file after switching the primary database. Then create temporary file for the temporary tablespace

SQL> alter tablespace temp add tempfile size 400M reuse;
Tablespace altered.


Who Voted for this Article



YourWiz.com, is a website that will allow everyone to share their knowledge, tip or information through community micro blogging.