RMAN
Configuration
$ rman target/or Rman target Sys/[email protected]
Rman> Show All; all backup Related Settings
Rman> CONFIGURE controlfile autobackup on;
Rman> CONFIGURE controlfile autobackup Clear;
rman> backup tablespace users; To back up a table space user
rman> list backup; View List
Sql> Desc V$backup_set Browser can also view
Automatic channel management:
rman> CONFIGURE DEVICE TYPE DISK PARALLELISM 2;
Rman> Backup tablespace users, example;
$ mkdir/home/oracle/disk1/home/oracle/disk2
Rman> Configure Channel 1 device type disk to destination '/home/oracle/disk1 ';
Rman> Configure Channel 2 device type disk to destination '/home/oracle/disk2 ';
Rman> Backup tablespace users, example;
Restore default
rman> CONFIGURE DEVICE TYPE DISK Clear;
rman> CONFIGURE CHANNEL 1 Device type disk clear;
rman> CONFIGURE CHANNEL 2 device type disk clear;
Manual channel Management:
Rman> Run {
Allocate channel C1 device type disk to destination '/home/oracle/disk1 ';
Allocate channel C2 device type disk to destination '/home/oracle/disk2 ';
Backup tablespace users, example;
Or
Backup (tablespace users channel C1) (tablespace example channel C2);
}
Backup section size 500M datafile 1;
Specify the backup format:
rman> backup tablespace users; Backup Set BS
Rman> Backup as compressed backupset tablespace users;
rman> Backup as copy tablespace users; mirrored backups
Rman> list Backup of tablespace users;
rman> list copy of tablespace users;
Encryption for backup:
RMAN
Backup
Do not archive archives
Online offline online offline
Complete part complete part complete part complete part
Shutdown Nomount Mount Open
To back up a data file:
Sql> Select file_id, file_name from Dba_data_files;
rman> backup DataFile 4;
Rman> backup DataFile 4, 5;
rman> backup datafile '/u01/app/oracle/oradata/orcl/users01.dbf ';
rman> backup tablespace users; (logic)
Rman> Backup tablespace users, example;
rman> backup Database;
rman> list backup;
Desc V$backup_set, Browser view backup
Incremental backup: Changes in Backup data
Rman> Backup Incremental level 0 tablespace users;
Rman> list Backup of tablespace users;
sql> CREATE TABLE t1 (x int) tablespace users;
sql> INSERT INTO T1 values (1);
Sql> commit;
Rman> Backup Incremental Level 1 tablespace users;
Rman> Backup Incremental Level 1 tablespace users;
Sql> CREATE TABLE t2 (x int) tablespace users;
sql> INSERT INTO T2 values (1);
Sql> commit;
Rman> Backup Incremental Level 1 cumulative tablespace users;
Rman> list Backup of tablespace users;
Turn on block tracking:
Sql> ALTER DATABASE enable block change tracking using file '/home/oracle/blk_trk.chg ';
Need to reconnect session
Sql> select * from v$block_change_tracking;
Sql> Select Datafile_blocks, Blocks_read, BLOCKS, used_change_tracking from V$backup_datafile where Incremental_ level>0;
sql> CREATE table t3 (x int) tablespace users;
sql> INSERT into T3 values (1);
Sql> commit;
Rman> Backup Incremental Level 1 tablespace users;
Sql> Select Datafile_blocks, Blocks_read, BLOCKS, used_change_tracking from V$backup_datafile where Incremental_ level>0;
Sql> ALTER DATABASE disable block change tracking; Shut down
Incremental update:
sql> CREATE TABLE t1 (x int) tablespace users;
sql> INSERT INTO T1 values (1);
Sql> commit;
Rman> Backup incremental Level 1 for recover of the copy with tag ' update_copy ' tablespace users; The first time you create a level 0 backup
rman> list copy; Record time and SCN
sql> INSERT INTO T1 values (2);
Sql> commit;
Rman> Backup incremental Level 1 for recover of the copy with tag ' update_copy ' tablespace users; The 2nd time a Level 1 backup was created
rman> list backup; Backupset format
rman> recover copy of tablespace users with tag ' update_copy ';
rman> list copy; Time and SCN updates
Script form:
Rman> Run {
Backup incremental Level 1 for recover of the copy with tag ' update_copy ' tablespace users;
Recover copy of tablespace users with tag ' update_copy ';
}
Backup Archive log:
rman> list Archivelog all;
rman> Backup Archivelog all delete all input;
rman> list Archivelog all;
rman> list backup;
Maintenance of Backup:
View:
rman> list backup;
rman> list copy; mirror copy
Rman> list Backup of tablespace users; table space corresponding data file
Rman> list Backup of datafile 4;
rman> list archivelog all; archive log
Check Backup:
rman> Delete backup; Delete a backup
rman> Delete copy;
rman> list backup; List copy;
Rman> report need backup; Based on policy checks
rman> backup tablespace users;
Rman> report need backup;
Rman> CONFIGURE RETENTION POLICY to redundancy 2;
Rman> report need backup;
Rman> CONFIGURE RETENTION POLICY Clear;
Rman> report obsolete; redundant >1
To delete a backup:
rman> Delete Backupset of tablespace users;
rman> Delete backupset 1234;
rman> backup tablespace users;
rman> backup tablespace users;
Rman> Show All;
rman> Delete obsolete;
Crosscheck: Cross Check
rman> Delete backup;
rman> backup tablespace users;
Rman> list Backup of tablespace users;
$ mv/u01/app/oracle/fast_recovery_area/orcl/backupset/... Renamed
rman> restore DataFile 4; Error
Rman> crosscheck Backup;
Rman> list Backup of tablespace users; Scrap status
rman> list expired backup;
$ mv/u01/app/oracle/fast_recovery_area/orcl/backupset/... Restore formerly known
Rman> crosscheck Backup;
Rman> list Backup of tablespace users; Available status
rman> Delete expired backup; Delete Scrap status
Catalog
$ cp/u01/app/oracle/fast_recovery_area/orcl/backupset/... Copy
rman> Delete backup;
rman> list backup; Backupset disappears
$ mv/u01/app/oracle/fast_recovery_area/orcl/backupset/... Restore formerly known
rman> Catalog Recovery area noprompt; Quick Recovery Zone
rman> list backup; backupset Recovery
Oracle Classroom essay----Day 23rd