oracle 12cR2 DG 多租户之switchower切换

Switchover 角色切换

(一) 主、备角色互换
(01). 主库操作:
1) 查看状态
SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE;
SWITCHOVER_STATUS

TO STANDBY
2) 切换状态到standby
SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY WITH SESSION SHUTDOWN;
SQL> SHUTDOWN IMMEDIATE;
3) 置于Open Read Real Time恢复状态
SQL> startup mount;
ORACLE instance started.
Total System Global Area 1660944384 bytes
Fixed Size 8793448 bytes
Variable Size 989856408 bytes
Database Buffers 654311424 bytes
Redo Buffers 7983104 bytes
Database mounted.

SQL> ALTER DATABASE OPEN;
Database altered.

SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED

2 PDB$SEED READ ONLY NO
3 NAILPDB1 MOUNTED
4 PDB2 MOUNTED
5 PDB3 MOUNTED
SQL> alter pluggable database all open;
Pluggable database altered.

SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED

2 PDB$SEED READ ONLY NO
3 NAILPDB1 READ ONLY NO
4 PDB2 READ ONLY NO
5 PDB3 READ ONLY NO
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;
Database altered.

SQL> select open_mode,database_role,protection_mode,protection_level from v$database;
OPEN_MODE DATABASE_ROLE PROTECTION_MODE PROTECTION_LEVEL

READ ONLY WITH APPLY PHYSICAL STANDBY MAXIMUM AVAILABILITY MAXIMUM AVAILABILITY

(02). 备库操作:
以下在备库操作(Backup)
01). 查看状态
SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE;
SWITCHOVER_STATUS

TO PRIMARY
02). 备库切到Primary角色
SQL>ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY WITH SESSION SHUTDOWN;
数据库已更改。
03). 打开数据库
SQL>ALTER DATABASE OPEN;
数据库已更改。
SQL> select open_mode from v$database;
OPEN_MODE

READ WRITE
SQL> select open_mode,database_role,protection_mode,protection_level from v$database;
OPEN_MODE DATABASE_ROLE PROTECTION_MODE PROTECTION_LEVEL

READ WRITE PRIMARY MAXIMUM AVAILABILITY MAXIMUM AVAILABILITY

SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED

2 PDB$SEED READ ONLY NO
3 NAILPDB1 MOUNTED
4 PDB2 MOUNTED
5 PDB3 MOUNTED
SQL> alter pluggable database all open;
Pluggable database altered.

SQL> 
SQL> show pdbs;

CON_ID CON_NAME OPEN MODE RESTRICTED

2 PDB$SEED READ ONLY NO
3 NAILPDB1 READ WRITE NO
4 PDB2 READ WRITE NO
5 PDB3 READ WRITE NO
SQL>

根据上述日志可以看出,切换命令是在CDB中执行的,且所有PDB也会被切换。

转载于:https://my.oschina.net/u/3672799/blog/1821328

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值