Oracle Database Backup and Recovery

xiaoxiao2021-03-06  70

Oracle Database Backup and Recovery

---- When we use a database, always hope that the content of the database is reliable, correct, but due to the fault of computer systems (including machine faults, media faults, misstades, etc.), the database may sometimes be destroyed. How to recover data as soon as possible and become a top priority. If you make a backup of the database, you will be easy to recover data at this time. It can be seen that how important the backup of the database is, and the author takes Oracle7 as an example to tell the database backup and recovery. The Oracle database has three standard backup methods that are export / import (export / import), cold backup, hot backup. Export backup is a logical backup, a cold backup and a hot backup is a physical backup.

---- First, Export / Import (Export / Import)

---- Using Export to extract data from the database, you can send the extracted data back into the Oracle database in the Oracle database.

---- 1. Simple export data (export) and import data (import)

---- Oracle supports three types of output:

---- (1) Table mode (T method), export the data of the specified table.

---- (2) User mode (U mode), export all objects and data of the specified user.

---- (3) Delicate mode (Full mode), export all objects in the database.

---- Data Export (Import) process is the inverse process of data import (export), and their data flows are different.

---- 2. Incremental Export / Import

---- Incremental Export is a commonly used data backup method, which can only be implemented throughout the database and must be exported as system. When performing such export, the system does not request an answer any questions. Export file name defaults to export.dmp, if you do not want your own output file to be named Export.dmp, you must point out the file name you want to use in the command line.

---- Incremental export includes three types:

---- (1) "Complete" incremental export

---- Only back up the entire database, such as:

- $ exp system / manager incy = complete file = 990702.dmp

---- (2) "incremental" incremental export

---- The data changes after the last backup is backed up. such as:

- $ exp system / manager incy = incremental file = 990702.dmp

---- (3) "cumulative" incremental export (cumulative)

---- Cumulative export method is just the information that changes in the database after the last "complete" export. such as:

- $ exp system / manager incy = cumulative file = 990702.dmp

---- Database administrator can schedule a backup schedule, completely and efficiently completed three different ways with data export.

---- For example, the backup task of the database can be arranged as follows:

---- Monday: Fully export (a)

---- Tuesday: Increment Export (B)

---- Wednesday: Increment Export (C) - Thursday: Increment Export (D)

---- Friday: Cumulative Export (E)

---- Saturday: Increment Export (F)

---- Sunday: Increment Export (G)

---- If on Sunday, the database is accidentally destroyed, and the database administrator can restore the database as follows:

---- Step 1: Recover the database structure with the command Create Database;

---- Step 2: Create a very large additional reflection.

---- Step 3: Full incremental import A:

- $ imp system./manager incy = Rectore Full = y File = a

---- Step 4: Cumulative Incremental Import E:

- $ IMP System / Manager IncTyPe = Rectore Full = Y File = E

---- Step 5: Recent incremental import f:

- $ IMP System / Manager IncType = Restore Full = Y File = f

---- Second, cold backup

---- Cold backup occurs in the case where the database has been closed properly, will provide us a complete database when properly closed. Cold backup is a statement that copies a key file to an additional location. For backup Oracle information, cold backup is the fastest and safest way. The advantage of the cold backup is:

---- 1. Is a very fast backup method (only copy file)

---- 2. Easy to archive (simple copy)

---- 3. Easy to recover to a point in time (just copy the file back)

---- 4. Can be combined with the archive method to make the database "Latest Status" recovery.

---- 5. Low level maintenance, high security.

---- But the cold backup also has the following deficiencies:

---- 1. You can only provide recovery to "a certain point in time" alone.

---- 2. In implementing the full process of the backup, the database must be a backup without making it. That is, during the cold backup process, the database must be closed.

---- 3. If the disk space is limited, only the other external storage devices such as tape can be copied, and the speed will be very slow.

---- 4. Can't be restored in form or by user.

---- If possible (mainly) . Documents that must be copied in the cold backup include:

---- 1. All data files

---- 2. All control files

---- 3. All online redo log files

---- 4. INIT.ORA file (optional).

---- It is worth noting that the cold backup must be performed in the case where the database is closed. When the database is open, the execution database file system backup is invalid.

---- Here is a complete example of making cold backup:

---- (1) Close Database $ SQLDBA LMODE = Y

---- SQLDBA> Connect Internal; ---- Sqldba> Shutdown Normal

---- (2) Back up all of the time files, redo log files, control files, initialize parameter files

---- SQLDBA>! CP <; backup directory>

---- (3) Restart Oracle Database

$ SQLDBA LMODE = Y

---- Sqldba> Connect Internal;

---- Sqldba> Startup;

---- Third, hot spare

---- Thermal backup is a method of backing up the data in the case of the ArchiveLog Mode mode in the case of the database operation. So, if you have a cold backup yesterday and today's hot backup documents, you can use this information to restore more information when there is a problem. The hot backup requires the database to operate in the ArchiveLog mode and require a lot of file space. Once the database is running in ArchiveLog, you can make a backup. The command file of the hot spare is consisting of three parts:

---- 1. Data file A tablespace backup backup.

---- (1) Setting the table space for backup status

---- (2) Data file of backup table space

---- (3) The recovery table space is normal

---- 2. Backup archive log file.

---- (1) temporarily stop archiving process

---- (2) Log under the file in the Archive Redo Log Target Directory

---- (3) Restart the Archive process

---- (4) Backup archived redo log file

---- 3. Use the alter database backup controlfile command to back up the copy file

---- The advantage of hot backup is:

---- 1. The backup time is short in the table space or data file level backup.

---- 2. The database can still be used when backed up.

---- 3. Can reach second level recovery (restored to a point in time).

---- 4. Almost all database entities can be recovered.

---- 5. Recovery is fast, and in most cases, it is restored when the database is still working.

---- Insufficient thermal backup is:

---- 1. Can't go wrong, otherwise the consequences are serious.

---- 2. If the hot backup is unsuccessful, the result is not available for time point recovery.

---- 3. Because it is difficult to maintain, it is necessary to carefully carefully, and "endlessly end" is allowed. "

转载请注明原文地址:https://www.9cbs.com/read-119647.html

New Post(0)