Oracle 11g DataGuard usage Summary

Source: Internet
Author: User

Oracle 11g DataGuard usage Summary

Compared with 10 Gb, Oracle's 11g replica uard has the most advantageous feature of active replica uard. This improvement has prompted users to upgrade the database from 10 Gb to 11 GB, read/write splitting is sublimated at this time, and data synchronization is performed in the background as needed. Compared with the use of 10 Gb, the database is started to read only when you want to read data, however, at this time, the log synchronization data is not accepted. If you need to synchronize the data, you need to start the database to the mount stage again, which is complicated.

The active dataurad function of the 11g is very powerful. At the same time, the duplicate option of rman was greatly improved in the 11g architecture. We do not need to make a dedicated backup, the data files can be directly transmitted from the master database to the slave database through duplicate, and the recovery process is more concise.

Of course, the general system is one master and one slave, and the key system even requires one master and two slave. If there are more systems, manual management is easy to confuse, at this time, we should use the enhanced version of the dg broker to do it. In the past, we felt that we had to manage it manually at 10 Gbit/s, and manually switchover and failover were relatively steadfast, because switchover was also in the 10 Gbit/s process, failover has encountered some problems, but it leaves some shadows. When it was 11 GB, it was widely used at work, and I tried it myself and found that it was really good, in addition, it is much easier to set up a slave database than to set up a slave database manually. Therefore, we still need to embrace changes and embrace new things. On the one hand, we can heal ourselves. On the other hand, we need to restore our confidence in using new things, at least in the event of a disaster.

Let's take a simple look at an example to illustrate how to use the dg broker to build a consumer uard. The steps are much simpler than manual ones, and the reliability is much higher because of the manual checkpoint, this will be done in the check of the dg broker.

Out of force logging, the master database is set to archive.

All we need to do is configure the network listener. Of course, this is not difficult either. The listener. ora tnsnames. ora master and backup are very similar.

For example, we use port 1523 to interconnect between primary and standby.

The host part of the listener. ora master database is different from that of the slave database.


LISTENER_1523 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = 10. xxxxx.45) (PORT = 1523 ))
)
)
)

SID_LIST_LISTENER_1523 =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = test11g)
(ORACLE_HOME =/DATA/app/oracle/product/11.2.0.4)
(SID_NAME = test11g)
)
)

The master and slave databases of tnsnames. ora are consistent.
TEST11G =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 10. xxxxx.45) (PORT = 1523 ))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = test11g)
)
)

STEST11G =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 10. xxxxxx.46) (PORT = 1523 ))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = test11g)
)
)

Then, you can use tnsping to start checking and checking the firewall.
Add slave database logs
To check the log status of the master database, use the following method.
SQL> select member, group #, status from v $ logfile
Member group # STATUS
-------------------------------------------------------------------
/DATA/app/oracle/oradata/test11g/redo03.log 3
/DATA/app/oracle/oradata/test11g/redo02.log 2
/DATA/app/oracle/oradata/test11g/redo01.log 1
SQL> select group #, status, bytes, blocksize, status from v $ log;
GROUP # STATUS BYTES BLOCKSIZE STATUS
--------------------------------------------------------------
1 INACTIVE 52428800 512 INACTIVE
2 CURRENT 52428800 512 CURRENT
3 INACTIVE 52428800 512 INACTIVE
The statement for adding a slave database log is similar:
Alter database add standby logfile group 4'/DATA/app/oracle/oradata/test11g/redo04.log 'SIZE 524288000;
Modify the following database parameters,
Alter system set standby_file_management = auto scope = both;
Alter system set dg_broker_start = TRUE scope = both;
Alter system set local_listener = TEST11G scope = both;

Check the dmon status
SQL>! Ps-ef | grep dmon_test11g
Oracle 8129 1 0? 00:00:00 ora_dmon_test11g
Oracle 8138 8108 0 00:00:00 pts/0/bin/bash-c ps-ef | grep dmon_test11g
Oracle 8140 8138 0 00:00:00 pts/0 grep dmon_test11g

Check the log of the dg broker. If there is no configuration file at the beginning, it will be created again.
DMON: cannot open configuration file "/DATA/app/oracle/product/11.2.0.4/dbs/dr2test11g. dat"
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
DMON: cannot open configuration file "/DATA/app/oracle/product/11.2.0.4/dbs/dr2test11g. dat"
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Configuration does not exist, Data Guard broker ready

Database alert Log:
Mon Jul 27 11:25:15 2015
DMON started with pid = 26, OS id = 8129
Starting Data Guard Broker (DMON)
Mon Jul 27 11:25:23 2015

Then copy the password file, the parameter file (spfile) to the slave database.

Generate pfile in the slave database, and modify the following parameters
Modify db_unique_name to stest11g
Change local_listener to stest11g
Configure db_file_name_convert
Log_file_name_convert
Db_file_name_convert = '/DATA/app/oracle/oradata/test11g','/DATA/app/oracle/oradata/test11g ', '/DATA/app/oracle/fast_recovery_area/test11g', '/DATA/app/oracle/fast_recovery_area/test11g' log_file_name_convert = '/DATA/app/oracle/oradata/test11g ', '/DATA/app/oracle/oradata/test11g', '/DATA/app/oracle/fast_recovery_area/test11g', '/DATA/app/oracle/fast_recovery_area/test11g'
Check whether db_recovery_file_dest and other file paths are valid (adump, oradata)
Fal_server
Fal_client
Generate spfile
At this time, the database is basically completed, and the rest is to use rman for recovery, and the dg broker is configured.

Data Replication recovery
Start the slave database to nomount stage
SQL> create spfile from pfile;
File created.
SQL> startup nomount
SQL>! Ps-ef | grep dmon_test11g
Oracle 17773 1 0? 00:00:00 ora_dmon_test11g
Oracle 17779 17733 0 00:00:00 pts/0/bin/bash-c ps-ef | grep dmon_test11g
Oracle 17781 17779 0 00:00:00 pts/0 grep dmon_test11g

Check whether the parameters take effect
The slave database uses rman to copy data files.
$ Rman target sys/xxxx @ test11g auxiliary sys/xxxxx @ stest11g nocatalog
Recovery Manager: Release 11.2.0.4.0-Production on Mon Jul 27 11:46:23 2015
Copyright (c) 1982,201 1, Oracle and/or its affiliates. All rights reserved.
Connected to target database: TEST11G (DBID = 1038061657)
Using target database control file instead of recovery catalog
Connected to auxiliary database: TEST11G (not mounted)
RMAN> duplicate target database for standby from active database nofilenamecheck;

After the configuration is complete, data replication is complete.
Start configuring dg broker

Master database execution:
$ Dgmgrl/
DGMGRL for Linux: Version 11.2.0.4.0-64bit Production
Copyright (c) 2000,200 9, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL> create configuration dg_test11g
> Primary database is test11g
> Connect identifier is test11g;
Configuration "dg_test11g" created with primary database "test11g"
DGMGRL> add database stest11g
> Connect identifier is stest11g
> Maintained as physical;
Database "stest11g" added
The configuration does not take effect yet.
DGMGRL> show configuration;
Configuration-dg_test11g
Protection Mode: MaxPerformance
Databases:
Test11g-Primary database
Stest11g-Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
DISABLED
Enable Configuration
DGMGRL> enable configuration;
Check again. If the configuration is correct, it will take effect.
DGMGRL> show configuration;
Configuration-dg_test11g
Protection Mode: MaxPerformance
Databases:
Test11g-Primary database
Stest11g-Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS
Verify again
DGMGRL> enable database test11g;
Enabled.
DGMGRL> enable database stest11g;
Enabled.
DGMGRL>
DGMGRL> show configuration;
Configuration-dg_test11g
Protection Mode: MaxPerformance
Databases:
Test11g-Primary database
Stest11g-Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS

The deployment uard is built. You can check whether logs are applied to the backup database logs in the master database switch log.
Media Recovery Waiting for thread 1 sequence 12 (in transit)
Recovery of Online Redo Log: Thread 1 Group 4 Seq 12 Reading mem 0
Mem #0:/DATA/app/oracle/oradata/test11g/redo04.log

The 11g slave database uses the active slave uard feature.
SQL> alter database open;
Database altered.

SQL> recover managed standby database using current logfile disconnect from session;
Media recovery complete.

Q & A about switchover
If the following error occurs, it is likely that multiple database instances are installed under the current operating system user. Just cancel the default ORACLE_SID.
Or use dgmgrl sys/oracle @ test11g to connect directly.
DGMGRL> switchover to 'stest11g ';
Ming switchover NOW, please wait...
Operation requires a connection to instance "test11g" on database "stest11g"
Connecting to instance "test11g "...
ORA-01017: invalid username/password; logon denied
Warning: You are no longer connected to ORACLE.
Connect to instance "test11g" of database "stest11g"

The switchover is normal, but the standby database needs to be started manually. The switchover is normal. You need to manually start the primary database.
The main reason is that you need to configure a global_name of xxxx_DGMGRL in listener. ora.

DGMGRL> switchover to stest11g
Ming switchover NOW, please wait...
Operation requires a connection to instance "test11g" on database "stest11g"
Connecting to instance "test11g "...
Connected.
New primary database "stest11g" is opening...
Operation requires startup of instance "test11g" on database "test11g"
Starting instance "test11g "...
Unable to connect to database
ORA-12514: TNS: listener does not currently know of service requested in connect descriptor
Failed.
Warning: You are no longer connected to ORACLE.
Please complete the following steps to finish switchover:
Start up instance "test11g" of database "test11g"

If the configuration is correct, the log for normal switching will be as follows:
DGMGRL> switchover to stest11g;
Ming switchover NOW, please wait...
Operation requires a connection to instance "test11g" on database "stest11g"
Connecting to instance "test11g "...
Connected.
New primary database "stest11g" is opening...
Operation requires startup of instance "test11g" on database "test11g"
Starting instance "test11g "...
ORACLE instance started.
Database mounted.
Database opened.
Switchover succeeded, new primary is "stest11g"
DGMGRL>

Finally, we hope that you can use Alibaba uard properly, and everything will go smoothly.

Install Oracle 11gR2 (x64) in CentOS 6.4)

Steps for installing Oracle 11gR2 in vmwarevm

Install Oracle 11g XE R2 In Debian

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

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.