Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Analysis of 11g DataGuard in Oracle

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "analyzing 11g DataGuard in Oracle". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "analyze 11g DataGuard in Oracle".

1. What is DataGuard

DataGuard is a high-availability technology developed by Oracle specifically for oracle databases. It was called Standby Dtabase before 8i and officially changed its name to DataGuard since 9i. Usually there are at least two data mirroring nodes in the active / standby relationship. Through the synchronization technology of redo logs to ensure the real-time synchronization of data, we can realize the rapid switching between the master and standby of the database to achieve data disaster recovery.

2. Why use DataGuard

The Chinese name of DataGuard is also called data Guardian. As its name implies, it is a technology introduced by ORACLE to ensure data security. It is mainly used in some occasions that attach great importance to data security, such as banking, telecommunications and other industries. They have applied many sets of DataGuard data guards to ensure data security.

Of course, it is also used for daily database maintenance without interrupting the business, such as routine downtime, test changes, upgrade maintenance and so on.

3. The value brought by DataGuard

It can achieve zero data loss, zero maintenance downtime, ensure the continuous online operation of the business, effectively share the database pressure through read-write separation, and reduce the risk of downtime due to various reasons.

4. The architecture of DataGuard

5. Whether DataGuard is secure

DataGuard synchronization is transmitted through redo and data synchronization is realized in standby application, so its synchronization link is established on Oracle Net, and data transmission is learned through Oracle Net. SSL protocol is adopted between them. SSL uses RSA public key cryptography and symmetric key encryption to provide authentication, encryption and data integrity. SSL is automatically used to redo transport validation in two Oracle databases. If the SSL authentication requirements are not met, each database must use a Telnet password file. In a DataGuard configuration, all physical and snapshot standby databases must use a copy of the password file to slave the master database, and refresh copies must be changed with any user's password after SYSOPER or SYSDBA privileges are granted or revoked.

When a password file is used for redo transfer authentication, the user account in the password file is used for redo transfer comparisons between databases to start a redo transfer session and the target database. The password must be in both databases. By default, the system user's password is used to validate the redo shipping session password file.

6. Three protection modes of DataGuard.

Maximum protection mode:

1) this model provides the highest level of data protection

2) at least one physical standby database is required to receive the redo log before the transaction of the main database can be committed

3) when the master database cannot find a suitable backup library for writing, the master library will shut down automatically to prevent unprotected data from appearing.

4) advantage: this mode can ensure that there is no data loss in the standby database.

5) disadvantages: the automatic shutdown of the master library will affect the availability of the master library, and it can only be submitted after the backup library is restored, which requires very high objective conditions such as the network, which will have a great impact on the performance of the master library.

Maximum availability mode:

1) this mode provides data protection capability second only to "maximum protection mode".

2) at least one physical standby database is required to receive the redo log before the transaction of the main database can be committed

3) when the main library cannot find a suitable standby library to write, the main library will not be closed, but will be temporarily reduced to "maximum performance mode" mode until the problem is dealt with.

4) advantages: this mode can ensure that there is no data loss in the standby database without problems, and it is a compromise method.

5) disadvantage: in the process of normal operation, the disadvantage is that the performance of the main library is affected by many factors.

Maximum performance mode:

1) this mode is the default mode and ensures the highest availability of the primary database.

2) ensure that the operation of the main database will not be affected by the standby database, the transaction of the main database will be committed normally, and the operation of the main database will not be affected by any problems in the standby database.

4) advantages: avoid the impact of standby database on the performance and availability of the primary database

5) disadvantages: if the recovery data related to the transactions committed by the main database are not sent to the standby database, the transaction data will be lost and no data loss can be guaranteed.

In a nutshell, it consists of three parts: the main library, the standby library, and the middle layer (various services + logs and archived files). Let's put it later. First, take a look at the main library and standby database:

Primary Database

The DG environment contains a main library. The main library can be a single instance or a RAC cluster. The repository consists of at least one standby database. The main and standby libraries communicate with each other through oracle Net, and the main and standby libraries are not limited by geographical location.

Standby Databases

The Standby database is consistent with the main database to maintain transaction consistency. A master library can correspond to multiple backup libraries. There are three types of libraries in 11g:

1. Physical repository

two。 Logical reserve library

3. Snapshot backup library

Physical standby (Physical standby database)

Physical standby is the physically identical copy of the main library. This is a Media recovery, which is a block-for-block-based recovery. Restore at the block level, which has no data type restrictions and ensures that the two databases are exactly the same.

Prior to Oracle 11g, standby databases could only be restored in the Mount state or open, but could only be opened read-only, and restore operations could not be performed when opened. To 11g read-only standby can be started and synchronized, so that the standby database can be used for some data query operations to improve the utilization of the database.

Logical standby (Logical standby database)

The synchronization of the logical standby uses SQL Apply. This method is like logminer mining logs, but through Logminer technology, by restoring the log contents to SQL statements, and then the SQL engine executes these statements, Logminer Standby does not support all data types, and you can view unsupported data types in the view DBA_LOGSTDBY_UNSUPPORTED. If this data type is used, the database cannot be guaranteed to be completely consistent.

Snapshot standby (Snapshot Standby Database)

Snapshot standby is a new feature in Oracle 11g and an upgrade to standby database. Snapshot standby, like physical standby and logical standby, receives archives from the main library, but snapshot standby does not apply these received archives.

Both Snapshot Standby Database and logical standby library are based on physical standby. If we want to do some tests on the standby library, because we can't move the main library, we can test it in the preparation library. Then we can switch this standby to snapshot standby.

The switching statement is as follows:

SQL > alter database convert to snapshot standby

Open the snapshot standby database and do our test.

SQL > alter database open

After testing, we restart the database to the mount state. Execute the command to switch the database from the snapshot state to the previous state, such as physical standby or logical standby.

SQL > alter database convert to physical standby

From the function of snapshot standby, oracle gradually weakens the logical standby library, and the use of physical standby library and snapshot backup library in 11g will be the mainstream.

First, why do you want to set up a database to force archiving?

Alter database force logging

Three modes of Oracle logging: logging,force logging,nologging

Logging: writes log information to the online redo log file when creating database objects (views, indexes, sequences, etc.). Logging is equivalent to

Object that marks whether the REDO log was logged when the object was created, including whether the REDO log was logged at the time of DML.

Force logging: forces logging, generates log information for all operations on the data, and writes the information to the online redo log file.

Nologging: on the contrary, there are fewer logs.

When doing DATA GUARD to ensure the consistency of the data, so open the database to force archiving mode.

Second, why open database archiving in mount?

The three stages of Oracle database startup, nomount,mount,open, the loaded files are parameter files, control files, and data files.

When the database is started to the mount phase, the database opens the control file according to the control file path specified in the parameter file

Get the information of data files and log files. At this time, you can maintain the database and enable archiving mode. Oracle requires archiving to be enabled under mount instances.

Third, why configure static monitoring parameters?

In the DATA GUARD architecture, dynamic snooping cannot register the service with the database in the database mount state, while static snooping can accomplish this task.

The typical listening file listen.ora is divided into two parts: LISTENER registers the service and SID_LIST_LISTENER registers the instance.

4. What is the meaning of the parameters in the parameter file?

1. * .db _ name='orcl'

Database name, you need to keep the same db_name for all databases in the same DATA GUARD

2. * .db _ unique_name='orcl_p'

Each database must have a unique name

3. * .log _ archive_config='dg_config= (orcl_p,orcl_s)'

This parameter is used to control sending archive logs to a remote location, receiving remote archive logs, and specifying a unique database name for the DATA GUARD configuration

The default value is SEND,RECEIVE,NODG_CONFIG, when the

When the parameter is SEND, sending archive logs to a remote location is activated

When the parameter is NOSEND, sending archive logs to a remote location is prohibited

When the parameter is RESEIVE, receiving remote archive logs is activated.

Remote archive logs are prohibited when the parameter is NORECEIVE

When the parameter is DG_CONFIG, you can specify up to 9 unique database names

When the parameter is NODG_CONFIG, the assignment of a unique database name is prohibited

This parameter is dynamic and can be modified using alter system set log_archive_config='SEND';.

4. * .log _ archive_dest_1='location=/u01/arch valid_for= (all_logfiles,all_roles) db_unique_name=orcl_p'

Log_archive_dest_1 is the main parameter of DG redo log transfer, which generally plays a role in the main library and plays a role in the backup database when dealing with cascading libraries.

This parameter can also specify the transfer destination for online redo logs (ORL) and repository redo logs (SRL) to generate archived logs.

(1) service: specify the network connection name of the slave database

(2) sync: specifies that the redo data is transmitted by synchronous method, that is, the commit of the client transaction occurs when the LGWR process receives a message from the slave LNS.

After the information is confirmed, at least one slave net_timeout is required to specify the LGWR process for the maximum available and maximum protection mode.

Wait for the response time of the LNS process. If no response is received during the period, the slave database is considered to have failed (failed). The default is 30s.

The following things need to be done while waiting:

A: stop the old LNS process

B: start a new LNS process

C: establish a connection with the standby library

D: detect and stop old RFS processes

E: start a new RFS process

F: select and open a new SRL

G: initialize the SR header, that is, the redo log database of the repository

H: respond to the LNS process's notification that preparations have been completed

After completing the above operation, the LNS process will notify LGWR that the slave database connection is successful, and if the process exceeds 30 seconds, it will continue to abandon the slave database.

(3) reopen: attribute controls the waiting time for the master database to try to reconnect the failed slave database. Default is 30s.

(4) if the db_unique_name attribute is to be used in log_archive_dest_n, it should be set in log_archive_config at the same time, otherwise DATA GUARD will refuse to connect to the target library, and db_unique_name must be added to the log_archive_config parameter in the master / slave database. When the master database initiates the connection, it will send its own db_unique_name to the slave database and require the slave database to return a unique db_unique_name. The log_archive_config parameter will be checked in the slave database to ensure that the db_unique_name of the master database exists. If it does not exist, the connection request will be rejected. If it exists, the slave database will return its own db_unique_name to the LNS process of the master database. If the return value does not match the value of the master database, the connection will be terminated.

(5) valid_for: the attribute defines when to use the target parameter log_archive_dest_n and what type of log file it acts on.

There are three legal values for log files:

Online_logfile is only valid in the archive ORL

Standby_logfile is only valid in the archive SRL

All_logfiles is valid no matter which type of redo log file

There are three legal values for roles:

Primary_role is only valid in the main library

Standby_role is only valid in the repository.

Both all_roles master and backup libraries are valid.

(6) affirm: attribute is the default value of the target using sync mode

5. * .log _ archive_dest_state_1=enable

Used to specify whether the archive directory is available.

6. * .standby _ file_management='auto'

The standby library automatically creates the data file when the main library creates the data file.

7. * .log _ file_name_convert='/u01/app/oracle/oradata/orcl','/u01/app/oracle/oradata/orcl'

* .db_file_name_convert='/u01/app/oracle/oradata/orcl','/u01/app/oracle/oradata/orcl'

Log_file_name_convert and db_file_name_convert to ensure the consistency of the data file path between the master and standby libraries.

8. * .fal _ server='orcl_s'

FAL refers to the acquisition of archived logs (fetch archive log). The master and backup logs are out of sync due to problems such as network outages or resource constraints.

MRP (Managed recovery process) / LSP (Logical Standby Process) cannot directly connect with the main database to obtain the lost archive logs, so it needs to be solved by using FAL. After fal_server, it corresponds to the db_unique_name of the standby database.

What is the structure of the Oracle DATA GUARD process?

1. The process that exists in the main library:

(1) LGWR: collect transaction logs and update online logs. In synchronous mode, LGWR transmits redo information directly to the RFS process of slave database, and the master database waits for confirmation of standby database before continuing processing. In the case of non-synchronization, the log information is also transmitted directly to the RFS process of the slave database, but does not wait for the confirmation message of the slave database.

(2) ARCH: when archiving, the log is transferred to the RFS process of preparation database, which can be used to solve the problem of discontinuity of GAP logs.

(3) the Redo log generated by LNSn:Primary Database should be written to both the log file and the network. That is to say, when the LGWR process writes the log to the local log file, it also sends the log to the local LNSn process (Network Server Process), and then the LNSn (LGWR Network Server process) process sends the log to the remote destination through the network. Each remote destination corresponds to a LNS process, and multiple LNS processes can work in parallel.

2. The process that exists in preparing the database:

(1) FAL: a process that only exists in the physical slave database. FAL refers to the acquisition of archive logs (Fetch Archive Log). Because the master / slave logs are out of sync due to network outages or resource constraints, MRP (Managed recovery process) / LSP (Logical Standby Process) cannot be directly connected with the master database to obtain the lost archive logs, so FAL is needed to solve the problem.

(2) RFS (Remote File Server): mainly used to receive log information from the main database. The arch process archives the redo log, which is applied to the repository by MPR.

(3) MRP (Managed Recovery Process): for the physical repository only, apply archive logs to the repository

(4) LSP (Logic Standby Process): it is only owned by the logical repository to control the application of archive logs to the logical repository.

3. Oracle DG synchronizes the log files to ensure the consistency between the main database and the standby database.

If there is a problem with the connection between a database and one or more slave databases, the log files generated by the master database cannot be transferred to the slave database. Use the Archive Log process (FAL) to provide a customer service mechanism for sending archive logs to the slave database after the connection between the master database and the slave database is broken, so as to automatically fill the interval and resynchronize. On the slave, Oracle DATA GUARD uses the remote file server (RFS) process to receive redo records from the primary database, the administrative recovery process (MRP) to apply the redo information to the physical standby, and the logical standby process (LSP) to apply the redo information converted by SQL to the logical repository.

4. Three protection modes of Oracle DATA GUARD

Protection mode

Risk of data loss in case of disaster

Redo transmission mechanism

Maximum protection

Zero data loss; double fault protection

LGWR SYNC

Highest availability

Zero data loss; single fault protection

LGWR SYNC

Highest performanc

Minimum data loss

LGWR SYNC or ARCH

The default protection mode is the highest performance mode. You can use alter database set standby database to maximize (protection | availability | performance}; to switch the protection mode.

The maximum protection mode ensures that when the transaction is committed, it is written to the log files of the main database and the standby database at the same time to ensure consistency. The advantage is security, while the disadvantage is that when the standby database fails, the main database can not be used normally.

The highest availability is basically the same as the maximum protection mode, except that when the standby library fails, the primary library will immediately switch to the highest performance mode.

The highest performance only needs to ensure that committed transactions are written to the log file of the main library.

Thank you for your reading. The above is the content of "analyzing 11g DataGuard in Oracle". After the study of this article, I believe you have a deeper understanding of the problem of analyzing 11g DataGuard in Oracle, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report