1. Build the Environment
Main Library ORACLE11GR2 Library ORACLE11GR2
Db_name ORCL ORCL
Db_unique_name ORCL standby239
Configuring the Host File
Main Library: Primaryhost Library: Standbyhost
The prepare library is placed in archive mode.
2. Configure static monitoring
Primary and standby libraries are configured
Listener.ora
Sid_list_listener =
(Sid_list =
(Sid_desc =
(Sid_name = Clrextproc)
(Oracle_home =/data/oracle/product/11.2.0/dbhome_1)
(program = Extproc)
)
(Sid_desc =
(Global_dbname = ORCL)
(Oracle_home =/data/oracle/product/11.2.0/dbhome_1)
(Sid_name = ORCL)
)
)
Sid_list_listener =
(Sid_list =
(Sid_desc =
(Sid_name = Clrextproc)
(Oracle_home =/data/oracle/product/11.2.0/dbhome_1)
(program = Extproc)
)
(Sid_desc =
(Global_dbname = standby239)
(Oracle_home =/data/oracle/product/11.2.0/dbhome_1)
(Sid_name = ORCL)
)
)
Configure Tnsnames.ora
Master and Standby Library configuration
standby239 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = standbyhost) (PORT = 1521))
(Connect_data =
(UR = A)
(SERVER = dedicated)
(service_name = standby239)
)
)
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = primaryhost) (PORT = 1521))
(Connect_data =
(UR = A)
(SERVER = dedicated)
(service_name = ORCL)
)
)
3. The master repository generates a password file
Using Orapwd
Orapwd file= $ORACLE _HOME/DBS/ORAPWORCL password=xxxxx ignorecase=y
4. Generate Standbylog
ALTER DATABASE Add standby logfile ('/data/oracle/flash_recovery_area/orcl/standby/standby07.log ') size 50m;
ALTER DATABASE Add standby logfile ('/data/oracle/flash_recovery_area/orcl/standby/standby05.log ') size 50m;
ALTER DATABASE Add standby logfile ('/data/oracle/flash_recovery_area/orcl/standby/standby04.log ') size 50m;
ALTER DATABASE Add standby logfile ('/data/oracle/flash_recovery_area/orcl/standby/standby06.log ') size 50m;
5. Modify DG Parameters
Main Library
Alter system set DB_UNIQUE_NAME=ORCL Scope=spfile;
Alter system set log_archive_config= ' dg_config= (orcl,standby239) ' Scope=both;
Alter system set log_archive_dest_1= ' Location=/data/oracle/flash_recovery_area/orcl valid_for= (All_logfiles,all_ roles) Db_unique_name=orcl ' Scope=both;
Alter system set log_archive_dest_2= ' service=standby239 async lgwr valid_for= (online_logfiles,primary_role) db_unique _name=standby239 ' Scope=both;
Alter system set log_archive_dest_state_1=enable Scope=both;
Alter system set log_archive_dest_state_2=enable Scope=both;
Alter system set fal_server=standby239 Scope=both;
Alter system set FAL_CLIENT=ORCL Scope=both;
alter system set Standby_file_management=auto;
Standby Library
Alter system set db_unique_name=standby239 Scope=spfile;
Alter system set log_archive_config= ' dg_config= (orcl,standby239) ' Scope=both;
Alter system set log_archive_dest_1= ' Location=/data/oracle/flash_recovery_area/orcl valid_for= (All_logfiles,all_ roles) db_unique_name=standby239 ' Scope=both;
Alter system set log_archive_dest_2= ' SERVICE=ORCL async lgwr valid_for= (online_logfiles,primary_role) db_unique_name= Orcl ' Scope=both;
Alter system set log_archive_dest_state_1=enable Scope=both;
Alter system set log_archive_dest_state_2=enable Scope=both;
Alter system set FAL_SERVER=ORCL Scope=both;
Alter system set fal_client=standby239 Scope=both;
alter system set Standby_file_management=auto;
6. Using Rman duplicate main library to standby library
To put a standby in an unmounted state
Rman Target sys/xxxx auxiliary sys/[email protected]
Duplicate target database for standby nofilenamecheck from active database;
If renaming is required, use the set newname for
7. Put the standby library in active Dataguard mode
ALTER DATABASE mount standby database;
ALTER DATABASE open read only;
ALTER DATABASE recover managed standby database disconnect from session;
or ALTER DATABASE recover managed standby database using current logfile disconnect from session; (Real-time Application log mode)
This allows you to experiment with the state of the master and standby libraries.
This article is from the "11662668" blog, please be sure to keep this source http://11672668.blog.51cto.com/11662668/1883005
Oracle 11gR2 Build Dataguard