Oracle backup mechanism

        In Oracle, backup and recovery are very important database management tasks to ensure the reliability and stability of the database. According to the form of database backup, it includes the following types:

        Full backup : Full backup is the most basic and commonly used form of backup. It can back up all data and objects in the database, including data files, control files, and online redo logs. Full backup is usually implemented using the Oracle Recovery Manager (RMAN) tool, which can quickly perform backup and recovery operations, and supports functions such as incremental backup and simulated recovery.

        Incremental backup : Incremental backup is generally used to back up modified data and objects in the database to reduce backup time and space. Incremental backup can be divided into two forms: incremental backup and differential backup. Incremental backup generally only backs up changed data blocks, while differential backup backs up incremental data within a period of time. Incremental backups can also be implemented using the Oracle RMAN tool.

        Archive backup : Archive backup is mainly used to back up archived redo logs in the Oracle database, which can help manage and control transactions and activities in the database to avoid data loss and errors. Archive backup can be implemented using Oracle RMAN tools or custom archive scripts, and supports incremental and differential backups.

        Database replication backup: Database replication backup is generally used to improve database availability and disaster recovery and fault tolerance. It can replicate the data and objects of the Oracle database to one or more backup databases for quick recovery when the backup fails. Database replication backup is generally implemented using Oracle Data Guard, GoldenGate or other data replication tools, which can realize real-time data synchronization and backup.

        In addition, there are hot backup (Online Backup), cold backup (Cold Backup) and logical backup (Logical Backup) concepts.

The backups related to hot backup (Online Backup)         in Oralce include the following:

        Database archive backup: After the database is fully backed up, Oracle will automatically switch the archived redo log files to a new log group, and archive backup is to back up these archived log files. During the archive backup process, since the Oracle database is running all the time, the backup is uninterrupted, that is, hot backup is used. Archive backup is often used for real-time backup of critical systems, which can quickly restore data in disasters.

        Oracle Data Guard backup: Oracle Data Guard is a disaster recovery solution built by Oracle that supports automatic data replication and failover. In Oracle Data Guard, the primary database is the data source, and the standby database is a copy of the backup data. Data changes in the main database will be immediately and automatically synchronized to the standby database, ensuring that the data in the standby database is always in a state of synchronization with the data in the main database, realizing hot backup.

        Oracle RMAN backup: Oracle Recovery Manager (RMAN) is an important part of Oracle backup and recovery. Backups implemented using RMAN can be performed while the Oracle database is still running, so it is also a hot backup. RMAN backup supports backup strategies such as full backup, incremental backup, and differential backup. At the same time, RMAN backup also supports data compression function, which can reduce the backup file size.

        Oracle also supports cold backup (Cold Backup) . The so-called cold backup is to back up when the database is closed, that is, no new data comes in, and the database is completely shut down. Compared with hot backup, cold backup does not need to consider the possible impact of read and write operations on the database during backup on the backup data, so the backup process is safer and more reliable.

        The process of cold backup needs to stop the service of the database first, and then copy the data files, control files, redo logs, etc. in the database to the backup location. It should be noted that when performing cold backup, the consistency and integrity of the backup data should be guaranteed, that is, the state of all files should be consistent during backup. Compared with hot backup, the advantage of cold backup is that the backup process is simple, and there is no need to consider data changes and impact issues, so the reliability of backup is better; the disadvantage is that the database needs to be shut down, and the database is not available when the data is backed up, and it needs to be shut down for maintenance for a period of time .

        Logical backup (Logical Backup) mainly refers to the backup of the logical structure of database objects, that is, backing up logical data in the database, such as table structure, data, views, functions, stored procedures, etc., rather than directly backing up physical data blocks, such as data files and log files.

        The main advantage of logical backup is that the backup and recovery speed is fast, unnecessary content can be filtered out during backup, the recovery operation is highly flexible, and the object to be recovered can be selected.

        Implementing logical backup in Oracle includes the following methods:

        Backup using SQL*Plus tools. You can back up required database objects, such as tables, triggers, and stored procedures, by executing SQL statements.

        Use the EXP and IMP tools for backup and recovery. The EXP and IMP tools are Oracle's own command-line tools for logical backup and recovery. EXP is used to export data and objects, and IMP is used to restore data and objects from export files. You can select the objects that need to be exported or restored, and perform import and export filtering, such as excluding unnecessary data rows, columns and objects.

        Use the Data Pump tool for backup and restore. The Data Pump tool is a data import and export tool introduced after Oracle 9i. It supports importing and exporting the structure and data of database objects, as well as functions such as incremental data synchronization and filtering. It is one of the main tools for Oracle logical backup and recovery. The Data Pump tool is more flexible and efficient than the EXP and IMP tools.

        In addition, explain that there is usually no concept of so-called "warm backup" (Warm Backup) in Oracle database backup. Warm backup usually refers to partially shutting down or restricting the read and write operations of the database during the backup period to reduce the impact of the backup on the database and improve the backup speed, but the backup is still performed while the database is running.

        In Oracle database backup, if read and write operations are performed during backup, the backup data may be affected, resulting in incomplete backup or data inconsistency. Therefore, it is difficult to implement warm backup. In contrast, Oracle's hot backup and cold backup can solve different backup scenarios, and you can choose hot backup or cold backup according to different needs.

Guess you like

Origin blog.csdn.net/ryanzzzzz/article/details/131294549