oracle11g Hot and cold backup

Source: Internet
Author: User

1. Cold Backup

If the database shuts down gracefully and allows it to be shut down for long enough, cold backups (offline backups) can be either archived cold backups or non-archived cold backups. The method is to first close the database and then back up all the physical files, including data files, control files, online redo log files, and so on.

The steps for a cold database backup in a sql*plus environment are as follows:

(1) Start the Sql*plus, log in as SYSDBA identity database.

(2) Querying the location of all data files, control files, and online redo log files of the current database.

Sql>select file_name from Dba_data_files;

Sql>select member from V$logfile;

Sql>select value from V$parameter WHERE name= ' control_files ';

(3) Close the database.

Sql>shutdown Immediater

(4) Copy all data files, online redo log files, and control files to the backup disk. You can use copy and paste directly in the operating system, or you can do this using the following operating system commands:

Sql>host COPY Original file name destination path name

(5) Restart the database

Sql>startup

Cold Backup Advantages:

Just copy the file and it's a very fast backup method.

Simply copy the file back and you can restore it to a point in time.

The combination of a database archiving pattern allows the database to recover well.

Less maintenance, but relatively high security.

2. Hot Backup

Although cold backup is simple and fast, in many cases, such as when the database is running in the 24*7 state (24 hours a day, 7 days a week), there is not enough time to shut down the database for cold backups, only hot backups can be used.

A hot backup is a backup of a database's data files, control files, archived log files, and so on in archive mode.

The steps to perform a full database hot backup in a sql*plus environment are as follows:

(1) Start the Sql*plus, log in as SYSDBA identity database.

(2) Set the database to archive mode.

Because a hot backup is a backup of the database in archive mode, it is necessary to ensure that the database is already in archive mode before a hot backup. You can execute the Archive log List command to see if the current database is in archive log mode. If you are not in archived log mode, you need to first convert the database to archive mode and start AutoArchive.

(3) The data file is backed up in table space.

① See what table spaces are available in the current database, and what database files are in each table space.

Sql>select Tablespace_name,file_name from Dba_data_files

ORDER by Tablespace_name;

② the data files in each table space, respectively, by:

    1. Set the table space that you want to back up, such as users, to the backup state.

Sql>alter tablespace USERS BEGIN BACKUP;

    1. Copy all data files in the tablespace to the backup disk.

Sql>host COPY

E:\app\admin\product\11.2.0\dbhome_1\oradata\ORCL\USERS01. Dbf

E;\app\admin\backup\users01. Dbf

    1. Ends the backup state of the tablespace.

Sql>alter tablespace USERS END BACKUP;

Use this step for each of the table spaces in the database for backup.

(4) Backup control files

It is usually necessary to back up the control files after the database physical structure has been modified, such as adding, deleting, or renaming data files, adding, deleting, or modifying tablespaces, adding or removing redo log files and redo log file groups, and so on.

① back up the control file as a binary file.

Sql>alter DATABASE BACKUP controlfile to ' E;\app\admin\backup\control. BKP ';

② back up the control file as a text file.

Sql>alter DATABASE BACKUP controlfile to TRACE;

(5) Back up other physical files

① Archives The current online redo log file.

Sql>alter SYSTEM ARCHIVE LOG current;

Archive the current online redo log file, or you can do it through log switching.

Sql>alter SYSTEM SWITCH LOGFILE;

② Backup archive redo log files and copy all archived redo log files to the backup disk.

③ The backup initialization parameter file and copies the initialization parameter file to the backup disk.

oracle11g Hot and cold backup

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.