RMAN (recovery manager)
From Robs_Wiki
Contents
spool rman logging
rman> spool log to /home/oracle/rob/rman_output.log
enable rman tracing
-- option 1 [oracle@exa-dm1dbadm01 rob]$ rman debug trace=rman.trc log=rman.log [oracle@exa-dm1dbadm01 rob]$ connect target / -- etc. -- option 2 RMAN> alter session set sql_trace=true; using target database control file instead of recovery catalog Statement processed
rman settings
CONFIGURE CONTROLFILE AUTOBACKUP ON; CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/exa_zs01sn01/dbbackup1/shortterm/$P/AUTOBACKUP/%F';
rman backup statements
Level 0 backup:
RMAN> backup incremental level 0 database plus archivelog delete input;
rman backup deletion
-- delete archive log backups -- RMAN> delete backup of archivelog all;
rman crosscheck
- Crosschecks update outdated RMAN repository information about backups whose repository records do not match their physical status. For example, if a user removes archived logs from disk with an operating system command, the repository still indicates that the logs are on disk, when in fact they are not.
- If the backup is on disk, then the CROSSCHECK command determines whether the header of the file is valid. If the backup is on tape, then the command simply checks that the backup exists. The possible status values for backups are AVAILABLE, UNAVAILABLE, and EXPIRED.
-- crosscheck arhivelog backups RMAN> crosscheck archivelog all; -- crosscheck all backups RMAN> crosscheck backup -- crosscheck backupset backups only RMAN> crosscheck backupset; -- crosscheck datafile copies only RMAN> crosscheck copy;
rman list command
rman> list backup of archivelog all; . . . . BS Key Size Device Type Elapsed Time Completion Time ------- ---------- ----------- ------------ -------------------- 162778 130.38M DISK 00:00:30 10-OCT-2019 03:04:54 BP Key: 177777 Status: AVAILABLE Compressed: YES Tag: PROD_ARCH Piece Name: /rman/PROD/PROD_CA_BKP_nrudub9o_1_1.rmn List of Archived Logs in backup set 162778 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- -------------------- ---------- --------- 1 106278 11914088136535 10-OCT-2019 02:01:22 11914088411234 10-OCT-2019 02:13:34
rman restore command
Restore a set of archives
RMAN> run { restore archivelog from logseq=106276 until logseq=106282; }
rman complete recovery
Assuming the spfile and controlfile are already recovered:
rman> run { set until scn 129; restore database; recover database; alter database open resetlogs; }