Thursday, 20 June 2013

Primary Database to Standby Database switchover

Database Switchover Steps Are:

1. Firstly Convert primary database to standby

CONNECT sys/pwd@sidname AS SYSDBA

ALTER DATABASE COMMIT TO SWITCHOVER TO STANDBY;

2. Shutdown primary database

SHUTDOWN IMMEDIATE;

3. Mount old primary database as standby database

STARTUP NOMOUNT  PFILE=/u01/app/oracle/product/9.2.0/dbs/

initsidname.ora

ALTER DATABASE MOUNT STANDBY DATABASE;

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM

SESSION;

4. Convert standby database to primary database

CONNECT sys/pwd@sidname AS SYSDBA

ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY;

5. Shutdown standby database with immediate

SHUTDOWN IMMEDIATE;

6. Now Open old standby database as primary database.

STARTUP PFILE=/u01/app/oracle/product/9.2.0/dbs/initsidname.ora

example of primary database to standby database switchover

At Primary Database with sid=sid

SQL> alter database commit to switchover to standby;

Database altered.

SQL> shutdown immediate;

ORA-01507: database not mounted

ORACLE instance shut down.

SQL> startup nomount pfile=/u01/app/oracle/product/9.2.0/dbs/initsid.ora

ORACLE instance started.

Total System Global Area  236000356 bytes

Fixed Size                    451684 bytes

Variable Size                201326592 bytes

Database Buffers               33554432 bytes

Redo Buffers                     667648 bytes

SQL> alter database mount standby database;

Database altered.

SQL> alter database recover managed standby database disconnect from session;

Database altered.

SQL> archive log list;

Database log mode               Archive Mode

Automatic archival             Enabled

Archive destination             /archive/sid1

Oldest online log sequence        17

Next log sequence to archive    0

Current log sequence                20

At Standby Database with sid=sid1

SQL> alter database commit to switchover primary;

alter database commit to switchover primary

ERROR at line 1:

ORA-00946: missing TO keyword

SQL> alter database commit to switchover to primary;

Database altered.

                                    *

SQL> shutdown immediate;

ORA-01507: database not mounted

ORACLE instance shut down.

SQL> startup pfile=/u01/app/oracle/product/9.2.0/dbs/initsid1.ora ;

ORACLE instance started.

Total System Global Area  236000356 bytes

Fixed Size                    451684 bytes

Variable Size                201326592 bytes

Database Buffers               33554432 bytes

Redo Buffers                     667648 bytes

Database mounted.

Database opened.

SQL> conn

Enter user-name: schema/pwd@sid1

Connected.

SQL> select * from emp;

NAME

--------------------

john

No comments:

Post a Comment