Script configuration for Oracle RMAN backup [reprinted]

Source: Internet
Author: User

1. Backup;

1: connect to the target database:

RMAN> connect target sys/sysray @ dB or RMAN target = sys/sysray @ DB


2: query the configuration of the target database;

RMAN> show all;

Modify the configuration as follows:

Configure retention policy to redundancy 1; # default
Configure backup Optimization on;
Configure Default device type to disk; # default
Configure controlfile autobackup on;
Configure controlfile autobackup format for device type disk to 'f: rman_back % F'; # default
Configure device type disk parallelism 1; # default
Configure datafile backup copies for device type disk to 1; # default
Configure archivelog backup copies for device type disk to 1; # default
Configure Channel 1 device type disk format "F: rman_back % u ";
Configure maxsetsize to unlimited; # default
Configure snapshot controlfile name to 'f: rman_backsncfraydb.ora ';

3: backup control and data files

RMAN> backup database;

4. Back up log files;

RMAN> Backup archivelog all Delete input;

Ii. Recovery:

1: first, run the database in the 'mounted' mode;

SQL> shutdown immediate;

SQL> startup Mount;

SQL> select status from V $ instance;

2: RMAN> Restore database;

3: RMAN> recover database;

The database is successfully restored;

SQL> alter database open;

OK;

<2>: backup and recovery of tablespaces. The database must work in the archive log mode;

1: tablespace backup;

RMAN> Backup (tablespace users include current controlfile );

2. Back up archived logs;

RMAN> Backup (archivelog all Delete input );

3: tablespace recovery;

3.1: The tablespace is offline;

RMAN> SQL 'alter tablespace users offline immediate ';

3.2: Restore the data file to which the tablespace belongs;

RMAN> restore (tablespace users );

3.3: tablespace recovery process;

RMAN> recover tablespace users;

3.4: Table space online process;

RMAN> SQL 'alter tablespace users online ';

<3>: backup and recovery of data files; the database must work in the archive log mode;

1. Back up data files;

RMAN> Backup (datafile 'd: oracleoradatadbnameusers01.dbf ');

2. Back up all archived log files;

RMAN> Backup (archivelog all Delete input );

3: data file recovery;

3.1: remove the tablespace users to which the data file belongs;

RMAN> SQL 'alter tablespace users offline immediate ';

3.2: process of restoring data files;

RMAN> restore (datafile 'd: oracleoradatadbnameusers01.dbf ');

3.3: data file recovery process;

RMAN> recover datafile 'd: oracleoradatadbnameusers01.dbf ';

3.4 The tablespace to which the data file belongs is online;

RMAN> SQL 'alter tablespace users online ';

OK;

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.