Commands related to DG query / switch
View the role transitions that can be made in the database
1. $sqlplus / as sysdba
2. SQL > select switchover_status from gv$database
Query the synchronization of the main and standby databases
3. Select unique thread# as thread,max (sequence#) over (partition by thread#) as last from gv$archived_log
4. Select thread#, low_sequence#,high_sequence# from gv$archive_gap
Switch the main library to the standby library
5. Alter database commit to switchover to physical standby with session shutdown
6. Select switchover_status from gv$database
Switch the standby library to the primary library
7. Select open_mode from gv$database
8. Select switchover_status from gv$database
9. Select unique thread# as thread,max (sequence#) over (partition by thread#) as last from gv$archived_log
10$ srvctl stop instance-I ebiz2-d ebizsh
11.SQL > alter database commit to switchover to primary with
Session shutdown
12. Alter database open
13. $srvctl start instance-I ebiz2-d ebizsh
Log is applied after the original master database is transferred to the database.
14. SQL > alter database recover managed standby database using current logfile disconnect from session
15. $srvctl start instance-d ebiz-I ebiz2
16. SQL > select open_mode from gv$database
(7) Oracle logs in to the database server. The original city backup database needs to restart the log application after the master / slave switch between Heilongjiang and Shanghai.
17. SQL > alter database recover managed standby database
Using current logfile disconnect from session
18. SQL > select status from v$managed_standby where
Process like 'MRP%'
Only
Start the database node 1 instance
19. $srvctl start instance-I ebiz1-d ebiz
20. $srvctl stop instance-I ebiz2-d ebiz
Continue with redo apply
21. SQL > alter database recover managed standby database
Using current logfile disconnect
Until the log is synchronized, the SCN number remains unchanged, and check the gv$archived_log view to see that the serial number reaches the maximum value on the source side.
twenty-two。 SQL > select current_scn from gv$database
23. SQL > select unique thread# as thread,max (sequence#)
Over (partition by thread#) as last from gv$archived_log
24. $asmcmd
25. Cp + DATA_DG/ebiz/archivelog/YYYYMMDD/XXXX
/ rman/backup/-- copy to the file system
Ftp or scp to Shanghai
Register the archive log file
twenty-six。 SQL > ALTER DATABASE REGISTER PHYSICAL LOGFILE
'XXXX'
twenty-seven。 Database altered.
And then redo apply.
twenty-eight。 SQL > alter database recover managed standby database using current logfile disconnect
twenty-nine。 SQL > alter database commit to switchover to primary with
Session shutdown
thirty。 SQL > alter database open; SQL > select open_mode from
Gv$database
thirty-one。 SQL > select switchover_status from gv$database
thirty-two。 $srvctl start instance-I ebiz2-d ebizsh