Oracle, as the most popular commercial database, provides a series of HA solutions in addition to independent database DBMS, to meet actual O & M system requirements. Among them, RAC + Dataguard is our most common HA policy solution and is also widely recognized as a mature strategy.
Data Guard has been greatly developed in 11G. Two typical features are the introduction of Active Data Guard and Advanced Compression. During Redo Apply, the Physical Standby node of the traditional Data Guard cannot open the database to read Data. If you want to read data, you must terminate the Apply process before you can support Redo Apply. Active Data Guard supports Standby nodes and read-only databases while applying. This is why many enterprises have chosen DG as the technical means of read/write splitting policy after the 11G.
Advanced Compression is a comprehensive technology that also involves the AC process in Data Guard. A major bottleneck for Remote Disaster Recovery Using Data Guard is the transmission bandwidth limit. All Redo Log data must be transmitted through the connection between Primary and Standby. Excessive Redo logs limit the degree of disaster recovery data synchronization. Advanced Compression can compress the Redo Log to a certain extent to improve the synchronization rate.
This article describes how to use the new method of RMAN duplicate from active database in 11gR2. Note: from 10 Gb, there are other methods to build DG.
References:
Important configuration parameters of Oracle Data Guard
Configure Oracle 11g Data Guard based on the same host
Explore Oracle 11g elastic uard
Oracle Data Guard (RAC + DG) archive deletion policies and scripts
Role conversion for Oracle Data Guard
FAL gap in Oracle Data Guard logs
Oracle 11g Data Guard Error 16143 Heartbeat failed to connect to standby
1. Environment Introduction
We chose Red Hat 6.5 as the operating system, with sufficient disk space.
[Root @ SimpleLinux ~] # Cat/etc/RedHat-release
Red Hat Enterprise Linux Server release 6.5 (Santiago)
[Root @ SimpleLinux ~] # Uname-r
2.6.32-431. el6.i686
[Root @ SimpleLinux ~] # Df-h
Filesystem Size Used Avail Use % Mounted on
/Dev/sda2 48G 13G 33G 28%/
Tmpfs 947 M 0 947 M 0%/dev/shm
The current database name is ora11g. The environment variables are as follows:
[Oracle @ SimpleLinux ~] $ Env | grep ORA
ORACLE_SID = ora11g
ORACLE_BASE =/u01/app
ORACLE_HOME =/u01/app/oracle
Because it is an experimental environment, the author builds Data Guard on the same machine. The operations on different servers are the same. The database version is 11.2.0.4.
SQL> select * from v $ version;
BANNER
------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0-Production
PL/SQL Release 11.2.0.4.0-Production
CORE 11.2.0.4.0 Production
Three major database files: control files, log files (Online), and data files comply with the OMF (Oracle Managed File) policy.
SQL> select name from v $ controlfile;
NAME
---------------------------------------------
/U01/app/oradata/ORA11G/controlfile/o1_mf_9mn1_pko _. ctl
/U01/app/fast_recovery_area/ORA11G/controlfile/o1_mf_9mn1_pw2 _. ctl
SQL> select group #, member from v $ logfile;
GROUP # MEMBER
------------------------------------------------------------------------------
3/u01/app/oradata/ORA11G/onlinelog/o1_mf_3_9mnjx4n0 _. log
3/u01/app/fast_recovery_area/ORA11G/onlinelog/o1_mf_3_9mnjx54c _. log
2/u01/app/oradata/ORA11G/onlinelog/o1_mf_2_9mn1_zpq _. log
2/u01/app/fast_recovery_area/ORA11G/onlinelog/o1_mf_2_9mnjx15f _. log
1/u01/app/oradata/ORA11G/onlinelog/o1_mf_00009mnjwtj9 _. log
1/u01/app/fast_recovery_area/ORA11G/onlinelog/ow.mf_00009mn1_vdm _. log
6 rows selected
SQL> select file_name from dba_data_files;
FILE_NAME
-----------------------------------
/U01/app/oradata/ORA11G/datafile/o1_mf_users_9mnjs074 _. dbf
/U01/app/oradata/ORA11G/datafile/o1_mf_undotbs1_9mnjs068 _. dbf
/U01/app/oradata/ORA11G/datafile/o1_mf_sysaux_9mnjs04h _. dbf
/U01/app/oradata/ORA11G/datafile/o1_mf_system_9mnjrzty _. dbf
The current database is in non-archive mode.
SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 4
Current log sequence 6
Note: OMF is a file management policy recommended by Oracle. Traditional file management allows administrators to directly specify the file directory and name, while OMF does not need to specify the file. In addition, if the Recovery Area directory is configured, Oracle OMF will store the two large image files, online redo log and control file images in the Recovery Area.
Currently, Recovery Area support is configured.
SQL> show parameter recover
NAME TYPE VALUE
-----------------------------------------------------------------------------
Db_recovery_file_dest string/u01/app/fast_recovery_area
Db_recovery_file_dest_size large integer 10000 M
Db_unrecoverable_scn_tracking boolean TRUE
Recovery_parallelism integer 0
The objective of this experiment is to create an ora11g physical standby database with the instance name ora11gsy.
2. Database Primary Database configuration
Data Guard requires configuration on the Primary Database. The details are as follows:
Ü switch the archive mode. Data Guard runs on the basis of Redo Log transmission. The Primary Database requires the archive mode configuration;
Ü Force Logging configuration to ensure the integrity of Redo Log generation;
Ü Standby Log creation;
Ü master database parameter configuration;
Modify the archive mode and switch to the archive log mode. By default, if the recovery area is enabled, archived logs are stored in the recovery area.
SQL> alter database archivelog;
Database altered.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 4
Next log sequence to archive 6
Current log sequence 6
Force logging is applicable to some Oracle nologging operations. The Redo Log is responsible for recording changes to all data blocks. Restoring and redoing the redo log means data synchronization. If there is a nologging operation, the generation of redo logs is incomplete, and the restored data transmitted to physical standby is incomplete, which is difficult to synchronize. Therefore, the logging uard must be configured with force logging.
SQL> alter database force logging;
Database altered
SQL> select force_logging from v $ database;
FORCE_LOGGING
-------------
YES
The following code creates a standby log file in the master database. Some documents do not follow this step, but only follow the standby log creation on physical standby. Standby log file is a transit of the Redo Transfer process. Generally, when the log is transferred to the Standby end, Apply immediately. If the application process is not enabled at this time, logs will be saved in this place. For each standby, one or more sets of standby log groups must be created. For Primary Database, you also need to configure it because there may be a role transition.
Note: OMF is used in Primary Database, so we can easily create standby log group.
SQL> alter database add standby logfile size 100 m;
Database altered
SQL> alter database add standby logfile size 100 m;
Database altered
SQL> alter database add standby logfile size 100 m;
Database altered
The image configuration structure is also formed.
SQL> select group #, member from v $ logfile where type = 'standby ';
GROUP # MEMBER
------------------------------------------------------------------------------------------
4/u01/app/oradata/ORA11G/onlinelog/o1_mf_4_9nn5ntsv _. log
4/u01/app/fast_recovery_area/ORA11G/onlinelog/o1_mf_4_9nn5o0jw _. log
5/u01/app/oradata/ORA11G/onlinelog/o1_mf_5_9nn5oq6d _. log
5/u01/app/fast_recovery_area/ORA11G/onlinelog/ow.mf_5_9nn5owlv _. log
6/u01/app/oradata/ORA11G/onlinelog/o1_mf_6_9nn5p82m _. log
6/u01/app/fast_recovery_area/ORA11G/onlinelog/o1_mf_6_9nn5pc70 _. log
6 rows selected
View v $ standby_log to view log usage.
SQL> select group #, dbid, bytes from v $ standby_log;
GROUP # DBID BYTES
------------------------------------------------------------
4 UNASSIGNED 104857600
5 UNASSIGNED 104857600
6 UNASSIGNED 104857600
Finally, modify the parameters of the master database. Specifically, modify the six parameters.
The log_archive_config parameter is used to specify the DG range in the environment.
SQL> show parameter log_archive_config
NAME TYPE VALUE
-----------------------------------------------------------------------------
Log_archive_config string
SQL> alter system set log_archive_config = 'dg _ CONFIG = (ora11g, ora11gsy) 'scope = spfile;
System altered
To add an archive log transfer location, the archive_dest parameter can be set to location or service. The Location parameter indicates that the local directory stores archived logs, and the service indicates that the logs are transmitted through the Oracle NET service. To implement the logging uard component, you must specify the log to the service.
SQL> alter system set log_archive_dest_2 = 'service = ora11gsy valid_for = (online_logfiles, primary_role) db_unique_name = ora11gsy 'scope = spfile;
System altered
SQL> alter system set log_archive_dest_state_2 = enable;
System altered
Note: The valid_for parameter indicates when the transmission channel is used. Online_logfiles and Primary_role indicate that logs are transmitted only when the current instance is in the Primary role. Such configuration is the most common method.
Name convert parameter configuration. For log files and database files, directories are an important identifier. In the conversion process of Primary and Standby, it is necessary to establish the conversion replacement rules.
SQL> alter system set db_file_name_convert = 'ora11g', 'ora11gsy 'scope = spfile;
System altered
SQL> alter system set log_file_name_convert = 'ora11g', 'ora11gsy 'scope = spfile;
System altered
Note: In some documents, if the OMF policy is adopted in 11g, this parameter can be left unspecified.
The final parameter is the standby_file_management policy. The default parameter is manual. This parameter controls how files are created between Primary and Standby. In the standard DG Environment, adding data files under Primary DB will automatically add files in Standby.
SQL> show parameter standby_file_management
NAME TYPE VALUE
-----------------------------------------------------------------------------
Standby_file_management string MANUAL
SQL> alter system set standby_file_management = auto;
System altered
SQL> show parameter standby_file_management
NAME TYPE VALUE
-----------------------------------------------------------------------------
Standby_file_management string AUTO
The following configuration is the content of the network Oracle Net.
For more details, please continue to read the highlights on the next page: