Oracle dataguard configuration Oracle dataguard Configuration System linux Description: master server ora10g01 (192.168.1.252) Standby server listen 10g02 (192.168.1.253) both machines are installed with the same version of the database master database to create a database www.2cto.com physical standby database not to create a database 1. the master database and slave database must be in the archive mode, and the master database and slave database listen in full. lsnrctl start 2. archive log list 3. set the master database to forcibly archive Conn/as sysdba startup Alter database force logging; 4. modify the tnsnames of the master database and add www.2cto.com ORA10G01 = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.1.253) (PORT = 1521 ))) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ora10g) ORA10G02 = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.1.252) (PORT = 1521) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ora10g) 5. modify the tnsnames www.2cto.com of the slave database and add ORA10G01 = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.1.253) (PORT = 1521 ))) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ora10g) ORA10G02 = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.1.252) (PORT = 1521) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ora10g) 6. generate the control file www.2cto.com Alter database create standby controlfile as '/u01/app/oracle/standby for the slave database. ctl '7. modify the master database initialization parameter file create pfile from spfile and add log_archive_dest_1 = 'location =/u01/app/oracle/archive 'partition = enable partition = 'service = ora10g01' partition = enable log_archive_format =' % t _ % s _ % r. arc 'log_archive_max_processes = 2 fal_server = ora10g01 fal_client = ora10g02 db_unique_name = ora10g01 8. shutdown immediate 9.vi/etc/hosts with www.2cto.com 192.168.1.252 ora10g01 192.168.1.253 ora10g02 10. copy the data files, control files, and log files of the master database to the slave database scp-r ora10g ora10g02: /u01/app/oracle/oadata scp-r/u01/app/oracle/standby. ctl ora10g02:/u01/app/oracle scp-r initora10g. ora ora10g02:/u01/oracle/oradata 11. make sure that the password file Orapwd file =/u01/app/oralce/product/10.2.0/db_1/dbs/orapwora10g 12 is the same. the parameter file www.2cto.com for the backup database Initialization is added with www.2cto.com bandwidth = 'location =/u01/app/oracle/archive 'bandwidth = enable bandwidth = 'service = ora10g02' bandwidth = enable log_archive_format = '% t _ % s _ % r. arc 'log_archive_max_processes = 2 fal_server = ora10g02 fal_client = ora10g01 db_unique_name = ora10g02 13. check whether the archive folder is created 14. delete the control file Mv standby of the slave database. ctl to control01.ctl Cp control01.ctl control02.ctl Cp control01.ctl control03.ctl 14. start the master database Conn/as sysdba Create spfile from pfile Startup Select name, database_role from v $ database; www.2cto.com 15. start the slave database Conn/as sysdba Create pfile from pfile Startup nomount Alter database mount standby database; Select name, database_role from v $ database; Alter database recover managed standby database disconnect from session; 16. create table a (id1 number, id2 number); Insert into a values (); Commit; Alter system switch logfile; alter system switch logfile; standby database select sequence #, first_name, next_time from v $ archive_log orader by sequence #; Select sequence #, applied from v $ archived_log order by sequence #; alter database recover managed standby database cancel; Alter database open read only; Select * from a; Alter database recover managed standby database disconnect from session; Start redo application 17. switch the master database to www.2cto.com and change the master database to the standby state: Alter database commit to switchover to physical standby; close the master database Shutdown immediate; start the master database Startup nomount in the standby mode; alter database mount standby database; select name, open_mode, protection_mode, database_role from v $ database; alter database recover managed stanby database disconnect from session; open the standby database Conn/sysdba Alter database commit to switchover primary; Shutdown immediate; Startup Alter system switch logfile; 18. failover Alter database recover managed standby database finish on standby; Alter database recover managed standby database skip standby logfile; Alter database commit to switchover to primary; Shutdown immediate; Startup; www.2cto.com 19. alter database recover managed standby database cancel; Alter database open read only; if you switch directly to the master database alter database commit to switchover to primary; an error ORA-16139 is reported: media recovery required must execute alter database recover managed stanby database disconnect from session; alter database commit to switchover to primary;