What is the difference between a cold backup and a hot backup Oracle?

Source: Internet
Author: User
Tags one table require create database oracle database

For an Oracle database tutorial, only physical and logical backups

Physical Backup: A backup process that copies the operating system files that actually make up the database from one place to another, usually from disk to tape.

Logical backup: Is the process of extracting data from a database in a SQL language and coexisting it in a binary file.

The first class is a physical backup, which implements a complete recovery of the database, but the database must run in the back-block mode (the business database runs in non-return mode) and requires significant external storage devices such as tape libraries, including cold and hot backups. Cold and hot backups are physical backups (also called low-level backups) that involve the files that make up the database, but do not consider logical content.

The second type of backup is a logical backup, the business database in this way, this method does not require the database to run in the return mode, not only simple backup, but also can not require external storage devices, including export/import (Export/import). This method involves reading a series of database logs and writing them to the file, which is independent of the location of the log reads.

(i), export/import (Export/import)

Export can be used to extract data from the database, the use of import can be extracted from the data returned to the Oracle database.

1, simple Export data (export) and imported data (import)

Oracle supports three types of output:

(1) The table method (t), which exports the data from the specified table.

(2) User mode (U), which will specify all objects and data exported by the user.

(3) Whole library (full mode) to export all objects in the database.

The process of data export (import) is the reverse process of data importing (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.

An incremental export consists of three types:

(1) "Full" incremental export (Complete)

That is, back up the entire database, for example:

$exp System/manager Inctype=complete file=990702.dmp

(2) "Incremental" incremental export

Backs up data that was changed since the last backup. Like what:

$exp System/manager inctype=incremental file=990702.dmp

(3) "Cumulative" incremental export (cumulative)

The cumulative export method simply exports 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.

For example, a database backup task 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:

Step one: Use the command create database to regenerate the databases structure;

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

Fifth Step: Recent incremental import F:

$imp System/manager Inctype=restore full=y file=f
  
  
(b), cold backup

Cold backup occurs when the database has been shut down properly and provides us with a complete database when it shuts down properly. 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.

However, cold backup also has 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, then start the database (so that the user can work) and copy the backed-up information to tape (while the database can work). 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 be done in the case of a database shutdown and that performing a database file system backup is not valid when the database is open

Here is a complete example of doing a cold backup:

(1) Close the database $sqldba lmode=y

SQLDBA >connect Internal;

Sqldba >shutdown Normal;

(2) use copy command to back up all time files, redo log files, control files, initialization parameter files

SQLDBA >! CP < file > < backup directory >

(3) Restart Oracle database

$SQLDBA Lmode=y

SQLDBA >connect Internal;

SQLDBA >startup;

(iii), 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.

The requirements for hot backup are:

1. Hot backup must require the database to operate in a archivelog mode, in SQLDBA state with ALTER DATABASE Archivelog|noarchivelog command to change the mode of backup.

2. Hot backup can only happen if the database is not used or the usage rate is low.

3. Hot backup requires a large amount of file space.

In general, Oracle writes the online redo log file in a circular fashion, writes the second after filling the first redo log file, until the last one is filled, and the background process LGWR the first, in Archivelog mode, Background process Arch before each redo log file is overwritten, make a copy of it, in general, the Redo log files of these documents are written to disk or tape. If you have enough disk space, it is recommended that you use a disk, which greatly reduces the time required to complete the backup.

Setting the Log_archive_start to true in the Config.ora file before making a hot backup will log_archive_dest once the database runs 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 archiving process

(2) The files in the archive redo log target directory under log

(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 shortage of hot backup is:

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".

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.