Oracle 11g slave uard Duplicate physical standby database configuration (1) physical standby database creation Configuration
# Ver: 1.5 fifth Modification
# Modify: 2013.8.16
# Author: koumm
Read more: Configure Oracle 11g replicuard test and create a Physical Standby Database)
Oracle 11g slave uard physical standby Database Configuration and Active slave uard Test
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.
Configure Oracle 11g Data Guard based on the same host
Note:
This article installs and configures Oracle 11g replicuard to create a physical standby database through duplicate.
Compared with the previous configuration, the following differences exist:
1. the directory structure of the master and slave databases is different.
2. Use duplicate to create a physical standby database.
I. Environment Introduction
1. primary database environment
Operating system version: OEL5.8 x64
Database Version: Oracle 11.2.0.3 x64
Database Name: orcl
Database SID: orcl
Db_unique_name: orcl
Instance_name: orcl
DGMGRL: orcl_DGMGRL
2. Standby database environment
Operating system version: OEL5.8 x64
Database Version: Oracle 11.2.0.3 x64 (only oracle database software is installed, no netca dbca)
Database Name: slave
Database SID: slave
Db_unique_name: slave
Instance_name: slave
DGMGRL: slave_DGMGRL
3. Sequence uard startup sequence
Startup sequence: Start the slave database first and then start the master database
Close sequence: first shut down the master database, then shut down the slave Database
2. Preparations for the primary database environment
1. master database environment comparison
Make full use of the original environment of the primary database, and do not make too many modifications to the parameter configuration of the primary database.
Recreate the password file
# Su-oracle
$ Orapwd file = '/u01/app/oracle/product/11.2.0/db_1/dbs/orapworcl' password = oracle entries = 10 force = y
2. Modify the lisener listening File
Note: add the dgmgrl static listening configuration to lay the foundation for the subsequent dg broker configuration.
$ Cat/u01/app/oracle/product/11.2.0/db_1/network/admin/listener. ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.233.200) (PORT = 1521 ))
(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521 ))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME =/u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = orcl)
)
(SID_DESC =
(GLOBAL_DBNAME = orcl_DGMGRL)
(ORACLE_HOME =/u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = orcl)
)
)
ADR_BASE_LISTENER =/u01/app/oracle
# GLOBAL_DBNAME has a fixed format: <db_unique_name> _ DGMGRL. <db_domain>.
4. Modify the tnsname. ora File
Note: ORCL is the service name of the master database and DG is the service name of the slave database.
$ Vi/u01/app/oracle/product/11.2.0/db_1/network/admin/tnsnames. ora
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.233.200) (PORT = 1521 ))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
SLAVE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.233.150) (PORT = 1521 ))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = slave)
)
)
5. modify the configuration to the rule file mode.
1) check whether the database is archived
SQL> archive log list;
SQL> shutdown immediate;
SQL> startup mount;
SQL> alter database archivelog;
SQL> alter database flashback on;
SQL> alter database open;
2) set the master database to force logging mode.
SQL> alter database force logging;
SQL> select force_logging, flashback_on from v $ database;
FOR FLASHBACK_ON
---------------------
YES
6. Modify the parameter file of the master database
SQL>
Alter system set instance_name = 'orcl 'scope = spfile;
Alter system set db_unique_name = 'orcl 'scope = spfile;
Alter system set local_listener = 'orcl 'scope = spfile;
Alter system set log_archive_config = 'dg _ CONFIG = (orcl, slave )';
Alter system set log_archive_dest_1 = 'location =/u01/archivelog/valid_for = (all_logfiles, all_roles) db_unique_name = orcl 'scope = spfile;
Alter system set log_archive_dest_2 = 'service = slave lgwr async valid_for = (online_logfiles, primary_role) db_unique_name = slave 'scope = spfile;
Alter system set log_archive_format = 'arch _ % r _ % t _ % s. arc' scope = spfile;
Alter system set fal_client = 'orcl 'scope = spfile;
Alter system set fal_server = 'slave 'scope = spfile;
Alter system set standby_file_management = AUTO;
Alter database add standby logfile group 4'/u01/app/oracle/oradata/orcl/standby_redo04.log 'size 50 M;
Alter database add standby logfile group 5'/u01/app/oracle/oradata/orcl/standby_redo05.log 'size 50 M;
Alter database add standby logfile group 6'/u01/app/oracle/oradata/orcl/standby_redo06.log 'size 50 M;
Alter database add standby logfile group 7'/u01/app/oracle/oradata/orcl/standby_redo07.log 'size 50 M;
SQL> shutdown immediate;
SQL> startup;
Iii. Slave Database Configuration
1. Standby database environment
Operating system version: OEL5.8 x64
Database Version: Oracle 11.2.0.3 x64 (only oracle database software is installed, no netca dbca)
Database Name: slave
Database SID: slave
Db_unique_name: slave
Instance_name: slave
DGMGRL: slave_DGMGRL
2. Modify the lisener listening File
$ Vi/u01/app/oracle/product/11.2.0/db_1/network/admin/listener. ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.233.150) (PORT = 1521 ))
(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521 ))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = slave)
(ORACLE_HOME =/u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = slave)
)
(SID_DESC =
(GLOBAL_DBNAME = slave_DGMGRL)
(ORACLE_HOME =/u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = slave)
)
)
ADR_BASE_LISTENER =/u01/app/oracle
GLOBAL_DBNAME has a fixed format: <db_unique_name> _ DGMGRL. <db_domain>.
3. Modify the tnsname. ora File
Note: ORCL is the service name of the master database and DG is the service name of the slave database.
$ Vi/u01/app/oracle/product/11.2.0/db_1/network/admin/tnsnames. ora
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.233.200) (PORT = 1521 ))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
SLAVE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.233.150) (PORT = 1521 ))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = slave)
)
)
Test Service name Connectivity:
Tnsping orcl
Tnsping slave
3. Create a basic directory for the 11g Database
# Su-oracle
Mkdir-p/u01/app/oracle/admin/slave/{adump, dpdump, pfile, scripts}
Mkdir-p/u01/app/oracle/oradata/slave
Mkdir-p/u01/app/oracle/fast_recovery_area/slave
Mkdir-p/u01/archivelog
4. Copy and rename the password file of the master database
Note: The 10g DG Environment only requires the same password, and the 11g DG Environment requires the same password as the master database.
Otherwise, no permission error is reported.
$ Cd/u01/app/oracle/product/11.2.0/db_1/dbs/
$ Scp oracle@192.168.233.150:/u01/app/oracle/product/11.2.0/db_1/dbs/orapworcl $ ORACLE_HOME/dbs/
$ Mv orapworcl orapwslave
Test Remote Logon
$ Sqlplus sys/oracle @ orcl as sysdba;
$ Sqlplus sys/oracle @ slave as sysdba;
5. boot to nomount status
$ Echo 'db _ name = slave '> $ ORACLE_HOME/dbs/initslave. ora
$ Sqlplus/nolog
SQL> conn/as sysdba;
SQL> startup nomount;
4. Start at the RMAN duplicate Database
1. RMAN connects the master database and the slave Database
$ Rman target sys/oracle @ orcl auxiliary sys/oracle @ slave
Recovery MANAGER: Release 11.2.0.3.0-Production on Friday Aug 17 21:14:10 2013
Copyright (c) 1982,201 1, Oracle and/or its affiliates. All rights reserved.
Connected to the target database: ORCL (DBID = 1351417842)
Connected to secondary Database: SLAVE (not loaded)
2. Start duplicate Database
RMAN>
Run {
Allocate channel c1 type disk;
Allocate channel c2 type disk;
Allocate auxiliary channel stby type disk;
Duplicate target database for standby nofilenamecheck from active database
Dorecover
Spfile
Parameter_value_convert 'orcl ', 'slave'
Set instance_name = 'slave'
Set db_unique_name = 'slave'
Set local_listener = 'slave'
Set db_file_name_convert = '/u01/app/oracle/oradata/orcl/', '/u01/app/oracle/oradata/slave /'
Set log_file_name_convert = '/u01/app/oracle/oradata/orcl/', '/u01/app/oracle/oradata/slave /'
Set control_files = '/u01/app/oracle/oradata/slave/control01.ctl', '/u01/app/oracle/oradata/slave/control02.ctl ', '/u01/app/oracle/oradata/slave/control03.ctl'
Set log_archive_dest_1 = 'location =/u01/archivelog/valid_for = (all_logfiles, all_roles) db_unique_name = slave'
Set log_archive_dest_2 = 'service = orcl lgwr async valid_for = (online_logfile, primary_role) db_unique_name = orcl'
Set log_archive_max_processes = '5'
Set standby_file_management = 'auto'
Set fal_client = 'slave'
Set fal_server = 'orcl ';
Release channel c1;
Release channel c2;
Release channel stby;
}
RMAN> quit
The recovery manager is complete.
3. view the standby database status
Note: After the duplicate database is created, the Standby database is only in the mount state to view the status of the standby database.
$ Sqlplus/as sysdba
# Viewing the standby database status
SQL> select open_mode, database_role, db_unique_name from v $ database;
OPEN_MODE DATABASE_ROLE DB_UNIQUE_NAME
------------------------------------------------------------------
Mounted physical standby slave
4. Set the standby database to the Application Log mode.
SQL> alter database recover managed standby database using current logfile disconnect from session;
Database altered.
5. Verify the log application of the physical standby Database
1) operations on the master database
SQL> conn/as sysdba;
SQL> create user abc identified by abc;
SQL> grant dba to abc;
SQL> conn abc/abc
SQL> create table abc (id integer, name char (10 ));
SQL> insert into abc values (0, 'aaa ');
SQL> commit;
SQL> conn/as sysdba;
SQL> archive log list;
Database Log mode archiving Mode
Enable automatic archiving
Archive end point/u01/archivelog/
Oldest online log sequence 8
Next archive log sequence 10
Current Log sequence 10
2) Verify on the slave Database
SQL> archive log list
Database Log mode archiving Mode
Enable automatic archiving
Archive end point/u01/archivelog/
Oldest online log sequence 9
Next archived log sequence 0
Current Log sequence 10
SQL> select sequence #, first_time, next_time, applied from v $ archived_log order by sequence #;
SEQUENCE # FIRST_TIME NEXT_TIME APPLIED
-----------------------------------------------
7 16-8 months-13 16-8 months-13 YES
8-16 months-13 16-8 months-13 YES
9 16-8 months-13 16-8 months-13 IN-MEMORY
After testing, the Oracle 11g slave uard physical standby database is successfully created.