Configure Oracle 11g Data guard based on the same host

Source: Internet
Author: User

Oracle Data Guard provides the most effective and comprehensive data availability, data protection, and disaster recovery solutions for enterprise databases. It integrates management, monitoring, and automated software infrastructure to create and maintain one or more synchronous backup databases, protecting data from faults, disasters, errors, and damages. This article describes how to configure Oracle Data guard on the same host.

For more information about DG, see Oracle Data guard concepts and administration.

For details about the parameters for configuring DG, refer to important configuration parameters of Oracle Data guard.


1. General process for creating DG
A. Enable archiving and forced log mode for the master database
B. Configure the redo Transmission Service (related parameter configuration) for the master database)
C. master database and slave Database Configuration listening
D. Create a directory for the standby Database
E. Configure the backup database password file and parameter file
F. Copy data files, log files, and backup control files to the slave database.
G. Start the slave database and verify the result.


2. Demonstration of creating a physical standby Database

-- Demo Environment [Oracle @ linux3 ~] $ CAT/etc/issueenterprise Linux Enterprise Linux Server Release 5.5 (Carthage) kernel \ r on an \ m [Oracle @ linux3 ~] $ Sqlplus-vsql * Plus: Release production -- master database: sybo3 -- slave Database: sybo5 -- configure physical standby, use the best performance mode A, master database preparation-view the archive mode of the master database, switch to archive mode if not archive mode-for how to switch to archive mode, see Oracle archive log> select name, log_mode from V $ database; name log_mode --------- ------------ sybo3 archivelog -- prepare the pfile file SYS @ sybo3> Create pfile =/u01/Oracle/db_1/dbs/initsybo5.ora from SPFI for the standby Database Le; -- make the master database in forced log mode sys @ Sybo> alter database force logging; sys @ Sybo> select database_role from V $ database; DATABASE_ROLE----------------PRIMARY -- add standby redo log to the master database, briefly describe the role of standby redo log-in fact, it corresponds to the redo log received by the master database, that is to say, the Standby database calls the RFS process to write the redo logs received from the primary database to the standby logfile in order. The standby logfile created in the primary database facilitates role conversion and then the backup -- sandby redo log creation principle: -- a) ensure that the standby redo log size is consistent with the online redo log size of the master database. -- B) If the master database is a single-instance Database: standby redo log group = master database Total number of log groups + 1 -- C). If the master database is RAC Database: Number of standby redo log groups = (number of log groups per Thread + 1) * Maximum number of threads -- d) standby redo log is not recommended to be reused, avoid adding additional I/O and delaying redo transfer sys @ Sybo> alter database add standby logfile ('/u01/database/sybo3/Redo/standby_redo01.log') size 50 m; sys @ sybo3> alter database add standby logfile ('/u01/database/sybo3/Redo/standby_redo02.log') size 50 m; sys @ sybo3> alter database add standby logfile ('/u01/database/sybo3/Redo/standby_redo03. Log ') size 50 m; sys @ Sybo> alter database add standby logfile ('/u01/database/Sybo/Redo/standby_redo04.log ') size 50 m; b. Modify the parameter file of the master database-use the following command to modify the parameters of the master database (in this case, the master database should use the spfile startup parameter) [Oracle @ linux3 ~] $ More ch_sp_sybo3. SQL -- add below item when dB acts as primary rolealter system set db_unique_name = 'sybo3' scope = spfile; Alter system set log_archive_config = 'dg _ Config = (sybo3, sybo5) '; Alter system set log_archive_dest_1 = 'location =/u01/database/sybo3/arch db_unique_name = sybo3 valid_for = (all_logfiles, all_roles )'; alter system set log_archive_dest_2 = 'service = sybo5 async db_unique_name = sybo5 valid_for = (o Nline_logfiles, primary_role) '; Alter system set hosts = Enable; Alter system set log_archive_max_processes = 4; Alter system set remote_login_passwordfile = 'exclusive' scope = spfile; -- add below item when dB turn to standby rolealter system set db_file_name_convert = 'sybo5', 'sybo3' scope = spfile; Alter system set log_file_name_convert = 'sybo5 ', 'Sybo3' scope = spfile; Alter system set standby_file_management = 'auto'; Alter system set fal_server = 'sybo5'; Alter system set fal_client = 'sybo3 '; sys @ Sybo> @ ch_sp_sybo3sys @ Sybo> shutdown immediate; C. Configure the Master/Slave Database Listener. Configure the listener for the master and slave databases. The redo transmission service for the entire DG, it depends on Oracle Net. Therefore, you need to configure the listener for the master and slave databases. There are many configuration methods available, including netmgr, netca, and listener editing. ora and tnsnames. ora file -- The following is the configured listener. ora and tnsnames. ora file content [Oracle @ linux3 ~] $ More/u01/Oracle/db_1/Network/admin/listener. ora # listener. ora network configuration file:/u01/Oracle/db_1/Network/admin/listener. ora # generated by Oracle configuration tools. sid_list_listener_sybo5 = (sid_list = (sid_desc = (global_dbname = (ORACLE_HOME =/u01/Oracle/db_1) (sid_name = sybo5 ))) sid_list_listener_sybo3 = (sid_list = (sid_desc = (global_dbname = sybo3.orasrv. CO M) (ORACLE_HOME =/u01/Oracle/db_1) (sid_name = sybo3) listener_sybo5 = (description = (address = (Protocol = TCP) (host = (Port = 1532) adr_base_listener_sybo5 =/u01/oraclelistener_sybo3 = (description = (address = (Protocol = TCP) (host = (Port = 1531 ))) adr_base_listener_sybo3 =/u01/Oracle [Oracle @ linux3 ~] $ More/u01/Oracle/db_1/Network/admin/tnsnames. ora # tnsnames. ora network configuration file:/u01/Oracle/db_1/Network/admin/tnsnames. ora # generated by Oracle configuration tools. sybo5 = (description = (address_list = (address = (Protocol = TCP) (host = (Port = 1532) (CONNECT_DATA = (SERVICE_NAME = sybo5.orasrv. com) sybo3 = (description = (address_list = (address = (Protocol = TCP) (Host = (Port = 1531) (CONNECT_DATA = (SERVICE_NAME = sybo3.orasrv. com) -- start the listener and test [Oracle @ linux3 ~] $ LSNRCTL start listener_sybo3 [Oracle @ linux3 ~] $ LSNRCTL start listener_sybo5 [Oracle @ linux3 ~] $ Tnsping sybo3 [Oracle @ linux3 ~] $ Tnsping sybo5d: create a directory for the standby database -- create a folder for the standby database [Oracle @ linux3 database] $ more #! /Bin/shmkdir-P/u01/databasemkdir-P/u01/database/sybo5/adumpmkdir-P/u01/database/sybo5/controlfmkdir-P/u01/database/sybo5/framkdir -P/u01/database/sybo5/oradatamkdir-P/u01/database/sybo5/redomkdir-P/u01/database/sybo5/dpdumpmkdir-P/u01/database/sybo5/pfilemkdir -P/u01/database/sybo5/arch [Oracle @ linux3 database] $. / E. Configure the password file and parameter file of the slave database. Because the same password is required for the master database and the slave Database SYS, we copied the password file of the master database directly to the slave database [or ACLE @ linux3 ~] $ CP $ ORACLE_HOME/dbs/orapwsybo3 $ ORACLE_HOME/dbs/orapwsybo5 [Oracle @ linux3 ~] $ Sed-I's/sybo3/sybo5/G' $ ORACLE_HOME/dbs/initsybo5.ora --- Note that the db_name settings still use the original sybo3, that is, change back to db_name = 'symp3 ', the same db_name should be set for the same DG -- The following is the configured backup database parameter file, which only lists the modified parts. If the original pfile file contains the same entries, you can comment on it or delete [Oracle @ linux3 ~]. $ Tail-20 $ ORACLE_HOME/dbs/initsybo5.oradb _ unique_name = sybo5log_archive_config = 'dg _ Config = (sybo3, sybo5) 'Log _ archive_dest_1 = 'location =/u01/database/sybo5/arch db_unique_name = sybo5 valid_for = (all_logfiles, all_roles) 'Log _ archive_dest_2 = 'service = sybo3 async db_unique_name = sybo3 valid_for = = 'Sybo5', 'sybo5' log _ file_name_convert = 'sybo5 ', 'sybo5' standby _ file_management = 'auto' FAL _ Server = 'sybo3' FAL _ client = 'sybo5' log _ archive_max_processes = 4remote_login_passwordfile = 'exclusive 'F. Copy data files, log Files, backup control files to the standby database-there are multiple methods for cloning standby from the primary database, and Oracle 11g supports directly cloning databases from the ative database-because on the same host, therefore, this operation directly copies data and log files to the backup database directory in the cold standby mode [Oracle @ linux3 ~] $ CP/u01/database/sybo3/oradata/*/u01/database/sybo5/oradata/[Oracle @ linux3 ~] $ CP/u01/database/sybo3/Redo/*/u01/database/sybo5/Redo/-- start the master database to the Mount state sys @ Sybo> startup Mount; -- generate a control file for the master database. Note that for standby configuration, you cannot directly copy the control file to the standby Database SYS @ Sybo> alter database create standby controlfile as '/u01/database/sybo5/controlf/control01.ctl' using the copy method '; sys @ Sybo> Ho CP/u01/database/sybo5/controlf/control01.ctl/u01/database/sybo5/controlf/control02.ctl -- Author: Robinson Cheng -- Blog: T/robinson_0612 -- open the master Database SYS @ sybo3> alter database open; G. Start the slave database to the Mount state and check the result [Oracle @ linux3 ~] $ Export oracle_sid = sybo5 [Oracle @ linux3 ~] $ Sqlplus/As sysdbasys @ sybo5> startup Mount pfile =/u01/Oracle/db_1/dbs/initsybo5.ora -- generate the spfile file SYS @ sybo5> Create spfile from pfile for the standby database; sys @ sybo5> show parameter instance_namename type value =----------- specified instance_name string sybo5sys @ sybo5> select name, open_mode, database_role, protection_mode from V $ database; name open_mode database_role protection_mode -------------------- Sybo mounted physical standby maximum performance -- switch logs on the master database. sys @ Sybo> alter system switch logfile; -- start redo applysys @ sybo5> alter database recover managed standby database disconnect from session; -- view the log apply result sys @ sybo5> select sequence #, first_time, next_time, applied from V $ archived_log order by sequence #; sequence # first_tim next_time applied ---------- ----------- 113 12-aug-13 12-aug-13 Yes 114 12-aug-13 Yes 115 12-aug-13 Yes 12-aug-13 then yes 116 then yes 117 then yes -- view the master Database SYS @ Sybo> select * (2 select sequence #, first_time, next_time, applied from V $ archived_log order by sequence # DESC) 3 where rownum <5; sequence # first_tim next_time applied ---------- ----------- --------- 117 12-aug-13 13-aug-13 Yes 116 12-aug-13 12-aug-13 12-aug-13 Yes 115 12-aug-13 12-aug-13 Yes 114 12-aug-13 12-aug-13 Yes


More references

For more information about Oracle RAC, see
Use crs_setperm to modify the resource owner and permissions of RAC.
Use crs_profile to manage RAC resource configuration files
RAC database startup and Shutdown
Oracle RAC services
Services in Oracle Database 10g
Migrate datbase from single instance to Oracle RAC
Connect Oracle RAC to a specified instance
Oracle RAC load balancing test (combined with server and client)
Oracle RAC server connection Load Balance)
Load Balance)
Non-Default port listening configuration in Oracle RAC (listener. ora tnsnames. ora)
Oracle RAC Listener Configuration (listener. ora tnsnames. ora)
Configure RAC load balancing and Failover
CRS-1006, CRS-0215 fault case
Installing Oracle 10g RAC Based on Linux (RHEL 5.5)
Use runcluvfy to verify the Oracle RAC installation environment

For more information about the basics and concepts of Oracle network configuration, see:
Configure dynamic service registration for non-default ports
Configure sqlnet. ora to restrict IP Access to Oracle
Configure and manage Oracle listener logs
Set the Oracle listener password (listener)
Configure the Oracle client to connect to the database

For more information about user-managed backup and recovery, see
Oracle cold backup
Oracle Hot Backup
Concept of Oracle backup recovery
Oracle instance recovery
Oracle recovery based on user management
System tablespace management and Backup Recovery
Sysaux tablespace management and recovery
Oracle backup control file recovery (unsing backup controlfile)

For information on RMAN backup recovery and management, see
RMAN overview and architecture
RMAN configuration, Monitoring and Management
Detailed description of RMAN backup
RMAN restoration and recovery
Create and use RMAN catalog
Create RMAN storage script based on catalog
Catalog-based RMAN backup and recovery
RMAN backup path confusion
Use RMAN for recovery from different machine backups (WIN platform)
Use RMAN to migrate a file system database to ASM
Linux RMAN backup shell script
Use RMAN to migrate the database to a different machine

For the Oracle architecture, see
Oracle tablespace and data files
Oracle Password File
Oracle parameter file
Oracle online redo log file)
Oracle Control File)
Oracle archiving logs
Oracle rollback and undo)
Oracle database instance startup and Shutdown Process
Automated Management of Oracle 10g SGA
Oracle instances and Oracle databases (Oracle Architecture)

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: 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.