搭建参见文章http://snowhill.blog.51cto.com/339421/1923591,搭好后,做switch over:
1 检查参数fal_server,fal_client,log_archive_dest_2,log_file_name_convert,data_file_name_convert,
standby_file_management
源:
fal_server=standby
fal_cleint=db
alter system set db_file_name_convert=‘/data‘,‘+data‘ scope=spfile; alter system set log_file_name_convert=‘/data‘,‘+data‘ scope=spfile;
standby:
fal_server=db
fal_client=standby
standby_file_management=auto
2 切换前rac需关闭至一个实例
3 检查是否有gap
4 切换:
源:
SQL> alter database commit to switchover to standby with session shutdown;
这里切换后,源端全自动shutdown abort;
--standby
SQL>select name,open_mode,DATABASE_ROLE,PROTECTION_MODE,switchover_status from v$database; NAME OPEN_MODE DATABASE_ROLE PROTECTION_MODE SWITCHOVER_STATUS --------- -------------------- ---------------- -------------------- -------------------- DB READ ONLY WITH APPLY PHYSICAL STANDBY MAXIMUM AVAILABILITY TO PRIMARY
SQL>alter system set log_archive_dest_2="service=db lgwr sync affirm valid_for=(all_logfiles,all_roles) db_unique_name=db" scope=both; SQL>alter system set log_archive_dest_state_2=enable; SQL>alter database commit to switchover to primary with session shutdown;
--源
SQL>startup mount SQL>alter system set log_archive_dest_state_2=defer; SQL>select name, LOG_MODE, OPEN_MODE, database_role, SWITCHOVER_STATUS, db_unique_name from v$database NAME LOG_MODE OPEN_MODE DATABASE_ROLE SWITCHOVER_STATUS DB_UNIQUE_NAME --------- ------------ -------------------- ---------------- -------------------- ------------------------------ DB ARCHIVELOG MOUNTED PHYSICAL STANDBY RECOVERY NEEDED db SQL> alter database recover managed standby database cancel; SQL> alter database open; SQL> alter database recover managed standby database using current logfile disconnect; SQL> select name, LOG_MODE, OPEN_MODE, database_role, SWITCHOVER_STATUS, db_unique_name from v$database; NAME LOG_MODE OPEN_MODE DATABASE_ROLE SWITCHOVER_STATUS DB_UNIQUE_NAME --------- ------------ -------------------- ---------------- -------------------- ------------------------------ DB ARCHIVELOG READ ONLY WITH APPLY PHYSICAL STANDBY TO PRIMARY db
--standby
SQL>alter system set log_archive_dest_2="service=db lgwr sync affirm valid_for=(all_logfiles,all_roles) db_unique_name=db" scope=both;
SQL>alter system set log_archive_dest_state_2=enable scope=both;
本文出自 “snowhill” 博客,请务必保留此出处http://snowhill.blog.51cto.com/339421/1951592
dataguard rac到单机之间的switch over
原文地址:http://snowhill.blog.51cto.com/339421/1951592