oracle| Backup | recovery | data | database
Oracle database Backup and Recovery
----When we use a database, always want the content of the database is reliable, correct, but due to computer system failures (including machine failure, media failure, misoperation, etc.), the database can sometimes be destroyed, 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.
----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 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 to restore the "latest state" of the database.
----5. Low maintenance, high safety.
----But cold backups also have the following disadvantages:
----1. When used alone, it can only provide a recovery at a point in time.
----2. In the 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. You cannot restore 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:
----1. The data file is backed up in a tablespace in one table space.
----(1) Set table space to backup state
----(2) data files for the backup table space
----(3) Restore the table space to a normal state
----2. Back up the archive log file.
----(1) Temporarily stop the archive process
----(2) Log the files in the archive redo log target directory
----(3) Restart the archive process
----(4) Backup archived redo log files
----3. Backing up copy files with the ALTER DATABASE backup Controlfile command
The advantages of----hot backup are:
----1. Can be backed up at the table space or data file level for short backup time.
----2. The database is still available for backup.
----3. Can reach a second level recovery (revert to a point in time).
----4. Almost all database entities can be recovered.
----5. Recovery is quick and, in most cases, restored when the database is still working.
The disadvantages of----hot backup are:
----1. There is no mistake, otherwise the consequence is serious.
----2. If a hot backup is unsuccessful, the resulting results are not available for point-in-time recovery.
----3. Because it is difficult to maintain, so be particularly careful, do not allow "failure to end".
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.