Oracle Data Guard Linux Platform Physical Standby Build example
Data Guard Environment:
Operating system: Redhat 4.7
Primary database:
IP address: 10.85.10.1.
Database SID:ORCL
Db_unique_name:orcl_pd
Standby database:
IP Address: 10.85.10.2
Database SID:ORCL.
Db_unique_name:orcl_st
I. Configuration of the rimary end
1. The main library is set to force logging mode
sql> ALTER DATABASE force logging;
2. The main library is set to archive mode
sql> archive log list;
sql> shutdown Immediate
Sql> Startup Mount
sql> ALTER DATABASE Archivelog;
sql> archive log list;
3. Add Redo Log File
Add a new standby Redologs group (note that the group number does not repeat with the currently existing online redologs group) and assign a member to the group:
sql> ALTER DATABASE ADD STANDBY LOGFILE GROUP 4 ('/u01/app/oracle/oradata/orcl/redo04.log ') size 50M;
sql> ALTER DATABASE ADD STANDBY LOGFILE GROUP 5 ('/u01/app/oracle/oradata/orcl/redo05.log ') size 50M;
sql> ALTER DATABASE ADD STANDBY LOGFILE GROUP 6 ('/u01/app/oracle/oradata/orcl/redo06.log ') size 50M;
sql> ALTER DATABASE ADD STANDBY LOGFILE GROUP 7 ('/u01/app/oracle/oradata/orcl/redo07.log ') size 50M;
4. Modification of Listener.ora and Tnsnames.ora documents
Listener.ora file:
Sid_list_listener =
(Sid_list =
(Sid_desc =
(Sid_name = Plsextproc)
(Oracle_home =/u01/app/oracle/product/10.2.0/db_1)
(program = Extproc)
)
(Sid_desc =
(Global_dbname = ORCL)
(Oracle_home =/u01/app/oracle/product/10.2.0/db_1)
(Sid_name = ORCL)
)
)
LISTENER =
(Description_list =
(DESCRIPTION =
(address = (PROTOCOL = TCP) (HOST = Localhost.localdomain) (PORT = 1521))
(address = (PROTOCOL = IPC) (KEY = EXTPROC0))
)
)
Note: The Sid_list_listener is configured with static registration, if there is no such parameter, and the data Guard boot sequence is incorrect, then the main library may be reported PING[ARC1]: Heartbeat failed to connect to standby ' Orcl_st '. Error is 12514. Error, causing the archive to not complete.
Oracle Listener Dynamic registration and static registration
Http://blog.csdn.net/tianlesoftware/archive/2010/04/30/5543166.aspx
Tnsnames.ora file
Orcl_st =
(DESCRIPTION =
(Address_list =
(address = (PROTOCOL = TCP) (HOST = 10.85.10.2) (PORT = 1521))
)
(Connect_data =
(SERVER = dedicated)
(service_name = ORCL)
)
)
ORCL_PD =
(DESCRIPTION =
(Address_list =
(address = (PROTOCOL = TCP) (HOST = 10.85.10.1) (PORT = 1521))
)
(Connect_data =
(SERVER = dedicated)
(service_name = ORCL)
)
)
5. Create the password file and control file for the standby library
sql> ALTER DATABASE create standby Controlfile as '/u01/control01.ctl ';
--to judge whether a database is primary or standby, is to judge by the control document.
[Oracle@localhost dbs]$ orapwd FILE=/U01/APP/ORACLE/PRODUCT/10.2.0/DB_1/DBS/ORAPWORCL password=admin
If it already exists, you do not have to create it. By default, the format of the password file under Win is Pwdsid.ora,unix under ORAPWSID (case sensitive)
6. Modify initialization parameter file
sql> create pfile= '/u01/initorcl.ora ' from SPFile;
Add the following in Initorcl.ora:
### #主库参数 ######
*. db_name = ' ORCL ';
Configured in #--listening
*. Db_unique_name= ' ORCL_PD '
#--List all db_unique_name in DG
*. Log_archive_config= ' dg_config= (orcl_pd,orcl_st) '
*. Log_archive_dest_1= ' location=/u01/archive valid_for= (all_logfiles,all_roles) db_unique_name=orcl_pd '
*. Log_archive_dest_2= ' Service=orcl_st db_unique_name=orcl_st '
*. Log_archive_dest_state_1=enable
*. Log_archive_dest_state_2=enable
*. Remote_login_passwordfile=exclusive
# # # # #备库参数 #######
*. Fal_server=orcl_st
*. Fal_client=orcl_pd
*.standby_file_management= ' AUTO '
*.standby_archive_dest= '/u01/archive '
#如果主备库目录不同, you also need to add:
#*.log_file_name_convert= '/u02/oradata/orcl/', '/u03/oradata/orcl/'
#*.db_file_name_convert= '/u02/oradata/orcl/', '/u03/oradata/orcl/'
-Note: ORCL_ST,ORCL_PD is configured in the TNSNames file
Start the database with the '/u01/initorcl.ora ' pfile and generate the SPFile.
sql> shutdown Immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
sql> startup pfile= '/u01/initorcl.ora ';
ORACLE instance started.
Total System Global area 167772160 bytes
Fixed Size 1218316 bytes
Variable Size 79694068 bytes
Database buffers 83886080 bytes
Redo buffers 2973696 bytes
Database mounted.
Database opened.
Sql> create SPFile from pfile= '/u01/initorcl.ora ';
File created.
Second, Standby end configuration
1. Create a standby inventory data file and background tracking directory, this directory can be the same as the main library, if different, you need to be in the main library initialization file conversion.
Such as:
*.log_file_name_convert= '/u02/oradata/orcl/', '/u03/oradata/orcl/'