日期:2014-05-16 浏览次数:20483 次
SQL> select log_mode from v$database;
如果结果不是"ARCHIVELOG",执行以下命令:
SQL> shutdown immediate;
SQL> startup mount;
SQL> alter database archivelog;
SQL> alter database open;
SQL> select force_logging from v$database;
如果结果不是"YES",执行以下命令:
SQL> alter database force logging;SQL> select group#,thread#,bytes/1024/1024 from v$log;
根据得到的group数目和log大小,为Standby实例创建对应的logfile,默认情况下是三个Group,且每个大小为50M。
SQL> alter database add standby logfile ‘/home/oracle/app/oracle/oradata/sungoin/stby_redo01.log’ size 50m;
SQL> alter database add standby logfile ‘/home/oracle/app/oracle/oradata/sungoin/stby_redo02.log’ size 50m;
SQL> alter database add standby logfile ‘/home/oracle/app/oracle/oradata/sungoin/stby_redo03.log’ size 50m;
SQL> alter system set log_archive_config=’DG_CONFIG=(test,standby)’;
SQL> alter system set log_archive_dest_1=’LOCATION=/home/oracle/app/oracle/flash_recovery_area/test/archivelog VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=test’;
SQL> alter system set log_archive_dest_2=’service=standby ASYNC valid_for=(ONLINE_LOGFILE,PRIMARY_ROLE) db_unique_name=standby’;
SQL> alter system set fal_server=test;
SQL> alter system set fal_client=standby;
SQL> alter system set standby_file_management=auto;
SQL> alter system set remote_login_passwordfile=exclusive;
在Primary服务器的监听器中静态注册test实例,添加下面行到文件 /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora中:
SID_LIST_LISTENER =)
在Primary服务器的TNS中注册test和standby,添加下面行到文件 /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora中: