DG:
1,建立相应的文件夹:
mkdir /u01//oradata/
DB:
1,查logfile,controlfile路径,看是否在以上DG路径下,如果没有,继续在DG上建立:
SQL> select * from v$logfile;
2,查DB是否在Archive模式,若不在,请改为Archivelog模式。
3,shutdown DB。
4,create pfile1:
DG:
2,copy oradata文件:
3,copy pfile、passwordfile文件:
$ scp 10.91.50.31:/u01/app/oracle/product/10.1.0/db_1/dbs/orapworatest /u01/app/oracle/product/10.1.0/db_1/dbs/
DB:
5,更改tnsname.ora,之后tnsping测试一下:
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.91.50.31)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORATEST)
)
)
STANDBYTEST
=(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.91.50.6)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORATEST)
)
)
6,shutdownDB,更改pfile:
*.log_archive_dest_2='SERVICE=standbytest MANDATORY REOPEN=60'
*.log_archive_format=ARC%S_%R.%T
*.fal_server=standbytest
*.fal_client=primarytest
*.standby_archive_dest='/u01/app/oracle/oradata/oratest/standbylog'
*.standby_file_management=auto
7,用更改的pfile start DB:
SQL> startup force;
DG:
4,更改pfile:
*.log_archive_dest_2='SERVICE=primarytest MANDATORY REOPEN=60'
*.log_archive_dest_state_2=defer
*.log_archive_format=ARC%S_%R.%T
*.fal_server=primarytest
*.fal_client=standbytest
*.standby_archive_dest='/u01/app/oracle/oradata/oratest/standbylog'
*.standby_file_management=auto
DB:
8,建立DG的control文件:
DG:
5,将control文件copy,并改名
$ cd /u01/app/oracle/oradata/oratest/
$ cp standby.ctl control01.ctl
$ cp standby.ctl control02.ctl
$ cp standby.ctl control03.ctl
6,startup mount DG:
SQL> startup nomount pfile='/u01/app/oracle/product/10.1.0/db_1/dbs/initoratest.ora';
SQL> alter database mount standby database;
7,添加Standby log:
SQL> alter database add standby logfile group 5 ('/u01/app/oracle/oradata/oratest/standbyredo02.log') size 10m;
SQL> alter database add standby logfile group 6 ('/u01/app/oracle/oradata/oratest/standbyredo03.log') size 10m;
8,
9,tail alertlog,查看DB切日志时的执行情况:
$ tail -f alert_oratest.log
DB:
9,切日志:
SQL> /
SQL> /
===========================================================
常见alert错误解决:
1,
现象:
FAL[client]: Failed to request gap sequence for thread 1 gap sequence 5-13
FAL[client]: All defined FAL servers have been attempted.
-------------------------------------------------------------
Check that the CONTROL_FILE_RECORD_KEEP_TIME initialization
parameter is defined to a value that is sufficiently large
enough to maintain adequate log switch information to resolve
archivelog gaps.
-------------------------------------------------------------
产生原因:
起初DB忘记改为ArchiveLog模式,当DG做到最后一步的时候,发现没有ArchiveLog,随后手动在DB、DG上开启ArchiveLog,此后会产生此问题。
解决方案:
重做。
2,
现象:
Errors in file /u01/app/oracle/admin/oratest/bdump/oratest_arc0_29973.trc:
ORA-16038: log 4 sequence# 73 cannot be archived
ORA-16040: standby destination archive log file is locked
ORA-00312: online log 4 thread 1: '/u01/app/oracle/oradata/oratest/standbyredo01.log'
解决方案:http://www.cnblogs.com/vegaslee/archive/2009/08/03/1537753.html DG部分。
3,
现象:ORA-16040: standby destination archive log file is locked
解决方案:
详见:http://www.cnblogs.com/vegaslee/archive/2009/08/12/1544199.html