Oracle9i Database Data guard implementation and maintenance manual
By kamus
I.Data guardIntroduction
Standby database is a high availability (High Available) number launched by Oracle.
The data warehouse solution ensures Data Synchronization Through log synchronization between the master node and the slave node. The slave node acts as the master node
Backup to achieve fast switchover and catastrophic recovery.
Oracle supports standby database only from 7.3. 7.3.x-8.0.x manually copy all archived logs and
Manual synchronization starts from oracle815 and supports multi-node replication and automatic synchronization.
The asynchronous mode of data may cause data loss.
The data guard of oracle9i is an enhancement to the standby database function in Oracle8i. The main purpose of the standby database technology is to achieve disaster tolerance (disaster recovery ), therefore, data guard with more powerful functions is undoubtedly the preferred product in Oracle Database high availability solutions.
Oracle provides the following products for High Availability:
(1) Oracle Fail Safe on NT
(2) Oracle Real Application cluster (RAC)
(3) Oracle Parallel fail safe
(4) ORACLE Advanced quening
(5) oralce Advanced Replication
(6) Oracle Data guard
Among these products, the most confusing thing is how to choose a high availability product suitable for your production environment in RAC, data guard, and advanced replication.
Therefore, I will first compare these three products:
RAC (Oracle Real Application cluster)
The predecessor of RAC is Ops (Oracle Parallel Server) in Oracle8i. RAC is a single CPU or
SMP (Multi-processing system) or MPP (massively parallel processing) cluster. Different servers in the cluster use one or more Oracle instances to connect to one database. Main technical features:
(1) All the data files, control files, and duplicate log files in the database are built on raw devices. Although with the introduction of ocfs, the Cluster File System has been supported on some platforms, but in general, RAC is highly dependent on the operating system settings in terms of technology. It is difficult to support cluster software.
(2) Each database instance has its own independent online replaying log group. Therefore, special processing is required for backup and recovery.
(3) there is no additional redundancy in the storage of RAC. Therefore, when the media is damaged, it still needs to be supported by Disk redundancy solutions such as raid.
In terms of software licenses, RAC is not included in the database license and requires additional purchase. Similarly, the technical support for Oracle products, you also need to purchase the OPS/RAC section in addition to the database support.
In general, RAC settings and maintenance are much more complex and expensive than data guard.
Advanced Replication)
Main technical features:
(1) replication uses distributed database technology to share data between multiple sites.
(2) The Replicated Database and distributed database are not the same.
Multiple Sites are valid at the same time, but one table only exists in one site, which is the same for replication.
.
(3) reasons for using replication:
1) Availability: provides excellent failover protection.
2) Performance: Because there are multiple servers, user services can be distributed on different servers.
3) disconnected computing: The materialized view allows you to use the database after being disconnected from the master.
After the master node is reconnected, the two are synchronized.
4) network load balancing ction: Because there are multiple servers, you can reduce the master's network requirements.
Please
5) mass deployment: Generate custom materialized views through variables to meet various requirements
(4) Advanced Replication can be used between different Oracle releases and between Oracle of different operating systems. This is the biggest advantage of advanced replication. RAC and data guard both require the same operating system and database version.
Advanced Replication does not require additional license except the database ).
Advanced Replication requires that each database object to be synchronized be copied and generated separately. Therefore, when a large number of objects in the Database need to be synchronized, it takes a lot of time to prepare advanced replication. In addition, Advanced Replication does not support DDL operations. You must use special packages to perform DDL operations before copying operations to distant databases. Therefore, the Disaster Recovery Solution for Advanced Replication as a whole database is not ideal. Only when the hardware architecture of the disaster recovery database and the master database is different due to cost issues, this solution should be selected.
Data guard
Compared with RAC or OPS, data guard is applicable in terms of high availability. It can be discussed from several aspects:
(1) database backup: Data guard clones the original database, so the original database has backup and redundancy required by disaster recovery. RAC/OPS only has one database, if a problem occurs on the hard disk where the data is located, another solution (such as RAID) is required.
(2) Number and utilization of servers: RAC/OPS must be supported by at least two machines. It supports dynamic load balancing and allows a large number of users to access the environment, you can process user requests simultaneously on multiple servers. In a multi-machine system environment, if a server still runs normally, the entire database system will not be completely shut down due to a fault. Data guard can be set on the same server and theoretically supports a single-host environment.
(3) downtime: As mentioned above, as long as there is another server running normally in the OPS/RAC environment, it will not cause downtime. In the data guard environment, the switchover between the primary database and the standby Database, it takes at least a few minutes to stop.
(4) Fee: Data guard does not need to purchase a license other than the database. At the same time, in terms of maintenance costs, the implementation of OPS/RAC is also relatively complicated, with relatively high manpower and material resources.
By comparing the above products and analyzing the customer's Hardware investment and functional requirements for disaster recovery, we think Data guard is a suitable solution.
First, Sun Minicomputers are used in the disaster recovery environment, meeting the data guard requirements for server homogeneity. Second, because the disaster recovery database is located in Shanghai, and the master database is located in Beijing, it also meets the HA requirements of data guard.
Data guard can also meet the functional requirements of data loss for up to one minute and use the disaster recovery database as the Historical query server.
II.Data guardType comparison
Oracle9i provides several different types of data guard configurations. You can select different data guard types based on your requirements for high availability.
The following lists and compares several data guard types.
The data guard environment contains a product database, which is the primary database for supporting daily business and is called the primary database. It also contains one or more disaster recovery databases, called standby database.
Standby databases can be divided into physical standby databases (physical standby) and logical standby databases (logical standby) according to the archive logs of standby databases ).
According to the primary database protection mode, the entire data guard environment is divided into maximize protection and maximize availability ), maximize performance ).
Based on the method by which the master database transmits the duplicate information to the slave database, it can be divided into arch mode and lgwr mode.
The physical standby database can run in any of the three Protection modes of the database. The logical standby database can only run in the maximum availability mode or the maximum performance mode. Both the physical and logical standby databases can adopt arch or lgwr methods for log transmission.
Physical Standby ):
Provides the same copy as the primary database at the physical level, which means that the block level of the database is exactly the same, such as the rowid recorded in the database table. The physical standby database is synchronized with the primary database by continuously recovering the duplicate log data transmitted by the primary database.
The physical standby database cannot provide the query service when it is in the state of automatic recovery and re-log information. Because the standby database is not opened normally at this time, non-sysdba users of the database cannot log on to the standby database, and thus cannot perform common query services.
Logical standby database (logical standby ):
Logically consistent with the primary database, but not on the physical layer. The logical standby database is synchronized with the primary database by converting the duplicated log data passed in by the primary database into an SQL statement and re-executing it on the standby database.
The logical standby database can be used to query duplicate application information. However, due to the restrictions on the way in which the logical standby database application rewrites logs, the logical standby database has limits on its functions and performance. The following are some restrictions on the logical standby database.
1. The following data types are not supported:
Nclob, long, long raw, bfile, rowid, urowid
2. The following operations are not supported:
Alter database, alter session, alter Snapshot
Alter snapshot log, alter system switch log
Create control file, create database,
Create database link, create pfile from spfile,
Create schema authorization
Create snapshot, create snapshot log, create spfile from pfile
Create Table as select from a cluster Table
Drop database link, drop snapshot, drop snapshot log
Explain, lock table, rename, set constraints,
Set role, SET transaction
3. Management of advanced queues and refresh of materialized views are not supported
4. each table must have a primary key or a unique index. If a table must have a unique identifier, You can activate the supplemental logging attribute of the primary database, however, this will record all the field information of each record in the table in the re-log, which will greatly increase the record volume of the re-log.
The following figure shows the configuration of the physical and logical standby databases in the Data guard environment.
Maximize protection)
Provides the highest level of data protection, and the duplicate information is synchronized from the master database to the slave database. Transactions on the master database will not be committed until the slave database successfully receives the duplicate information. If the slave database is unavailable due to network problems, the master database is also disabled. This mode ensures that no data is lost at all.
Maximize availability)
When the standby database is normal, this mode provides the same mechanism as the "maximum data protection mode" to ensure that no data is lost. If the slave database is unavailable, it is converted to the "maximum performance mode". The operation can continue on the master database. When the slave database is available again, the synchronization will continue. However, if the master database is damaged due to a fault before the synchronization is completed, data will be lost (of course, you can use RAID, rman, and other methods to protect the master database from data loss even if it fails ).
Maximize performance)
In this mode, the duplicate information on the master database is asynchronously transmitted to the slave database. operations on the master database are successfully executed no matter whether the slave database has successfully received the duplicate information. Therefore, this mode provides the best performance, but the lowest data protection. This is the default mode for data guard configuration in Oracle9i.
Arch Method
When the master database archives online re-engineering log files, the arch archive process transfers the re-engineering data to the slave database while archiving the data to the local database, which is received by the RFS process (Remote File Server) of the slave database, generate the archive log file on the slave database, and then restore the archive log file to the slave database by the MRP process (physical backup database type) or LSP process (logical backup database type) on the slave database.
Transfer Mode
Lgwr Mode
In the physical standby database type, the lgwr process of the primary database writes the duplicate data to the local online reproduction log file, and transfers the duplicate data to the standby database, the RFS process of the slave database writes the received data to the standby redo log file. When the master database logs are switched, the slave database logs are switched. When the switchover occurs, the archiving process of the slave database will be rearchived as log files, then, the MRP process on the slave database restores the archived log files to the slave database.
Transfer Mode
The standby redo log cannot be created under the logical standby database type. Therefore, the processing process is slightly different from that of the physical standby database.
The lgwr process of the master database transfers the duplicate data to the backup database while writing the duplicate data to the local online duplicate log file, the RFS process of the slave database writes the received data to the local archive log file. When the master database logs are switched, the slave database logs are switched. When the switchover occurs, the archiving process of the slave database completes the final generation of the archive log files, then, the LSP process on the slave database extracts the SQL statements in the archive log file and runs them again on the slave database.
Transfer Mode
Finally, all the above types or methods are compared with each other.
Maximum protection |
Maximum availability |
Maximum performance |
Transfer Mode |
Lgwr |
Lgwr |
Lgwr or arch |
Network Transmission Mode |
Synchronization |
Synchronization |
This method is asynchronous when lgwr is used. If arch is used, network transmission of online data duplication is not involved. |
Disk write Option |
Affrem |
Affrem |
Noaffrem |
Need to be used as a backup log file? |
Yes |
Only required in the physical standby Database Type |
If the physical standby database uses the lgwr transfer method, you must |
Backup Database Type |
Physical |
Physical or logical |
Physical or logical |
Iii. hardware configuration
4. Software Configuration
5. ImplementationData guardPrerequisites and precautions