The Oracle database has three standard backup methods, which are exported / imported (Exp / IMP), hot backup, and cold backups, respectively. Export spare parts 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 to the Oracle database using Import.
1. Simple export data (export) and import data (import)
Oracle supports the output of three ways:
(1), the table mode (T method) exports the data of the specified table.
(2), user mode (U mode), export all objects and data of the specified user.
(3), the full storage method (Full mode), all objects in the database.
The process of data import (import) is the inverse process of the data export, which imports the data file into the database and exports the database data to the data file.
2, incremental export / import
Incremental export is a commonly used data backup method, which can only be implemented throughout the database and must be used 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 (Complete)
That is, backup three databases, such as:
Exp System / Manager InctYpe = COMPLETE FILE = 040731.dmp
(2), "incremental" incremental export
By backing up the data after backup, such as:
Exp System / Manager incy = incremental file = 040731.dmp
(3), "accumulated" incremental export
The cumulative export method is to export information that changes in the database since the last "complete" export. such as:
Exp system / manager incy = cumulative file = 040731.dmp
Database administrators can schedule a backup schedule that is reasonably and efficiently completed by three different ways to export data.
For example, the blind task of the database can be arranged as follows:
Monday: Complete Backup (a)
Tuesday: Increment Export (B)
Wednesday: Increment Export (C)
Thursday: Incremental Export (D)
Friday: Accumulated Export (E)
Saturday: Increment Export (F)
Sunday: Incremental Export (G)
If the database is unexpectedly destroyed on Sunday, the database administrator can follow the steps to reply the database:
The first step: regenerate the database structure with the command Create Database;
Step 2: Create a big enough rollback.
Step 3: Full incremental import A:
IMP system / manager incy = restore full = y file = a Step 4: Cumulative incremental Import E:
IMP system / manager incy = restore full = y file = e
Step 5: Recent incremental import f:
IMP system / manager incy = restore full = y file = f
Second, cold backup
The cold backup occurs in the case where the database has been properly closed, and it will be given to us a complete database when properly turned off. A key file is copied to another position when a cold backup is in a cold backup. For backup Oracle information, the fastest and secure method when cold backup. 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 archiving method, do the recovery of the "best state" of the database.
5, low maintenance, high security.
But the cold backup also has the following deficiencies:
1. When used alone, only the recovery of "a certain point in time" is available.
2. In the full process of the backup, the database must be prepared and cannot do other jobs. 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 not be restored in the form or by user.
If possible (mainly efficient), the information should be backed up to the disk, then start the database (can operate) and copy the backup information to the tape (copy, the database can work). 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.
The following is a complete example of a cold backup.
(1) Turn off the database
SQLPlus / NOLOG
SQL> Connect / as sysdba
SQL> Shutdown Normal;
(2) Back up all of the time files, redo log files, control files, and initialize parameter files
SQL> CP
(3) Restart Oracle Database
SQL> Startup
Third, hot spare
Thermal backup is a method of backing up the database with the ArchiveLog Mode mode with 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 table space backup of a table space.
(1) Set the table space to back up status
(2) Data file of backup table space
(3) Reply table space is normal
2. Backup Archive Log file (1) temporarily stop archiving process
(2) Log under the file in the Archive Rede Log Target Directory
(3) Restart the Archive process
(4) Backup archived redo log file
3. Back up the control file with the alter Database Bachup ControlFile command
The advantage of hot backup is:
1. You can back up in a table space or database file level, and the backup time is short.
2. The database can still be used when backed up.
3. Can reach second level recovery (restored to a point in time).
4. Restore almost all database entities
5. Recovery is fast, and in most cases, the database is still restored.
The lack of hot spare is:
1. Can't go wrong, otherwise the consequence is 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 and do not allow "failure to end".