oracle DG 启动和关闭顺序
启动顺序:先启动备库,后启动主库 关闭顺序:先关闭主库,后关闭备库 1、正确打开备库和主库 备库: SQL> STARTUP MOUNT; SQL>ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION; 主库: SQL> STARTUP MOUNT; SQL> ALTER DATABASE ARCHIVELOG; SQL> ALTER DATABASE OPEN; 2、正确关闭顺序 主库 SQL>SHUTDOWN IMMEDIATE; 备库: SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL; SQL>SHUTDOWN IMMEDIATE; ############################################################################ 1. 主备切换 1) 主库切换为备库 alter database commit to switchover to physical standby; 主库有会话连接的时候 alter database commit to switchover to physical standby with session shutdown; shutdown immediate startup nomount alter database mount standby database; alter database recover managed standby database disconnect from session; 2) 从库切换为主库 alter database commit to switchover to primary; shutdown immediate; startup alter system switch logfile; 3) 从库打开只读实时应用模式 alter database recover managed standby databasecancel; alter database open; alter database recover managed standby database using current logfile disconnect; 4) 检查切换状态 select open_mode,database_role,db_unique_name from v$database;