Technical recommendations and programmes.
要求failover后不重建备库,并能够把failover的数据库重新切换回备库 主库为newtest,备库为snewtest备库上已经开启了闪回
Get a reference to the SCN
SQL> select current_scn from v$database;CURRENT_SCN----------- 4491930
View the Flashback database feature is open.
SQL> select flashback_on from v$database;FLASHBACK_ON------------------------------------YES
Then we start failover on the standby.
DGMGRL> failover to snewtest;Performing failover NOW, please wait...Failover succeeded, new primary is "snewtest"
The operation is completed quickly and we look at the status and role of the repository at this time
SQL> select open_mode,database_role from v$database;OPEN_MODE DATABASE_ROLE-------------------- ----------------READ WRITE PRIMARY
Of course, this step can do some reading and writing operations.
Then we started planning to cut back to the repository.
SQL> shutdown immediateSQL> startup mount
Flashback database to the specified SCN,
SQL> flashback database to scn 4491930; Flashback complete.
Switch this new main library into a standby library
SQL> alter database convert to physical standby;Database altered.
Need to restart the standby library
SQL> shutdown immediateSQL> startup mount
The most critical step to reconfigure the DG Broker on the main library is to remove the DG broker configuration
Sql> alter system set Dg_broker_start = FALSE; System altered. sql>!ps-ef |grep dmon Oracle 24648 24644 0 00:13 pts/3 00:00:00/bin/bash-c ps-ef |gre P dmonoracle 24650 24648 0 00:13 pts/3 00:00:00 grep dmon[[email protected] ~]$ CD $ORACLE _home/dbs[[email  ;p rotected] dbs]$ lltotal 10048-rw-r-----. 1 Oracle DBA 8192 Mar 00:07 dr1newtest.dat-rw-r-----. 1 Oracle DBA 8192 Mar 00:07 dr2newtest.dat-rw-rw----. 1 Oracle DBA 1544 Mar 00:02 HC_DBUA1321268.DAT-RW-RW----. 1 Oracle DBA 1544 Mar 21:10 hc_newtest.dat-rw-r--r--. 1 Oracle DBA 982 Mar 23:12 initnewtest.ora-rw-r--r--. 1 Oracle DBA 2851 May init.ora-rw-r-----. 1 Oracle DBA 20:16 lknewtest-rw-r-----. 1 Oracle DBA 1536 Jan 20:18 orapwnewtest-rw-r-----. 1 Oracle DBA 10240000 Mar 23:53 snapcf_newtest.f-rw-r-----. 1 Oracle DBA 3584 Mar 00:12 spfilenewtest.ora[[email protected] dbs]$ rm-rf dr*newtest.dat[[eMail protected] dbs]$ lltotal 10032-RW-RW----. 1 Oracle DBA 1544 Mar 00:02 HC_DBUA1321268.DAT-RW-RW----. 1 Oracle DBA 1544 Mar 21:10 hc_newtest.dat-rw-r--r--. 1 Oracle DBA 982 Mar 23:12 initnewtest.ora-rw-r--r--. 1 Oracle DBA 2851 May init.ora-rw-r-----. 1 Oracle DBA 20:16 lknewtest-rw-r-----. 1 Oracle DBA 1536 Jan 20:18 orapwnewtest-rw-r-----. 1 Oracle DBA 10240000 Mar 23:53 snapcf_newtest.f-rw-r-----. 1 Oracle DBA 3584 Mar 00:12 Spfilenewtest.ora
Remove the DG Broker configuration on the standby library
Sql> alter system set Dg_broker_start = FALSE; System altered. sql>!ps-ef |grep dmonoracle 15200 15198 0 00:15 pts/2 00:00:00/bin/bash-c ps-ef |grep dmonoracle 15202 152 0 00:15 pts/2 00:00:00 grep dmonsql> exitdisconnected from Oracle Database 11g Enterprise Edition Release 11.2.0 .4.0-64bit Productionwith The partitioning, OLAP, Data Mining and Real application testing options[[email protected ] backup_stage]$ CD $ORACLE _home/dbs[[email protected] dbs]$ lltotal 10064-rw-r-----. 1 Oracle DBA 20480 Mar 00:13 dr1snewtest.dat-rw-r-----. 1 Oracle DBA 20480 Mar 00:08 dr2snewtest.dat-rw-rw----. 1 Oracle DBA 1544 Mar 00:12 hc_newtest.dat-rw-r--r--. 1 Oracle DBA 1062 Mar 23:30 initnewtest.ora-rw-r-----. 1 Oracle DBA 23:38 lksnewtest-rw-r-----. 1 Oracle DBA 1536 Mar 23:34 orapwnewtest-rw-r-----. 1 Oracle DBA 10240000 Mar 06:45 snapcf_newtest.f-rw-r-----. 1 Oracle DBA 4608 Mar 00:15 Spfilenewtest.ora[[email protected] dbs]$ rm-rf dr*snewtest.dat[[email protected] dbs]$ lltotal 10024-RW-RW----. 1 Oracle DBA 1544 Mar 00:12 hc_newtest.dat-rw-r--r--. 1 Oracle DBA 1062 Mar 23:30 initnewtest.ora-rw-r-----. 1 Oracle DBA 23:38 lksnewtest-rw-r-----. 1 Oracle DBA 1536 Mar 23:34 orapwnewtest-rw-r-----. 1 Oracle DBA 10240000 Mar 06:45 snapcf_newtest.f-rw-r-----. 1 Oracle DBA 4608 Mar 00:15 Spfilenewtest.ora
Re-configuring DG Broker on the main library
Sql> alter system set Dg_broker_start =true; System altered. [[email protected] dbs]$ dgmgrl/dgmgrl for linux:version 11.2.0.4.0-64bit productioncopyright (c) Cle. All rights reserved. Welcome to DGMGRL, type ' help ' for information. Connected.dgmgrl> Create configuration Dg_newtest as primary database is Newtest connect identifier is newtest; Configuration "Dg_newtest" created with primary database "Newtest" dgmgrl> show configuration; Configuration-dg_newtest Protection mode:maxperformance databases:newtest-primary databasefast-start Failover: Disabledconfiguration status:disableddgmgrl> enable configuration; Enabled.dgmgrl> show configuration; Configuration-dg_newtest Protection mode:maxperformance databases:newtest-primary databasefast-start Failover: Disabledconfiguration status:successdgmgrl> Add database snewtest as connect identifier is snewtest maintained as Physi Cal;database "Snewtest" addeddgmgrl> enable Database SNEwtest; Enabled.dgmgrl> show configuration; Configuration-dg_newtest Protection mode:maxperformance databases:newtest-primary Database Snewtest-physi Cal standby Database error:ora-16525:the Data Guard Broker is not yet Availablefast-start Failover:disabledconfigu Ration Status:error
At this point, the repository's Data Guard broker is not available to configure the DG broker for the Repository
SQL> alter system set dg_broker_start = true;System altered.
View the status of the DG broke again on the main library
DGMGRL> show configurationConfiguration - dg_newtest Protection Mode: MaxPerformance Databases: newtest - Primary database snewtest - Physical standby database Error: ORA-16613: initialization in progress for databaseFast-Start Failover: DISABLEDConfiguration Status:ERROR
This is the initial state of the open standby library
SQL> alter database open;Database altered.
View the status of the DG broke again on the main library
DGMGRL> show configurationConfiguration - dg_newtest Protection Mode: MaxPerformance Databases: newtest - Primary database snewtest - Physical standby databaseFast-Start Failover: DISABLEDConfiguration Status:SUCCESS
To view the status of a standby library
SQL> select open_mode,database_role from v$database;OPEN_MODE DATABASE_ROLE-------------------- ----------------READ ONLY WITH APPLY PHYSICAL STANDBY
The process of simulating failover of ORACLE11GR2_ADG management in the standby storehouse