oracle 19c 主备切换
主库:
SQL> alter database commit to switchover to physical standby with session shutdown; Database altered. SQL> startup ORACLE instance started. Total System Global Area 2466250400 bytes Fixed Size 9137824 bytes Variable Size 536870912 bytes Database Buffers 1912602624 bytes Redo Buffers 7639040 bytes Database mounted. Database opened. SQL> select open_mode from v$database; OPEN_MODE ------------------------------------------------------------ READ ONLY SQL> select name,database_role,switchover_status from v$database; NAME DATABASE_ROLE SWITCHOVER_STATUS --------------------------- ------------------------------------------------ ------------------------------------------------------------ MTXDB PHYSICAL STANDBY RECOVERY NEEDED SQL> alter database recover managed standby database disconnect from session; Database altered. SQL> select name,database_role,switchover_status from v$database; NAME DATABASE_ROLE SWITCHOVER_STATUS --------------------------- ------------------------------------------------ ------------------------------------------------------------ MTXDB PHYSICAL STANDBY NOT ALLOWED
SQL> SELECT UNIQUE THREAD#, MAX(SEQUENCE#) OVER(PARTITION BY THREAD#) LAST FROM v$archived_log;
THREAD# LAST
---------- ----------
1 39
备库:
SQL> alter database commit to switchover to primary; Database altered. SQL> alter database open; Database altered. SQL> select open_mode from v$database; OPEN_MODE ------------------------------------------------------------ READ WRITE SQL> select name,database_role,switchover_status from v$database; NAME DATABASE_ROLE SWITCHOVER_STATUS --------------------------- ------------------------------------------------ ------------------------------------------------------------ MTXDB PRIMARY TO STANDBY SQL> SELECT UNIQUE THREAD#, MAX(SEQUENCE#) OVER(PARTITION BY THREAD#) LAST FROM v$archived_log; THREAD# LAST ---------- ---------- 1 39
每天进步一点点,多思考,多总结
版权声明:本文为CNblog博主「zaituzhong」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。