Oracle 10G Dataguard Construction

Source: Internet
Author: User

We've talked about the construction of Oracle 11G Dataguard in the front, and the 10G build is similar. However, Oracle 10G does not support standby open

Environment:

Role Host Name Ip Database version Operating system version
Primary Fdb1 192.168.10.8 10.2.0.1 CentOS 5.11 x86_64
Standby Fdb2 192.168.10.9 10.2.0.1 CentOS 5.11 x86_64

In the/etc/hosts of FDB1 (FDB1)

127.0.0.1 fdb1192.168.10.9 FDB2

In the/etc/hosts of FDB2 (FDB2)

127.0.0.1 fdb2192.168.10.8 FDB1

Create the necessary directories (FDB1,FDB2)

Mkdir-p/opt/oracle/flash_recovery_areamkdir-p/opt/oracle/admin/fengdb/{a,b,c,u}dumpmkdir/opt/oracle/oradata/ Fengdb-pmkdir-p/opt/oracle/dbackupmkdir-p/opt/oracle/flash_recovery_area/fengdb/archivelog

View the current Redo group (FDB1)

Select Group#,member from v$logfile;//add standby log Group ALTER DATABASE add standby logfile ('/opt/oracle/oradata/fengdb/ Standby04.log ') Size 50m;alter database add standby logfile ('/opt/oracle/oradata/fengdb/standby05.log ') size 50m;alter Database add standby logfile ('/opt/oracle/oradata/fengdb/standby06.log ') size 50m;alter database add standby logfile ('/ Opt/oracle/oradata/fengdb/standby07.log ') size 50m;


Create original parameter file for backup (FDB1)

Create pfile= '/tmp/fengdb.pfile.ori ' from SPFile;


Modify the relevant parameters for the Dataguard environment, note that this is different from Oracle 11G (FDB1)

Alter system set db_unique_name=fdb1 scope=spfile;alter system set log_ Archive_config= ' dg_config= (fdb1,fdb2) '  scope=spfile;alter system set log_archive_dest_1=   ' location=/opt/oracle/flash_recovery_area/fengdb/archivelog valid_for= (all_logfiles,all_roles)   DB_UNIQUE_NAME=FDB1 '  scope=spfile;alter system set log_archive_dest_2=  ' Service=fdb2 async  valid_for= (online_logfiles,primary_role)   db_unique_name=fdb2 '  scope=spfile;alter system set log_archive_dest= '  scope=spfile;alter system  set log_archive_dest_state_1=enable scope=spfile;alter system set log_archive_ Dest_state_2=enable scope=spfile;alter system set standby_file_management=auto scope= Spfile;alter system set fal_server=fdb2 scope=spfile;alter system set fal_ Client=fdb1 scope=spfile;aLter system set db_file_name_convert= '/opt/oracle/flash_recovery_area ', '/opt/oracle/flash_ Recovery_area '  scope=spfile;alter system set log_file_name_convert= '/opt/oracle/flash_ Recovery_area ', '/opt/oracle/flash_recovery_area '  scope=spfile;

Note: Unlike Oracle 11G, there are:

Alter system set log_archive_dest= ' Scope=spfile;

Otherwise, ora-16019:cannot use log_archive_dest_1 with Log_archive_dest or log_archive_duplex_dest may appear

And the above are directly modified SPFile, do not modify the current running parameters

Scope=spfile


Executing the above statement is actually changing some of the following parameters

*.db_unique_name= ' FDB1 '

*.log_archive_config= ' dg_config= (FDB1,FDB2) '

*.log_archive_dest_1= ' Location=/opt/oracle/flash_recovery_area/fengdb/archivelog valid_for= (All_logfiles,all_ roles) DB_UNIQUE_NAME=FDB1 '

*.log_archive_dest_2= ' service=fdb2 async valid_for= (online_logfiles,primary_role) db_unique_name=fdb2 '

*.log_archive_dest_state_1= ' ENABLE '

*.log_archive_dest_state_2= ' ENABLE '

*.standby_file_management= ' AUTO '

*.fal_client= ' FDB1 '

*.fal_server= ' FDB2 '

*.db_file_name_convert= '/opt/oracle/flash_recovery_area ', '/opt/oracle/flash_recovery_area '

*.log_file_name_convert= '/opt/oracle/flash_recovery_area ', '/opt/oracle/flash_recovery_area '

*.log_archive_dest= "


Restart the database for the database to take effect (FDB1)

Shutdown Immediatestartup


Modify Listener (FDB1)

Vim $ORACLE _home/network/admin/tnsnames.ora

FDB1 = (DESCRIPTION = (Address_list = (ADDRESS = (PROTOCOL = TCP) (HOST = fdb1) (PORT = 1521)) (Connect_dat A = (SERVER = dedicated) (service_name = fdb1))) Fdb2 = (DESCRIPTION = (Address_list = (ADDRESS = (PROTOCOL = TCP) (HOST = fdb2)    (PORT = 1521)) ) (Connect_data = (SERVER = dedicated) (service_name = FDB2)))


Rman Backup (FDB1)

Rman target/run{allocate Channel C1 type disk;backup format '/opt/oracle/dbackup/fengdb_%t_%s_%p ' Database;sql ' alter SY Stem archive log current '; Backup format '/opt/oracle/dbackup/archive_log_%t_%s_%p ' archivelog all;backup spfile format ' /opt/oracle/dbackup/spfile_%u_%t.bak '; release channel C1;} Copy current Controlfile-standby to '/opt/oracle/dbackup/standby.ctl ';


Copy all backup and listen files and password files to FDB2 (FDB1)

Scp-r/opt/oracle/dbackup/* Fdb2:/opt/oracle/dbackup

Scp-r $ORACLE _home/network/admin/* fdb2: $ORACLE _home/network/admin/

Scp-r $ORACLE _home/dbs/* fdb2: $ORACLE _home/dbs/


Perform the following recovery of the database on FDB2 (FDB2)

rman> startup Nomount;

rman> restore SPFile to Pfile '/tmp/fengdb.pfile ' from '/opt/oracle/dbackup/spfile_rmrioont_20161019.bak ';

rman> shutdown immediate;

Then modify the/etc/fengdb.pfile into the red part as follows

*.db_unique_name= 'fdb2'

*.fal_client= 'fdb2'

*.fal_server= 'fdb1'

*.log_archive_config= ' dg_config= (fdb2,fdb1) '

*.log_archive_dest_1= ' Location=/opt/oracle/flash_recovery_area/fengdb/archivelog valid_for= (All_logfiles,all_ roles) db_unique_name=fdb2'

*.log_archive_dest_2= ' service=fdb1 async valid_for= (online_logfiles,primary_role) db_unique_name= FDB1'

*.log_archive_dest_state_1= ' ENABLE '

*.log_archive_dest_state_2= ' ENABLE '


Standby Copy Control file (FDB2)

Cp/opt/oracle/dbackup/standby.ctl/opt/oracle/oradata/fengdb/control01.ctl

Cp/opt/oracle/dbackup/standby.ctl/opt/oracle/oradata/fengdb/control02.ctl

Cp/opt/oracle/dbackup/standby.ctl/opt/oracle/oradata/fengdb/control03.ctl


Boot to mount state for data recovery

rman> startup Mount; rman> Restore Database;

Start the standby Application log

sql> ALTER DATABASE recover managed standby database using current logfile disconnect from session;

Creating a parameter file

Sql> create SPFile from pfile= '/tmp/fengdb.pfile ';

Note: The difference between Oracle 10G and 11G:

10G standby can only boot to mount state, and 11G can boot to open read only.


Check if logs are synchronized (FDB1,FDB2)

Select sequence#,applied from V$archived_log;

You can also try switching the logs.

Toggle log alter system switch Logfile;select sequence#,applied from V$archived_log;


In the Main library: (FDB1)

Select Dest_name,status,error from V$archive_dest;alter system set log_archive_dest_state_2= enable;


Query Role (FDB1,FDB2)

Select Open_mode,database_role from V$database;





If you are on a standby library,

Sql> select sequence#,applied from V$archived_log;

No rows selected

And the monitoring is normal, it is possible that the password has not been copied over

Keep the main vault password consistent with the repository password

Copy password file (FDB1)

SCP $ORACLE _home/dbs/orapw$oracle_sid fdb2: $ORACLE _home/dbs/orapw$oracle_sid






This article is from "Maple Night" blog, please be sure to keep this source http://fengwan.blog.51cto.com/508652/1864165

Oracle 10G Dataguard Construction

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.