Rman quick technical query manual

Source: Internet
Author: User

I. backup solution:
Multi-level backup is used to reduce the time required for recovery and the time required for daily backup, while ensuring that the system recovers well.
The following is a recommended solution:

Full backup of a database every six months (including read-only tablespace)
Perform a zero-level backup every month (excluding the read-only tablespace)
Perform a level-1 backup every week
Perform a secondary backup every day
After any tablespace is changed to the read-only status, a backup of the tablespace is made.
Back up archive files when necessary (for example, the four-hour archive file system is near full)
1. database full backup script:
Run {
Allocate channel c1 type disk;
Backup full tag 'dbfull' format'/opt/backup/full _ % d _ % U' (database include current controlfile );
SQL 'alter system archive log current ';
Backup format '/opt/backup/archivelog _ % d _ % U' (archivelog all );
Release channel c1;
}
2. Zero-level backup:
Run {
Allocate channel c1 type disk;
Backup incremental level 0 filesperset 5 tag 'db0' format'/opt/backup/ora_0 _ % d _ % U' (database include current controlfile );
SQL 'alter system archive log current ';
Backup format '/opt/backup/archivelog _ % d _ % U' (archivelog all );
Release channel c1;
}
3. Primary backup:
Run {
Allocate channel c1 type disk;
Backup incremental level 1 filesperset 5 tag 'dbl1 'format'/opt/backup/ora_0 _ % d _ % U' (database include current controlfile );
SQL 'alter system archive log current ';
Backup format '/opt/backup/archivelog _ % d _ % U' (archivelog all );
Release channel c1;
}
4. Secondary backup:
Run {
Allocate channel c1 type disk;
Backup incremental level 2 filesperset 5 tag 'dbl2 'format'/opt/backup/ora_0 _ % d _ % U' (database include current controlfile );
SQL 'alter system archive log current ';
Backup format '/opt/backup/archivelog _ % d _ % U' (archivelog all );
Release channel c1;
}
5. tablespace backup script (using users tablespace as an example ):
Run {
Allocate channel c1 type disk;
Backup tag 'tsusers' format'/opt/backup/ora_0 _ % d _ % U' tablespace users;
SQL 'alter system archive log current ';
Backup format '/opt/backup/archivelog _ % d _ % U' (archivelog all );
Release channel c1;
}
6. archive file backup script:
Run {
Allocate channel c1 type disk;
Backup format '/opt/backup/archivelog _ % d _ % U' (archivelog all );
Release channel c1;
}
Ii. RMAN recovery case
1. All data files are lost. Control Files and log files must exist.

Simulate medium corruption: delete all dbf Files
Start Database: startup mount
Recovery statement:
Run {
Allocate channel c1 type disk;
Restore database;
Recover database;
SQL 'alter database open ';
Release channel c1;
}
Note: Oracle will never back up the TEMPORARY tablespace that uses TEMPORARY files, because TEMPORARY tablespace only contains TEMPORARY
You do not have to restore the data. However, after restoration, the data dictionary still contains information about the temporary tablespace.
Simply recreate a temporary tablespace, set it as the default temporary tablespace, and then delete the previous Temporary tablespace.
SQL> create temporary tablespace temp2 tempfile 'd: oracleoradataoradbtemp02.dbf 'size 100 M;
SQL> alter database default temporary tablespace temp2;
SQL> drop tablespace temp including contents and datafiles;
2. Restore Lost non-system data files
Simulated media corruption: Delete the users01.dbf File
Start Database: startup mount
Recovery statement:
Run {
Allocate channel c1 type disk;
SQL 'alter tablespace users offline ';
Restore tablespace users;
Recover tablespace users;
SQL 'alter tablespace users online ';
Release channel c1;
}
3. Lost all data files, control files, and log file recovery

Note: configure controlfile autobackup on is configured during Backup;

[Oracle @ Linux1 rman_backup] $ rman target/
RMAN> set DBID = 285819149
RMAN> restore controlfile from autobackup (you can also: restore controlfile from 'file name ');
Start Database: startup mount
Recovery statement:
Run {
Allocate channel c1 type disk;
Restore database;
Recover database;
SQL 'alter database open resetlogs ';
Release channel c1;
}
4. Incomplete recovery

A. Incomplete recovery based on time points:
RUN {
Allocate channel c1 type disk;
Set until time = '2017-12-09: 11: 44: 00 ';
Restore database;
Recover database;
SQL 'alter DATABASE OPEN resestlogs ';
Release channel 1;
}
B. Incomplete recovery based on log sequences:
RUN {
Allocate channel c1 type disk;
Set until sequence 120 THREAD 1;
Restore database;
Recover database; # recovers through log 119
SQL 'alter DATABASE OPEN resestlogs ';
Release channel 1;
}
C. Incomplete SCN-based recovery:
RUN {
Allocate channel c1 type disk;
Set until scn = 100145;
Restore database;
Recover database;
SQL 'alter DATABASE OPEN resestlogs ';
Release channel 1;
}
D. Incomplete recovery based on cancel:
RUN {
Allocate channel c1 type disk;
Restore database;
Recover database until cancel;
SQL 'alter DATABASE OPEN resestlogs ';
Release channel 1;
}
Iii. Maintenance of RMAN is mainly divided into several aspects
1. View RMAN Information
Check Existing backup
RMAN> list backup
List expired backups
RMAN> report obsolete
Delete expired backups
RMAN> allocate channel for maintenance type disk;
RMAN> change backupset id delete;
RMAN> release channel;
Delete all expired backups
RMAN> delete obsolete;

2. Synchronize or reset RMAN

If the physical object of the target database changes, such as adding a data file, use the following command for synchronization:
RMAN> resync catalog;
If the target database resets the database, use the following command to synchronize
RMAN> reset database;

After you manually delete the database archive files, execute the following script for synchronization:
RMAN> allocate channel for maintenance type disk;
RMAN> change archivelog all crosscheck;
RMAN> release channel;

After the RMAN backup of the database is manually deleted, execute the following script for synchronization:
RMAN> allocate channel for maintenance type disk;
RMAN> crosscheck backup;
RMAN> delete expired backup;
RMAN> release channel;

Author: "Rman full Backup Recovery"

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.