?
Dataguard 主从切换
在 RAC 状态下,主从数据库的切换时主从库只能有一个实例在运行状态。在切换前需关掉其他节点,在切换完成后再启动其他节点。查询主从库状态
sql> select database_role,switchover_status from v$database;
将主库切换到从库状态
sql> alter database commit to switchover to physical standbywithsession shutdown;
如果主库状态为 “sessions active”,则需要在命令后加上 with sessionshutdown 语句。状态。
重起原数据库到 mount 状态。
SQL>shutdown immediate;
SQL>startup mount;
?
在原从库上执行切换命令
sql> alter database commit to switchover to primary withsession shutdown;
SQL>alter database open;
完成主备切换后,在新备库上启用日志应用:
?
SQL> alter database recover managed standby databaseusing current logfile disconnect from session;
?
[root@srvrac2~]# srvctl start instance -d test2 -i test22
PRCR-1013: 无法启动资源ora.test2.db
PRCR-1064: 无法在节点 srvrac2上启动资源ora.test2.db
CRS-5017:The resource action "ora.test2.db start" encountered the followingerror:
ORA-01618:redo thread 2 is not enabled - cannot mount
. Fordetails refer to "(:CLSN00107:)" in"/bee/app/11.2.0/grid/log/srvrac2/agent/crsd/oraagent_oracle/oraagent_oracle.log".
?
CRS-2674:Start of 'ora.test2.db' on 'srvrac2' failed
?
?
?
ORA-01618:redo thread 2 is not enabled - cannot mount
http://tiany.blog.51cto.com/513694/1415383
?
alterdatabase add logfile thread 2 ('+DATA') size 50m;
alterdatabase add logfile thread 2 ('+DATA') size 50m;
alterdatabase add logfile thread 2 ('+DATA') size 50m;
alterdatabase enable thread 2;
?
?
ORA-01092:ORACLE instance terminated. Disconnection forced
ORA-30013:undo tablespace 'UNDOTBS1' is currently in use
SQL>alter system set db_create_file_dest='+DATA';
SQL>create undo tablespace undotbs2;
altersystem set undo_tablespace='UNDOTBS1' scope=spfile sid='test11';
altersystem set undo_tablespace='UNDOTBS2' scope=spfile sid='test22';