When we use a database, always want the content of the database is reliable, correct, but because of computer system failures (including machine failure, media failure, misoperation, etc.), the database may also be damaged, then how to recover data as soon as possible is a top priority. If you make a backup of your database at the usual time, it's easy to recover the data at this point. This shows that a good database backup is how important, the following author to ORACLE7 as an example, to tell about the database backup and recovery. ORACLE databases have three standard backup methods, export/import (Export/import), cold backup, hot backup, respectively. Export backup is a logical backup, and cold and hot backups are physical backups.
----One, export/import (Export/import)
----uses export to extract data from the database, and import can be used to send the extracted data back to the Oracle database.
----1. Simple Export data (export) and imported data (import)
----Oracle supports three types of output:
----(1) Table method (t), the data for the specified table is exported.
----(2) User Way (U), all objects and data of the specified user are exported.
----(3) whole library (full) to export all objects in the database.
The process of----data export (import) is the reverse process of data import (export), and their data flow is different.
----2. Incremental Export/Import
----Incremental export is a common method of data backup that can only be implemented for the entire database and must be exported as system. When making this export, the system does not require any questions to be answered. The export file name defaults to Export.dmp, and if you do not want your output file to be named Export.dmp, you must indicate the file name you want to use on the command line.
----Incremental export includes three types:
----(1) "Full" incremental export (Complete)
----Backup the entire database, for example:
----$exp System/manager inctype=complete file=990702.dmp
----(2) "Incremental" incremental export
----The data that was changed after the last backup was backed up. Like what:
----$exp System/manager inctype=incremental file=990702.dmp
----(3) "Cumulative" incremental export (cumulative)
----Cumulative export is simply exporting information that has changed in the database since the last "full" export. Like what:
----$exp System/manager inctype=cumulative file=990702.dmp
----The database administrator can schedule a backup schedule that is reasonably and efficiently done in three different ways of exporting data.
----such as database backup tasks can be arranged as follows:
----Monday: Full export (A)
----Tuesday: Incremental export (B)
----Wednesday: Incremental export (C)
----Thursday: Incremental export (D)
----Friday: Cumulative export (E)
----Saturday: Incremental export (F)
----Sunday: Incremental export (G)
----If the database is accidentally compromised in Sunday, the database administrator can restore the database by following these steps:
----The first step: to regenerate the database structure with command create DB;
----Step Two: Create a large enough additional back segment.
----Step Three: Full incremental import a:
----$imp System./manager inctype= rectore full=y file=a
----Step Fourth: Cumulative incremental import E:
----$imp System/manager inctype= rectore full=y FILE =e
----Step Fifth: Recent incremental import F:
----$imp System/manager inctype=restore full=y file=f
----Two, cold backup
----Cold backup occurs when the database has been shut down properly and provides us with a complete database when it shuts down. Cold backup is a way of copying critical files to a different location. Cold backup is the quickest and safest way to back up Oracle information. The advantages of cold backup are:
----1. Is a very fast backup method (just copy the file)
----2. Easy to file (simple copy)
----3. Easy to restore to a point in time (just copy the file back)
----4. Can be combined with the archiving method to make the database "up-to-date status" recovery.
----5. Low maintenance, high safety.
----But cold backups also have the following disadvantages:
----1. When used alone, the recovery can only be provided to "a certain point in time".
----2. In the entire process of implementing a backup, the database must be backed up without any other work. In other words, the database must be closed during a cold backup.
----3. If disk space is limited, it can only be copied to other external storage devices such as tape, which can be slow.
----4. Cannot be recovered by table or by user.
----if possible (primarily for efficiency), you should back up the information to disk and then start the database (so that the user can work) and copy the backed-up information to tape (and the database can work as well). Files that must be copied in a 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 cold backups must take place in the case of a database shutdown and that performing a database file system backup is not valid when the database is open
----Below is a complete example of doing a cold backup:
----(1) Close database $sqldba lmode=y
----SQLDBA >connect internal;
----SQLDBA >shutdown normal;
----(2) Backup all time files, redo log files, control files, initialization parameter files with copy command
----SQLDBA >! CP < file > < backup directory >
----(3) Restart Oracle database
----$SQLDBA Lmode=y
----SQLDBA >connect internal;
----SQLDBA >startup;
----Three, hot backup
----Hot backup is a way to back up data in Archivelog mode when the database is running. So if you have a cold backup last night and you have today's hot backup files, you can use this data to recover more information in the event of a problem. Hot backup requires the database to operate in Archivelog mode and requires a large amount of file space. Once the database is running in Archivelog state, it can be backed up. The command file for hot backup consists of three parts: