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/issue
Enterprise Linux Server release 5.5 (Carthage)
Kernel \ r on an \ m

[Oracle @ linux3 ~] $ Sqlplus-v

SQL * Plus: Release 11.2.0.1.0 Production

-- Master database: sybo3
-- Slave Database: sybo5
-- Configure physical standby to use the best performance mode

A. Preparations for the master database
-- View the archive mode of the master database. If the archive mode is not used, switch to archive mode first.
-- For how to switch to archive mode, refer to: Oracle archive log http://blog.csdn.net/robinson_0612/article/details/5784713
Sys @ SYBO3> select name, log_mode from v $ database;

NAME LOG_MODE
---------------------
SYBO3 ARCHIVELOG

-- Prepare the pfile file for the standby Database
Sys @ SYBO3> create pfile =/u01/oracle/db_1/dbs/initsybo5.ora from spfile;

-- Make the master database in forced log Mode
Sys @ SYBO3> alter database force logging;

Sys @ SYBO3> select database_role from v $ database;

DATABASE_ROLE
----------------
PRIMARY

-- Add standby redo log to the master database to 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 master database to the standby logfile in order.
-- Creating standby logfile in the master database facilitates role conversion and backup
-- Sandby redo log Creation Principles:
-- 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 COUNT = Total number of log groups in the master database + 1
-- C) If the master database is a RAC Database: Number of standby redo log groups = (number of log groups per Thread + 1) * Maximum number of threads
-- D). It is not recommended that standby redo logs be reused to avoid additional I/O addition and delay of redo transmission.

Sys @ SYBO3> 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 @ SYBO3> alter database add standby logfile ('/u01/database/sybo3/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 role
Alter 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 = (ONLINE_LOGFILES, PRIMARY_ROLE )';
Alter system set log_archive_dest_state_1 = enable;
Alter system set log_archive_dest_state_2 = enable;
Alter system set log_archive_max_processes = 4;
Alter system set remote_login_passwordfile = 'clusive 'scope = spfile;

-- Add below item when DB turn to standby role
Alter 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_sybo
Sys @ SYBO3> shutdown immediate;


C. Configure the Master/Slave Database Listener
-- Configure listening for the master database and slave database. The redo transmission service of the entire DG depends on Oracle Net. Therefore, you need to configure listening for the master and slave databases.
-- The configuration methods are diverse. You can use netmgr and netca, and directly edit the listener. ora and tnsnames. ora files.
-- The following is the content of the configured listener. ora and tnsnames. ora files.
[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 = sybo5.orasrv.com)
(ORACLE_HOME =/u01/oracle/db_1)
(SID_NAME = sybo5)
)
)

SID_LIST_LISTENER_SYBO3 =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = sybo3.orasrv.com)
(ORACLE_HOME =/u01/oracle/db_1)
(SID_NAME = sybo3)
)
)

LISTENER_SYBO5 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = linux3.orasrv.com) (PORT = 1532 ))
)

ADR_BASE_LISTENER_SYBO5 =/u01/oracle

LISTENER_SYBO3 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = linux3.orasrv.com) (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 = 192.168.7.25) (PORT = 1532 ))
)
(CONNECT_DATA =
(SERVICE_NAME = SYBO5.ORASRV. COM)
)
)

SYBO3 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.7.25) (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 sybo5


D. Create a directory for the standby Database
-- Create a folder for the standby Database
[Oracle @ linux3 database] $ more sybo5.sh
#! /Bin/sh

Mkdir-p/u01/database
Mkdir-p/u01/database/sybo5/adump
Mkdir-p/u01/database/sybo5/controlf
Mkdir-p/u01/database/sybo5/fra
Mkdir-p/u01/database/sybo5/oradata
Mkdir-p/u01/database/sybo5/redo
Mkdir-p/u01/database/sybo5/dpdump
Mkdir-p/u01/database/sybo5/pfile
Mkdir-p/u01/database/sybo5/arch
[Oracle @ linux3 database] $./sybo5.sh

  • 1
  • 2
  • Next Page

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.