22. Oracle RMAN fundamentals - sayanbhattacharya1234/Oracle_DBA GitHub Wiki

1. Learing Objects

understand> Explain RMAN backup repository,backup sets, backup pieces,image copies ,channels.

configure > review and set retention , control file autobackup,compression,channels.

operate > Run Full, Incremental , Archive log, COntrol-File , SPFILE backups.

Validate > monitor the jobs,crosscheck the metadata, confirm the recovery.

Safety > RMAN backup commands are generally safe , but deletion,encryption,retention ,destination change can effect the recoverability. never delete the backups or archive logs before confirmation done of backup status, requirments, and recovery objectives.

Rman backup repository > in oracle database , the RMAN BACKUP SET is the logical container of one or more physical files that is called BACKUP PIECES, and all of which are tracked and managed by RMAN BACKUP REPOSITORY.

so RMAN BACKUP REPOSITORY is the collection of metadata about your target database and its backups, RMAN uses this metadata to conduct a automated backup process, restoreation , and recovery operations.

BACKUP SETS > A backup set is the logical grouping of one or more files which are created during the rman backup commands.

BACKUP PIECES > A backup pieces is the actual OS physical files which are created in the original storage during backup process.

..

2. RMAN flowchart

3 . RMAN Repository Architechture

4. Core RMAN concept

Target Database = RMAN TARGET /

Recovery Catalog = RMAN CATALOG rman@RCAT

Channels = DEVICE TYPE DISK

Backup sets = BACKUP DATABASE

Backup pieces = db_123_1_1.bkp

Image Copy = BACKUP AS COPY DATABASE

Tag = TAG = 'WEEKLY_FULL_BACKUP'

Check point SCN = USING DURING RESTORE/RECOVER

Obsolete = REPORT OBSOLETE

Expired = LIST EXPIRED BACKUP

Available = STATUS 'A'

.

5. Backup types

Full backup [RMAN> backup database; ]

A full backup means it takes backup of all files block by block , but automatically an incremental level 0 or 1 backup unless maintioned

Incremental Level 0 [ RMAN> backup incremental level 0 database; ]

Incremental level 1 differential backup [ RMAN> backup incremental level 1 database; ]

Incremental level 1 Cumulative backup [ RMAN> backup incremental level 1 cumulative database tag 'level1_cumul'; ]

Compressed backupset [ backup as compressed backupset database tag 'comm_bkpset'; ]

Image copy [ RMAN> backup as copy database tag 'img_cpy';]

Archivedlog backup [RMAN> backup archivelog all tag 'archlog_bkp'; ]

.

6. Channel and device type

How to configure the default channel [ CONFIGURE DEVICE TYPE DISK CLEAR; ]

7. Retention

8. Views and commands

v$rman_status and v$rman_output

v$rman_backup_job_details

v$backup_set

v$backup_piece

v$backup_datafile

v$backup_redolog

v$controlfile_record_section

v$recovery_area_usage

show all

crosscheck

list

report

.

9. Connect to rman

first open a server database > then set environment > statup > !rman target /

10. Show all and review

show all;

11. Scenario 1 [ Configure RMAN for a standalone lab database ]

12. Fundamental backup commands

1. database backup = > backup database;

2. Database plus archivedlog = > backup database plus archivelog;

3. 0 level backup = > backup incremental level 0 database tag 'level0_bkp';

4. 1 level differential backup = > backup incremental level 1 database tag 'level1_bkp';

5. Controlfile = > backup current controlfile;

6. SPFILE = > backup spfile;

7. Tablespace => backup tablespace users;

8. Datafile = > backup datafile 3;

9. Archive log since time = > backup archivelog from time "sYSDATE1";

4. backup with tag and format = > backup database tag 'monthly_full_backup' format '/u01/backup/monthly_%d_%T_%U.bkp';

13. RMAN JOBS

RMAN BACKUP JOB HISTORY >

select session_key,input_type,status,start_time,end_time,elapsed_seconds,input_bytes_display,output_bytes_display,compression_ratio from v$rman_backup_job_details order by start_time desc fetch first 30 rows only;

current and recent rman operation >

select session_recid,session_stamp,operation,status,start_time,end_time,object_type,output_bytes from v$rman_status where start_time > sysdate-7 order by start_time desc;

RMAN output >

select recid,stamp,output from v$rman_output order by recid;

long operation >

select sid,serial#,opname,sofar,totalwork,units,round(sofar*100/nullif(totalwork,0),2) as pct_done,elapsed_seconds,time_remaining from v$session_longops where opname like 'RMAN%' and totalwork > 0 and sofar <> totalwork order by start_time;

backup piece >

select handle,status,device_type,bytes/1024/1024 as size_mb,start_time,completion_time,compressed from v$backup_piece order by completion_time desc fetch first 50 rows only ;

list backup of database ;

list backup of archivelog all;

list copy;

list expired backup;

.

crosscheck backup;

crosscheck archivelog all;

crosscheck copy;

15. validation

a. validate database blocks > validate database;

16.control file and spfile protection

17. common errors

18. Production safe RMAN CHECKLIST

.

19. practical assesment

a. RMAN repository > in oracle database , the RMAN BACKUP SET is the logical container of one or more physical files that is called BACKUP PIECES, and all of which are tracked and managed by RMAN BACKUP REPOSITORY.

so RMAN BACKUP REPOSITORY is the collection of metadata about your target database and its backups, RMAN uses this metadata to conduct a automated backup process, restoreation , and recovery operations.

b. Connect RMAN :

c. Run show all; and Configure retention policy for 14 day :

d. Enable control file autobackup on , Configure channel and set a format :

e. Run archive backup :

f. Validate database :

g. crosscheck

h. troubleshoot