12. Backup and recovery ing

Source: Internet
Author: User


To connect to the target database:
1. Enter the command: Rman target sys/nocatalog.
2, after the Rman command: Connect target sys/[email PROTECTED]/ORCL [email protected] followed by the network address to access the remote database.


DOS console input: Show all; View Rman configuration parameters.
Modifying parameters with the Configure command (restore default values by using the Clear keyword)
Configure retention policy clear; --Restore Default

list backup of database; --View the established backup sets and backup fragments.
List backup of tablespace tablespace_name; --Table space backup information view.
List backup of Controlfile; --Control The backup information of the file.
List backup of Archivelog all; --Archive log file backup information.

First, backup

1. Manual channel Assignment
Input script in Rman

run{
Allocate channel CH1 device type disk
format= ' D:\oracle_bak\rmanBakTest\Jangle_%Y_%M_%D '
Backup tablespace jangle channel CH1;
}


2. Automatic channel allocation
Backup tablespace jangle;
When this command is entered, it is backed up according to the parameters of the Rman configuration. The default path for 11g is
: \app\jangle\flash_recovery_area\orcl\backupset\2016_04_25
It establishes the instance name folder in the Flashback directory, and then establishes the Backupset folder, under which the Date folder is established.
Backup [Database|tablespace tbs_name] {format= ' d:\ ... '}--Full database backups



3, do not close the database when the backup, but also the current redo log to be archived
SQL ' alter system archive log current '; --Commands in Rman.

4. Backup control files
Backup current controlfile;
You can also add the following to the backup database or table space by using the include current CONTROLFILE clause:
Backup tablespace tbs_name include current controlfile;
List backup of Controlfile; --View Control file backup information

5. Backup Archive Redo Log
Backup Archivelog All {delete all input}; --{}, the archive redo log is deleted after the backup is complete.
Backup Archivelog from time ' sysdate-8 ' until time ' sysdate-1 '; --Back up the archive log a week ago.
List backup of Archivelog all; --View archived log backup information.

You can also make a backup of the archive redo log by adding the plus archivelog clause to the back of the backup database or table space:
Backup Database plus archivelog;


Comprehensive:
Backup [database|tablespace Tbs_name] include current controlfile plus archivelog;--backup database or tablespace to back up both its control files and archived log files.

6. Multiple backups (that is, multiple copies of the backup are put into different directories (disks))
Backup copies 2 tablespace jangle
Format ' D:\. Bk_%d_%c.bak ', ' d:\.        Bk_%d_%c.bak '; -Where tablespace jangle can be replaced by database.

7. Incremental backup
Backup incremental level=0 [cumulative]
Format ' D:\\...%y_%m_%d_%c.bak '
Tablespace jangle; --cumulative is specified as a cumulative incremental backup. Not specified as a differential incremental backup. Level 0 is the first backup, full backup.

Differential incremental Backup: Backup is based on a previous backup of the same or lower level.
Cumulative Incremental Backup: Backup is based on a lower level of previous backup (so the cumulative backup consumes more storage, but restores faster than a differential incremental backup.) )

Note: In non-archive mode, you can only close the database before you can make an incremental backup.



Second, recovery
Restore [Database|tablespace tbs_name|datafile]; --For a database that is not in archive mode, only the previously backed up database can be restored.
recover [Database|tablespace tbs_name |datafile]; --For the archive mode of the database, this restore will require a recovery operation. The archive log is used here to recover data to recover to the state when the database is damaged.


In addition, there are:
Restore [Controlfile to | archivelog all]; --Restore the control file and archive the log file. (It is common to use compound control files for disaster recovery and can no longer be backed up.) )

2.1. Incomplete recovery based on event
Restores the database to a state before a specified time.
1, the first offline backup (shut down the database), the backup control file of all compliance, data files, archived redo log files, the reverse is not a complete recovery failure.
2. Boot to Mount State
3.

12. Backup and recovery ing

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.