PURPOSE
-------
This document has been created with step-by-step instructions on how
to create a Data Guard Physical Standby environment, derived from the
10G documentation. Although, this setup was tested with Linux, the
procedure would be the same for any flavor of Unix.
Note: For 10gr2 please refer:
Note 343424.1 Creating a 10gr2 Data Guard Physical Standby database with
Real-Time apply
Creating a Physical Data Guard scenario in 10G on Linux.
==========================================================
1. Primary host : stdg2
Standby host : stdg1
Platform : Linux Redhat AS 2.1
Kernel : 2.4.9-e.24
Primary Set up on host stdg2
ORACLE_SID=v10g
Initialization parameters (PRIMARY)
==========================
*.control_files='/u02/admin/v10g/datafiles/control01.ctl'
*.log_archive_config='DG_CONFIG=(v10g_stdg2,v10g_stdg1)'
*.log_archive_dest_1='LOCATION=/u02/admin/v10g/v10garch/
VALID_FOR=(ALL_LOGFILES,ALL_ROLES)
*.db_unique_name=v10g_stdg2'
*.log_archive_dest_2='SERVICE=v10g_stdg1
VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)
DB_UNIQUE_NAME=v10g_stdg1 LGWR ASYNC REOPEN=10'
*.log_archive_dest_state_1='enable'
*.log_archive_dest_state_2='enable'
*.db_unique_name='v10g_stdg2'
*.FAL_CLIENT='v10g_stdg2'
*.FAL_SERVER='v10g_stdg1'
*.standby_archive_dest='/u02/admin/v10g/v10garch'
*.standby_file_management='auto'
*.remote_login_passwordfile='EXCLUSIVE'
2. Place the primary datbase in ARCHIVELOG mode.
SQL>SHUTDOWN IMMEDIATE
SQL>STARTUP MOUNT
SQL>ALTER DATABASE ARCHIVELOG;
SQL>ALTER DATABASE OPEN;
SQL>ARCHIVE LOG LIST;
3. Creating the physical standby.
- Take a backup of the primary. (Cold backup was used)
- SQL>STARTUP MOUNT (Primary)
- SQL>ALTER DATABASE CREATE STANDBY CONTROLFILE
AS ‘/STDBY.CTL’;
- SQL>ALTER DATABASE OPEN;
- Create a pfile for the standby database
- SQL>CREATE PFILE=’/INITSTDBY.ORA’ FROM SPFILE;
Initialization parameter(STANDBY)
==================================
*.control_files='/u02/admin/v10g/datafiles/standby.ctl'
*.log_archive_config='DG_CONFIG=(v10g_stdg2,v10g_stdg1)'
*.log_archive_dest_1='LOCATION=/u02/admin/v10g/v10garch/
VALID_FOR=(ALL_LOGFILES,ALL_ROLES)
*.db_unique_name=v10g_stdg1'
*.log_archive_dest_2='SERVICE=v10g_stdg2
VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)
DB_UNIQUE_NAME=v10g_stdg2 LGWR ASYNC REOPEN=10'
*.log_archive_dest_state_1='enable'
*.log_archive_dest_state_2='enable'
*.db_unique_name='v10g_stdg1'
*.FAL_CLIENT='v10g_stdg1'
*.FAL_SERVER='v10g_stdg2'
*.standby_archive_dest='/u02/admin/v10g/v10garch'
*.standby_file_management='auto'
*.remote_login_passwordfile='EXCLUSIVE'
NOTE - Since the file structure is the same on both the nodes I have not specifed the file name convert strings.
If the file structure is different then we will need to specify the additional two parameters :
DB_FILE_NAME_CONVERT - Converts the path names of the primary database data files to the standby data file path names
LOG_FILE_NAME_CONVERT - Converts the path names of the primary database log files to the path names on the standby database
Example :
string1 is the pattern of the primary database filename /u01/prim/
string2 is the pattern of the standby database filename /u01/stdby/
string3 is the pattern of the primary database filename /u02/prim/
string4 is the pattern of the standby database filename /u02/stdby/
DB_FILE_NAME_CONVERT = 'string1' , 'string2' , 'string3' , 'string4' , ...
= ‘/u01/prim/’,’/u01/stdby, ‘/u02/prim/’,’/u02/stdby’
LOG_FILE_NAME_CONVERT = 'string1' , 'string2' , 'string3' , 'string4' , ...
= ‘/u01/prim/’,’/u01/stdby, ‘/u02/prim/’,’/u02/stdby’
Set up the listeners (Net Services)
Primary:
LISTENER.ORA
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 138.1.137.235)(PORT = 1521))
)
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/oracle/product/10g)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = v10g)
(ORACLE_HOME = /u01/oracle/product/10g)
(SID_NAME = v10g)
)
)
TNSNAMES.ORA:
v10g_stdg1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 138.1.137.234)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = v10g)
)
)
v10g_stdg2 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 138.1.137.235)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = v10g)
)
NOTE: For the standby make sure you change the ip (HOST) from .234 to .235 appropriately
4. Create the spfile on the standby from the pfile moved from the primary.
SQL>CREATE SPFILE=’?/DBS/spfile.ora
FROM PFILE=’INITSTDBY.ORA’;
SQL>STARTUP MOUNT;
SQL>ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT;
5. Check to see if the redo from the primary is being shipped to the standby
On the primary do the following:
- SQL>ALTER SYSTEM SWITCH LOGFILE;
- SQl>SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME
FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;
SEQUENCE# FIRST_TIM NEXT_TIME
---------- --------- ---------
71 15-AUG-03 15-AUG-03
72 15-AUG-03 15-AUG-03
73 15-AUG-03 15-AUG-03
74 15-AUG-03 15-AUG-03
Physical Standby:
SQL>SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME
FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;
SEQUENCE# FIRST_TIM NEXT_TIME
---------- --------- ---------
71 15-AUG-03 15-AUG-03
72 15-AUG-03 15-AUG-03
73 15-AUG-03 15-AUG-03
74 15-AUG-03 15-AUG-03
6. Verify if the archived logs are applied successfully on the standby
SQL>SELECT SEQUENCE#,APPLIED FROM
V$ARCHIVED_LOG ORDER BY SEQUENCE#;
SEQUENCE# APP
---------- ---
68 YES
69 YES
70 YES
71 YES
72 YES
73 YES
74 YES
Standby Redo Logs (SRLs)=========================
This is similar to redo logs except that a standby log is used only when the database is in standby mode.
NOTE: The ARCHIVER (ARCn) or the (LGWR) process on the primary can transmit redo data directly to standby logfile.
(The details of SRL's is not discussed in this document)
To create a standby logfile:
- Stop the redo apply on the standby
Alter database recover managed standby database cancel;
- Create the SRL’s 3 of them on the standby.
SQL>alter database add standby logfile
'/u02/admin/v10g/srldest/srl_1.log' size 10m;
- Restart the redo apply;
RELATED DOCUMENTS
-----------------
Oracle Data Guard Concepts and Administration.
Dataguard dataguard physical
dataguard dataguard physical
dataguard ph[@more@]
-------
This document has been created with step-by-step instructions on how
to create a Data Guard Physical Standby environment, derived from the
10G documentation. Although, this setup was tested with Linux, the
procedure would be the same for any flavor of Unix.
Note: For 10gr2 please refer:
Note 343424.1 Creating a 10gr2 Data Guard Physical Standby database with
Real-Time apply
Creating a Physical Data Guard scenario in 10G on Linux.
==========================================================
1. Primary host : stdg2
Standby host : stdg1
Platform : Linux Redhat AS 2.1
Kernel : 2.4.9-e.24
Primary Set up on host stdg2
ORACLE_SID=v10g
Initialization parameters (PRIMARY)
==========================
*.control_files='/u02/admin/v10g/datafiles/control01.ctl'
*.log_archive_config='DG_CONFIG=(v10g_stdg2,v10g_stdg1)'
*.log_archive_dest_1='LOCATION=/u02/admin/v10g/v10garch/
VALID_FOR=(ALL_LOGFILES,ALL_ROLES)
*.db_unique_name=v10g_stdg2'
*.log_archive_dest_2='SERVICE=v10g_stdg1
VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)
DB_UNIQUE_NAME=v10g_stdg1 LGWR ASYNC REOPEN=10'
*.log_archive_dest_state_1='enable'
*.log_archive_dest_state_2='enable'
*.db_unique_name='v10g_stdg2'
*.FAL_CLIENT='v10g_stdg2'
*.FAL_SERVER='v10g_stdg1'
*.standby_archive_dest='/u02/admin/v10g/v10garch'
*.standby_file_management='auto'
*.remote_login_passwordfile='EXCLUSIVE'
2. Place the primary datbase in ARCHIVELOG mode.
SQL>SHUTDOWN IMMEDIATE
SQL>STARTUP MOUNT
SQL>ALTER DATABASE ARCHIVELOG;
SQL>ALTER DATABASE OPEN;
SQL>ARCHIVE LOG LIST;
3. Creating the physical standby.
- Take a backup of the primary. (Cold backup was used)
- SQL>STARTUP MOUNT (Primary)
- SQL>ALTER DATABASE CREATE STANDBY CONTROLFILE
AS ‘/STDBY.CTL’;
- SQL>ALTER DATABASE OPEN;
- Create a pfile for the standby database
- SQL>CREATE PFILE=’/INITSTDBY.ORA’ FROM SPFILE;
Initialization parameter(STANDBY)
==================================
*.control_files='/u02/admin/v10g/datafiles/standby.ctl'
*.log_archive_config='DG_CONFIG=(v10g_stdg2,v10g_stdg1)'
*.log_archive_dest_1='LOCATION=/u02/admin/v10g/v10garch/
VALID_FOR=(ALL_LOGFILES,ALL_ROLES)
*.db_unique_name=v10g_stdg1'
*.log_archive_dest_2='SERVICE=v10g_stdg2
VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)
DB_UNIQUE_NAME=v10g_stdg2 LGWR ASYNC REOPEN=10'
*.log_archive_dest_state_1='enable'
*.log_archive_dest_state_2='enable'
*.db_unique_name='v10g_stdg1'
*.FAL_CLIENT='v10g_stdg1'
*.FAL_SERVER='v10g_stdg2'
*.standby_archive_dest='/u02/admin/v10g/v10garch'
*.standby_file_management='auto'
*.remote_login_passwordfile='EXCLUSIVE'
NOTE - Since the file structure is the same on both the nodes I have not specifed the file name convert strings.
If the file structure is different then we will need to specify the additional two parameters :
DB_FILE_NAME_CONVERT - Converts the path names of the primary database data files to the standby data file path names
LOG_FILE_NAME_CONVERT - Converts the path names of the primary database log files to the path names on the standby database
Example :
string1 is the pattern of the primary database filename /u01/prim/
string2 is the pattern of the standby database filename /u01/stdby/
string3 is the pattern of the primary database filename /u02/prim/
string4 is the pattern of the standby database filename /u02/stdby/
DB_FILE_NAME_CONVERT = 'string1' , 'string2' , 'string3' , 'string4' , ...
= ‘/u01/prim/’,’/u01/stdby, ‘/u02/prim/’,’/u02/stdby’
LOG_FILE_NAME_CONVERT = 'string1' , 'string2' , 'string3' , 'string4' , ...
= ‘/u01/prim/’,’/u01/stdby, ‘/u02/prim/’,’/u02/stdby’
Set up the listeners (Net Services)
Primary:
LISTENER.ORA
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 138.1.137.235)(PORT = 1521))
)
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/oracle/product/10g)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = v10g)
(ORACLE_HOME = /u01/oracle/product/10g)
(SID_NAME = v10g)
)
)
TNSNAMES.ORA:
v10g_stdg1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 138.1.137.234)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = v10g)
)
)
v10g_stdg2 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 138.1.137.235)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = v10g)
)
NOTE: For the standby make sure you change the ip (HOST) from .234 to .235 appropriately
4. Create the spfile on the standby from the pfile moved from the primary.
SQL>CREATE SPFILE=’?/DBS/spfile.ora
FROM PFILE=’INITSTDBY.ORA’;
SQL>STARTUP MOUNT;
SQL>ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT;
5. Check to see if the redo from the primary is being shipped to the standby
On the primary do the following:
- SQL>ALTER SYSTEM SWITCH LOGFILE;
- SQl>SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME
FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;
SEQUENCE# FIRST_TIM NEXT_TIME
---------- --------- ---------
71 15-AUG-03 15-AUG-03
72 15-AUG-03 15-AUG-03
73 15-AUG-03 15-AUG-03
74 15-AUG-03 15-AUG-03
Physical Standby:
SQL>SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME
FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;
SEQUENCE# FIRST_TIM NEXT_TIME
---------- --------- ---------
71 15-AUG-03 15-AUG-03
72 15-AUG-03 15-AUG-03
73 15-AUG-03 15-AUG-03
74 15-AUG-03 15-AUG-03
6. Verify if the archived logs are applied successfully on the standby
SQL>SELECT SEQUENCE#,APPLIED FROM
V$ARCHIVED_LOG ORDER BY SEQUENCE#;
SEQUENCE# APP
---------- ---
68 YES
69 YES
70 YES
71 YES
72 YES
73 YES
74 YES
Standby Redo Logs (SRLs)=========================
This is similar to redo logs except that a standby log is used only when the database is in standby mode.
NOTE: The ARCHIVER (ARCn) or the (LGWR) process on the primary can transmit redo data directly to standby logfile.
(The details of SRL's is not discussed in this document)
To create a standby logfile:
- Stop the redo apply on the standby
Alter database recover managed standby database cancel;
- Create the SRL’s 3 of them on the standby.
SQL>alter database add standby logfile
'/u02/admin/v10g/srldest/srl_1.log' size 10m;
- Restart the redo apply;
RELATED DOCUMENTS
-----------------
Oracle Data Guard Concepts and Administration.
Dataguard dataguard physical
dataguard dataguard physical
dataguard ph[@more@]
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9225895/viewspace-1030569/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/9225895/viewspace-1030569/