1. Logical standby Master/Slave database Switch
1.1 check whether the master database can be switched
SQL> select switchover_status from V $ database;
Switchover_status
--------------------
Sessions active
1.2 switch the master database to the logical standby Database
SQL> alter database prepare to switchover to logical standby;
Database altered.
SQL> select switchover_status from V $ database;
Switchover_status
--------------------
Preparing switchover
-- The status changes to "ready to switch ".
1.3 switch the logical standby database to the master database
SQL> alter database prepare to switchover to primary;
Database altered.
-- This statement will enable the redo log transmission service on the logical standby database.
SQL> select switchover_status from V $ database;
Switchover_status
--------------------
Preparing switchover
1.4 confirm that the current master database is ready to receive redo logs from the new master database
SQL> select switchover_status from V $ database;
Switchover_status
--------------------
To logical standby
1.5 switch the master database to a logical standby Database
SQL> alter database commit to switchover to logical standby;
Database altered.
SQL> select switchover_status from V $ database;
Switchover_status
--------------------
Not Allowed
1.6 switch the logical standby database to the primary database
SQL> alter database commit to switchover to primary;
Database altered.
SQL> select switchover_status from V $ database;
Switchover_status
--------------------
Sessions active
1.7 enable SQL apply on the slave Database
SQL> alter database start logical standby apply;
Database altered.
If the SID of the master and slave databases is the same, you can change the IP addresses of the master and slave databases to lisener. ora, init. ora, and tnsnames. ora to restart the lisener and database. If the SID of the master and slave databases is different, perform the following operations.
1.8 change Sid
In the following replacement process, the SID of the master database is it, and the SID of the slave database is its
1.8.1 Replace the SID of the primary database (in the original standby database and in the new primary database)
SQL> shutdown immediate;
The database is closed.
The database has been detached.
Oracle is disabled for processing.
SQL> startup Mount;
Oracle Execution Processing started.
Total system global area 612368384 bytes
Fixed size 1298160 bytes
Variable Size 167772432 bytes
Database buffers 436207616 bytes
Redo buffers 7090176 bytes
The database has been attached.
SQL> host NID target = sys/Oracle @ its dbname = it
Dbnewid: Release 10.2.0.4.0-production on Tuesday October 20 16:51:46 2009
Copyright (c) 1982,200 7, Oracle. All rights reserved.
Connected to database its (dbid = 2303471784)
Online to server version 10.2.0
Control Files in the database:
D: \ It \ controlfile \ o1_mf_5fj2krkl_.ctl
D: \ flashback \ It \ controlfile \ o1_mf_5fj2ks3f_.ctl
Change the database ID and database name its to it? (Y/[N]) => Y
Continue job
Change Database ID from 2303471784 to 3211721123
Change database name from its to it
Control mongod: \ It \ controlfile \ ow.mf_5fj2krkl_.ctl-modified
Control mongod: \ flashback \ It \ controlfile \ ow.mf_5fj2ks3f_.ctl-modified
Document File d: \ It \ datafile \ o1_mf_system_5fj2hfh4_.dbf-dbid has been changed and a new name has been written.
Document File d: \ It \ datafile \ o1_mf_undotbs1_5fj2hfn0_.dbf-dbid has been changed and a new name has been written.
Name
Document File d: \ It \ datafile \ o1_mf_sysaux_5fj2hfj3_.dbf-dbid has been changed and a new name has been written.
Document File d: \ It \ datafile \ o1_mf_users_5fj2hfnz_.dbf-dbid has been changed and a new name has been written.
Document File d: \ It \ datafile \ o1_mf_temp_5fj2lo5c_.tmp-dbid has been changed and a new name has been written.
Control mongod: \ It \ controlfile \ ow.mf_5fj2krkl_.ctl-dbid changed and a new name has been written
Controls mongod: \ flashback \ It \ controlfile \ ow.mf_5fj2ks3f_.ctl-dbid changed and written
New name
Disable Processing
The database name has been changed to it.
Modify the parameter file and generate a new password file before restarting.
The Database ID of database it has been changed to 3211721123.
All previous backup and disk redo logs of this database are no longer available.
The database has been disabled. Use the resetlogs option to enable the database.
The Database Name and ID are successfully changed.
Dbnewid-completed successfully.
C: \ Documents ents and Settings \ Administrator> oradim-Del-Sid its
The execution process has been deleted.
C: \ Documents ents and Settings \ Administrator> oradim-New-sid it-startmode auto-pfile C: \ oracle \ product \ 10.2.0 \ db_1 \ database \ initit. ora
The execution process has been created.
Back up initits on the original slave database. ora, lisener. ora, tnsnames. ora, password file, the original master database, the initit on the new slave database. ora, lisener. ora, tnsnames. ora: the location of the new master database where the password file is copied. Change the IP address of the new slave database to another one, change the IP address of the new master database to the IP address of the original master database, and restart lisener.
C: \ Documents ents and Settings \ Administrator> set oracle_sid = it
C: \ Documents ents and Settings \ Administrator> sqlplus/nolog
SQL * Plus: Release 10.2.0.4.0-production on Tuesday October 20 16:56:32 2009
Copyright (c) 1982,200 7, Oracle. All rights reserved.
SQL> connect sys as sysdba
Enter the password:
Online to idle execution.
SQL> startup
Oracle Execution Processing started.
Total system global area 612368384 bytes
Fixed size 1298160 bytes
Variable Size 167772432 bytes
Database buffers 436207616 bytes
Redo buffers 7090176 bytes
The database has been attached.
ORA-01589: The resetlogs or noresetlogs option must be used for the database to be enabled
SQL> alter database open resetlogs;
The database has been changed.
SQL>
1.8.2 Replace the SID of the slave database (in the original master database and in the new slave database)
SQL> shutdown immediate;
The database is closed.
The database has been detached.
Oracle is disabled for processing.
SQL> startup Mount;
Oracle Execution Processing started.
Total system global area 612368384 bytes
Fixed size 1298160 bytes
Variable Size 167772432 bytes
Database buffers 436207616 bytes
Redo buffers 7090176 bytes
The database has been attached.
SQL> host NID target = sys/Oracle @ It dbname = its
Dbnewid: Release 10.2.0.4.0-production on Tuesday October 20 17:01:03 2009
Copyright (c) 1982,200 7, Oracle. All rights reserved.
Connected to database it (dbid = 3211404984)
Online to server version 10.2.0
Control Files in the database:
D: \ It \ controlfile \ o1_mf_5fj2krkl_.ctl
D: \ flashback \ It \ controlfile \ o1_mf_5fj2ks3f_.ctl
Change the database ID and name to its? (Y/[N]) => Y
Continue job
Change Database ID from 3211404984 to 2303506065
Change Database Name from it to its
Control mongod: \ It \ controlfile \ ow.mf_5fj2krkl_.ctl-modified
Control mongod: \ flashback \ It \ controlfile \ ow.mf_5fj2ks3f_.ctl-modified
Document File d: \ It \ datafile \ o1_mf_system_5fj2hfh4_.dbf-dbid has been changed and a new name has been written.
Document File d: \ It \ datafile \ o1_mf_undotbs1_5fj2hfn0_.dbf-dbid has been changed and a new name has been written.
Name
Document File d: \ It \ datafile \ o1_mf_sysaux_5fj2hfj3_.dbf-dbid has been changed and a new name has been written.
Document File d: \ It \ datafile \ o1_mf_users_5fj2hfnz_.dbf-dbid has been changed and a new name has been written.
Document File d: \ It \ datafile \ o1_mf_temp_5fj2lo5c_.tmp-dbid has been changed and a new name has been written.
Control mongod: \ It \ controlfile \ ow.mf_5fj2krkl_.ctl-dbid changed and a new name has been written
Controls mongod: \ flashback \ It \ controlfile \ ow.mf_5fj2ks3f_.ctl-dbid changed and written
New name
Disable Processing
The database name has been changed to its.
Modify the parameter file and generate a new password file before restarting.
The Database ID of database its has been changed to 2303506065.
All previous backup and disk redo logs of this database are no longer available.
The database has been disabled. Use the resetlogs option to enable the database.
The Database Name and ID are successfully changed.
Dbnewid-completed successfully.
Replace the original backup database with the initits backed up on the new master database. ora, lisener. ora, tnsnames. ora: the location of the new standby database where the password file is copied. Change the IP address of the new standby database to the IP address of the original standby database and restart lisener.
C: \ Documents ents and Settings \ Administrator> oradim-Del-sid it
The execution process has been deleted.
C: \ Documents ents and Settings \ Administrator> oradim-New-Sid its-startmode auto-pfile C: \ oracle \ product \ 10.2.0 \ db_1 \ database \ initits. ora
The execution process has been created.
C: \ Documents ents and Settings \ Administrator> set oracle_sid = its
C: \ Documents ents and Settings \ Administrator> sqlplus/nolog
SQL * Plus: Release 10.2.0.4.0-production on Tuesday October 20 16:56:32 2009
Copyright (c) 1982,200 7, Oracle. All rights reserved.
SQL> connect sys as sysdba
Enter the password:
Online to idle execution.
SQL> startup
Oracle Execution Processing started.
Total system global area 612368384 bytes
Fixed size 1298160 bytes
Variable Size 167772432 bytes
Database buffers 436207616 bytes
Redo buffers 7090176 bytes
The database has been attached.
ORA-01589: The resetlogs or noresetlogs option must be used for the database to be enabled
SQL> alter database open resetlogs;
The database has been changed.
SQL> alter database start logical standby apply;
The database has been changed.
SQL>