|
DataGuard
|
Hello, everyone. We would like to continue the same topic DataGuard. Since we have established a standby database last time, let's test how long it takes to switchover.
A new function of Oracle10g
A new function Rolling Upgrade is available in Oracle 10g to execute switchover during the installation of patches. (Only available for the logical standby configuration) We would like to test this function as well after PSR (Patch Set Release) is released.
Examination
SQL> conn / as sysdba
Accessed to field instance.
SQL> startup mount
Oracle instance started.
Total System Global Area 188743680 bytes
Fixed Size 778036 bytes
Variable Size 162537676 bytes
Database Buffers 25165824 bytes
Redo Buffers 262144 bytes
Database mounted.
|
We can verify whether switchover is executable or not by checking switchover_status in v$database view.
SQL> select switchover_status from v$database;
SWITCHOVER_STATUS
--------------------
TO STANDBY
|
It seems that everything is fine. Let's start the switchover test.
SQL> alter database commit to switchover to physical standby;
alter database commit to switchover to physical standby
*
Error in Row 1:
ORA-01109: database not open.
|
Well, it looks like the database should be open.
SQL> select switchover_status from v$database;
SWITCHOVER_STATUS
--------------------
SESSIONS ACTIVE
|
Sessions are active now. Is it appropriate to execute switchover in this status?
SQL> alter database commit to switchover to physical standby;
Database is changed.
|
Let's check if it is well done.
alert_log
-----------------------------------------------------------------------
Mon Jun 28 21:22:20 2004
alter database commit to switchover to physical standby
Mon Jun 28 21:22:20 2004
primary; ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY
Mon Jun 28 21:22:20 2004
ARCH: Connecting to console port...
Performing log switch to complete LGWR archival of current logfile
Archiving all current logfiles on all instances
.......
primary; Switchover: Complete - Database shutdown required
Mon Jun 28 21:22:37 2004
ARCH: Connecting to console port...
Completed: alter database commit to switchover to physical st
-----------------------------------------------------------------------
SQL> select DATABASE_ROLE from v$database;
DATABASE_ROLE
----------------
PHYSICAL STANDBY
|
Switchover is executed successfully. It takes 20 seconds to finish switchover in this environment. After switchover is executed, the primary database will be open but read-only until switchback is executed. Therefore, it is not allowed to be overwritten.
Switchback
We will switchback the primary database that has been switchovered.
SQL> startup mount
Oracle instance started.
Total System Global Area 188743680 bytes
Fixed Size 778036 bytes
Variable Size 162537676 bytes
Database Buffers 25165824 bytes
Redo Buffers 262144 bytes@
Database mounted.
|
Check the switchover_status of the primary database.
SQL> select switchover_status from v$database;
SWITCHOVER_STATUS
--------------------
TO PRIMARY
SQL> alter database commit to switchover to physical primary;
Database is changed.
alert_log
-----------------------------------------------------------------------
primary; ALTER DATABASE SWITCHOVER TO PRIMARY
Tue Jun 29 23:16:20 2004
ARCH: Connecting to console port...
If media recovery active, switchover will wait 900 seconds
SwitchOver after complete recovery through change 506035
Standby became primary SCN: 506034
Flashback Database Disabled
Tue Jun 29 23:16:23 2004
primary; Switchover: Complete - Database shutdown required
ARCH: Connecting to console port...
Completed: alter database commit to switchover to physical primary
-----------------------------------------------------------------------
|
It takes only 3 seconds to finish this process. How about the status? It is necessary to shutdown first and restart the instance to start up as the primary database.
SQL> select DATABASE_ROLE,OPEN_MODE from v$database;
DATABASE_ROLE OPEN_MODE
---------------- ----------
PRIMARY READ WRITE
|
Wow! It is well set up as Primary Role. OPEN_MODE is shown as READ WRITE. It is now possible to overwrite the database. That's it for today.
Masaru Hayashi
|
|