码迷,mamicode.com
首页 > 数据库 > 详细

oracle 19c 主备切换

时间:2020-06-28 00:24:55      阅读:120      评论:0      收藏:0      [点我收藏+]

标签:cal   nec   mit   switch   name   uniq   max   sys   data   

主库:

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

 

oracle 19c 主备切换

标签:cal   nec   mit   switch   name   uniq   max   sys   data   

原文地址:https://www.cnblogs.com/tingxin/p/13200480.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!