Create an Rman backup to restore the catalog database

Source: Internet
Author: User
Tags time interval

This is a time ago to the customer to do the Rman backup strategy, there is time to sort out today, I hope that some help, if there is no place to welcome everyone to give advice, thank you!



Create a Recovery catalog database

If the Rman recovery catalog is not configured locally,

To install an Oracle database on a WINDOW2000 computer, it is best to ensure that the database version is the same as the version of the target database.

Create Rman database users and table spaces:

RECOVER CATALOG table Space (CATTBS): 1G
system table Space: 100M
Undo Table Space: 100M
Temporal tablespace (temp): 100M

Create the Rman user and grant permissions with the following command:

Create user Rman identified rman default tablespace cattbs temporary tablespace temp;


To grant permissions:
Grant Connect, resource to Rman;
Grant Recovery_catalog_owner to Rman

To create a recovery directory:

Enter RMN If the recovery directory is not on the same machine as the target database, use the following:


Rman catalog Rman/[email protected]

rman> Create Catalog

C:/rman target Sys/[email protected] Catalog Rman/rman
rman> Register database;



If you want to re-register, query the data dictionary db to get Db_key and db_id execute dbms_rcvat. The Unregisterdatabase command cancels the registration. Re-enroll.

Sql> Conn Rman/rman

Sql> select * from DB;


sql> exec dbms_rcvcat.unregisterdatabase (db_key,db_id);



rman> Resync Catalog;

Make a full backup of the database every six months (including read-only tablespace)
Do a 0-level backup every month (does not include read-only tablespace)
Make one level backup every week
Make a level two backup every day


Database Full backup script:
Run {
Allocate channel C1 type disk;
Allocate channel C2 type disk;
Allocate channel C3 type disk;
Backup full tag ' dbfull ' format '/backup/ncfc/full%d_%p_%t ' database;
SQL ' alter system archive log current ';
Backup Format/backup/ncfc/dbl0/dbl0%d_%p_%t.arc ' Filesperset 5 archivelog all delete input;
Release channel C1;
Release channel C2;
Release channel C3;
}



Level 0 Backup script (except read-only table space)
Run {
Allocate channel C1 type disk maxpiecesize =20g;
Allocate channel C2 type disk maxpiecesize =20g;
Allocate channel C3 type disk Maxpiecesize =20g;
Backup incremental Level 0 filesperset tag ' dbL0 ' format '/backup/ncfc/dbl0/dbl0%u_%p_%c ' database skip readonly;
SQL ' alter system archive log current ';
Backup format '/backup/ncfc/dbl0/arch%u_%p_%c.arc ' Filesperset 5 archivelog from time "sysdate-1" all;
Release channel C1;
Release channel C2;
Release channel C3;
}

First-level backup script
Run {
Allocate channel C1 type disk maxpiecesize =20g;
Allocate channel C2 type disk maxpiecesize =20g;
Allocate channel C3 type disk Maxpiecesize =20g;
Backup Incremental Level 1 Filesperset 5 tag ' dbL1 ' format '/backup/ncfc/dbl1/dbl1%d_%p_%t ' ddatabase skip readonly;
SQL ' alter system archive log current ';
Backup format '/backup/ncfc/dbl1/dbl1%d_%p_%t.arc ' Filesperset 5 archivelog from time "sysdate-1" all;
Release channel C1;
Release channel C2;
Release channel C3;
}

Secondary backup scripts
Run {
Allocate channel C1 type disk maxpiecesize =20g;
Allocate channel C2 type disk maxpiecesize =20g;
Allocate channel C3 type disk Maxpiecesize =20g;
Backup Incremental Level 2 Filesperset 5 tag ' dbL2 ' format '/backup/ncfc/dbl2/dbl2%u_%p_%c ' ddatabase skip readonly;
SQL ' alter system archive log current ';
Backup format '/backup/ncfc/dbl2/dbl2%d_%p_%t.arc ' Filesperset 5 archivelog from time "sysdate-1" all;
Release channel C1;
Release channel C2;
Release channel C3;
}


Archive file Backup script
Run {
Allocate channel DEV1 type disk maxpiecesize =20g;
Allocate channel DEV2 type disk maxpiecesize =20g;
Allocate channel DEV3 type disk maxpiecesize =20g;
SQL ' alter system archive log current ';
Backup format '/backup/ncfc/arc/arch%u_%p_%c ' Archivelog from time "sysdate-1" all;
Release channel Dev1;
Release channel Dev2;
Release channel Dev3;
}


Tablespace backup script (take the Users table space as an example)
Run {
Allocate channel C1 type disk;
Allocate channel C2 type disk;
Allocate channel C3 type disk;
Backup tag ' tabsp ' format '/backup/ncfc/tabsp/tabsp%u_%p_%c ' tablespace users;
SQL ' alter system archive log current ';
Backup format ' E:\oradata\%d_%p_%t.arc ' filesperset 5 archivelog all delete input;
Release channel C1;
Release channel C2;
Release channel C3;
}


The amount of data that needs to be backed up every day is only a change of one day. When doing recovery, you can restore up to one level 0 backup of the month + three level backup + 6 level Two backup + archive of the day. If this recovery time is not acceptable, you can only reduce the time interval between level 0 backups (such as a level 0 backup per week so that you can recover up to one weeks of data).

Backing Up the Catalog database (database logic output)
Exp Pafile=exp.dat
Where Exp.dat are as follows
Userid=rman/rman
File=rmanexp.dmp

Create an Rman backup to restore the catalog database

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.