#################################################################
#Parameters which using for switch over from Standby to Primary.
#################################################################
*.LOG_ARCHIVE_DEST_1='LOCATION=/u01/app/oracle/archivelog VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=orcldg'
*.LOG_ARCHIVE_DEST_2='SERVICE=orcl LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=orcl'
*.LOG_ARCHIVE_DEST_STATE_1=ENABLE
*.LOG_ARCHIVE_DEST_STATE_2=ENABLE
*.REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE
5).通过该pfile 创建spfile
SQL> create spfile from pfile= 'initorcldg.ora';
File created.
4恢复数据库
启动备库到nomount
startup nomount
[oracle@dg2 admin]$ rman target sys/oracle@orcl auxiliary /
RMAN> duplicate target database for standby nofilenamecheck;
RMAN> exit
关闭数据库
shutdown immediate
5.启动redo 应用
startup nomount;
alter database mount standby database;
SQL> alter database recover managed standby database using current logfile disconnect from session;
Database altered.
6.验证
主库
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /u01/app/oracle/archivelog
Oldest online log sequence 73
Next log sequence to archive 75
Current log sequence 75
备库
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /u01/app/oracle/archivelog
Oldest online log sequence 70
Next log sequence to archive 0
Current log sequence 75
7.切换到只读模式
SQL> alter database recover managed standby database cancel;
Database altered.
SQL> alter database open read only;
Database altered.
8.切换到同步模式(不需要停库)
SQL> alter database recover managed standby database using current logfile disconnect from session;
Database altered.
基于同一主机配置 Oracle 11g Data Guard
手把手教你搭建Oracle 11g DataGuard
Oracle Data Guard (RAC+DG) 归档删除策略及脚本
Oracle 11g Data Guard Error 16143 Heartbeat failed to connect to standby 处理方法
Oracle 11g RAC搭建单机DataGuard