{"id":5793,"date":"2026-07-17T04:59:19","date_gmt":"2026-07-16T23:29:19","guid":{"rendered":"https:\/\/w3buddy.com\/?p=5793"},"modified":"2026-07-19T22:13:14","modified_gmt":"2026-07-19T16:43:14","slug":"oracle-rman-backup-and-recovery","status":"publish","type":"post","link":"https:\/\/w3buddy.com\/blog\/oracle-rman-backup-and-recovery\/","title":{"rendered":"Oracle RMAN Backup and Recovery"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">A complete production-ready SOP for Oracle RMAN backup and recovery on Linux. Covers RMAN configuration, full and incremental backups, archivelog backups, backup to tape, RMAN catalog setup, point-in-time recovery, tablespace and datafile recovery, block media recovery, RMAN duplicate, crosscheck and validation, backup encryption, and full post-backup validation \u2014 with real commands, expected outputs, and consultant-level notes for both standard OFA and enterprise custom path conventions.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">1. Document Info<\/h3>\n\n\n\n<figure class=\"wp-block-table has-small-font-size\"><table><thead><tr><th>Item<\/th><th>Detail<\/th><\/tr><\/thead><tbody><tr><td>Oracle Version<\/td><td>19c (19.3+)<\/td><\/tr><tr><td>OS<\/td><td>Oracle Linux 7.x \/ RHEL 7.x or 8.x<\/td><\/tr><tr><td>Backup Type<\/td><td>Disk-based (FRA) + Tape (SBT)<\/td><\/tr><tr><td>Recovery Catalog<\/td><td>Optional but recommended (covered)<\/td><\/tr><tr><td>Database<\/td><td>ORCL (standalone)<\/td><\/tr><tr><td>FRA Location<\/td><td>\/u01\/app\/oracle\/fast_recovery_area<\/td><\/tr><tr><td>MOS Reference<\/td><td>Doc ID 1513912.1 (RMAN Best Practices)<\/td><\/tr><tr><td>MOS Reference<\/td><td>Doc ID 1116108.1 (RMAN Performance Tuning)<\/td><\/tr><tr><td>MOS Reference<\/td><td>Doc ID 2505669.1 (RMAN in 19c)<\/td><\/tr><tr><td>Prepared By<\/td><td>Oracle DBA \/ Consultant<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">2. RMAN \u2014 Concepts You Must Know First<\/h3>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>What is RMAN?<\/strong> RMAN (Recovery Manager) is Oracle&#8217;s native backup and recovery tool. It is the only officially supported method for Oracle database backup and recovery. RMAN understands Oracle internals \u2014 it only backs up used blocks (not empty space), validates block integrity during backup, and integrates tightly with Data Guard, Flashback, and ASM.<\/p>\n<\/blockquote>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>Why use RMAN instead of OS-level file copy?<\/strong> OS-level copy (cp, tar) of Oracle datafiles while the database is running creates inconsistent backups \u2014 some blocks may be mid-write at the time of copy. RMAN coordinates with the database to ensure consistent backups. Also RMAN can backup while the database is open \u2014 no downtime needed.<\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">Key RMAN Concepts<\/h4>\n\n\n\n<figure class=\"wp-block-table has-small-font-size\"><table><thead><tr><th>Concept<\/th><th>What It Means<\/th><\/tr><\/thead><tbody><tr><td>Full Backup<\/td><td>Backs up all used blocks in the database. Does not reset the incremental baseline. Also called a Level 0 backup when used as an incremental base.<\/td><\/tr><tr><td>Incremental Backup<\/td><td>Level 0 = base backup (same as full but registers as incremental base). Level 1 = backs up only blocks changed since the last Level 0 or Level 1 backup.<\/td><\/tr><tr><td>Cumulative Incremental<\/td><td>Level 1 CUMULATIVE = backs up all blocks changed since the last Level 0. Larger than differential but faster recovery.<\/td><\/tr><tr><td>Differential Incremental<\/td><td>Level 1 = backs up only blocks changed since the last Level 0 OR Level 1. Smaller backup but slower recovery.<\/td><\/tr><tr><td>Archivelog Backup<\/td><td>Backs up archived redo logs. Required for point-in-time recovery to any point between full backups.<\/td><\/tr><tr><td>Full Backup Set<\/td><td>The default RMAN backup format. Multiple blocks packed into a backup piece file. More compact than image copies.<\/td><\/tr><tr><td>Image Copy<\/td><td>Exact block-for-block copy of a datafile. Can be used directly by Oracle without restore step \u2014 faster recovery.<\/td><\/tr><tr><td>Backup Piece<\/td><td>An individual file produced by RMAN backup. Multiple pieces make up a backup set.<\/td><\/tr><tr><td>Recovery Catalog<\/td><td>A separate Oracle database (schema) that stores RMAN repository information for all databases. Provides longer retention history than control file. Recommended for enterprise environments.<\/td><\/tr><tr><td>Control File Autobackup<\/td><td>RMAN automatically backs up the control file after every backup and after structure changes. Essential \u2014 without control file you cannot restore the database.<\/td><\/tr><tr><td>FRA (Fast Recovery Area)<\/td><td>A dedicated disk location managed by Oracle for backup files, archivelogs, and flashback logs. Oracle manages space automatically.<\/td><\/tr><tr><td>SBT (System Backup to Tape)<\/td><td>RMAN interface to third-party tape\/media managers (Veritas NetBackup, IBM TSM, etc.)<\/td><\/tr><tr><td>CROSSCHECK<\/td><td>Verifies that backup pieces\/copies listed in the repository actually exist on disk or tape.<\/td><\/tr><tr><td>VALIDATE<\/td><td>Checks backup files for corruption without actually restoring them.<\/td><\/tr><tr><td>Block Media Recovery<\/td><td>Recovers individual corrupt blocks within a datafile without taking the datafile offline.<\/td><\/tr><tr><td>DUPLICATE<\/td><td>Creates a copy of a database (used for standby creation, test databases, migration).<\/td><\/tr><tr><td>Retention Policy<\/td><td>Rules for how long RMAN keeps backups before marking them as obsolete.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">RMAN Backup Strategy \u2014 Recommended Production Schedule<\/h4>\n\n\n\n<figure class=\"wp-block-table has-small-font-size\"><table><thead><tr><th>Backup Type<\/th><th>Frequency<\/th><th>Day<\/th><th>Retention<\/th><\/tr><\/thead><tbody><tr><td>Level 0 (Full base)<\/td><td>Weekly<\/td><td>Sunday 01:00 AM<\/td><td>4 weeks<\/td><\/tr><tr><td>Level 1 Cumulative<\/td><td>Daily<\/td><td>Mon-Sat 01:00 AM<\/td><td>1 week<\/td><\/tr><tr><td>Archivelog<\/td><td>Every 4 hours<\/td><td>All days<\/td><td>3 days<\/td><\/tr><tr><td>Controlfile Autobackup<\/td><td>After every RMAN run<\/td><td>Automatic<\/td><td>With DB backup<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>Why cumulative instead of differential?<\/strong> Cumulative Level 1 is larger but recovery requires only 2 pieces of backup \u2014 the last Level 0 and the last Level 1 cumulative. Differential Level 1 creates smaller daily backups but recovery may need multiple Level 1 backups in sequence. In a recovery emergency, fewer backup pieces = faster recovery.<\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">3. Path Conventions and Environment Details<\/h3>\n\n\n\n<figure class=\"wp-block-table has-small-font-size\"><table><thead><tr><th>Item<\/th><th>Convention A<\/th><th>Convention B<\/th><\/tr><\/thead><tbody><tr><td>Oracle Base<\/td><td>\/u01\/app\/oracle<\/td><td>\/oracle<\/td><\/tr><tr><td>Oracle Home<\/td><td>\/u01\/app\/oracle\/product\/19.3.0\/dbhome_1<\/td><td>\/oracle\/RDBMS\/19.31<\/td><\/tr><tr><td>FRA Location<\/td><td>\/u01\/app\/oracle\/fast_recovery_area<\/td><td>\/oracle\/fast_recovery_area<\/td><\/tr><tr><td>FRA Size<\/td><td>200 GB (adjust per environment)<\/td><td>200 GB<\/td><\/tr><tr><td>Backup to Disk<\/td><td>\/u01\/app\/oracle\/backup<\/td><td>\/oracle\/backup<\/td><\/tr><tr><td>RMAN Catalog DB<\/td><td>RMANCAT (separate DB or server)<\/td><td>RMANCAT<\/td><\/tr><tr><td>Oracle SID<\/td><td>ORCL<\/td><td>ORCL<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">4. Pre-Backup Checks<\/h3>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\u26a0\ufe0f <strong>IMPORTANT:<\/strong> Run all pre-checks before configuring RMAN or starting any backup. A backup that silently fails is worse than no backup \u2014 you think you are protected but you are not.<\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">4.1 \u2014 Verify Database is in ARCHIVELOG Mode<\/h4>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>Why?<\/strong> RMAN online backups require ARCHIVELOG mode. Without it, RMAN can only do offline (cold) backups which require database downtime. All production databases must be in ARCHIVELOG mode.<\/p>\n<\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>sqlplus \/ as sysdba\n\nset linesize 150\nset pagesize 50\ncol name     for a12\ncol log_mode for a15\n\nSELECT name, log_mode FROM v$database;\n\n-- Detailed archivelog status\nARCHIVE LOG LIST;<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\u26a0\ufe0f <strong>IMPORTANT:<\/strong> If database is in NOARCHIVELOG mode \u2014 switch to ARCHIVELOG mode immediately before configuring RMAN:<\/p>\n<\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>SHUTDOWN IMMEDIATE;\nSTARTUP MOUNT;\nALTER DATABASE ARCHIVELOG;\nALTER DATABASE OPEN;\nARCHIVE LOG LIST;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">4.2 \u2014 Check FRA Configuration<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>sqlplus \/ as sysdba\n\nset linesize 200\nset pagesize 50\ncol name  for a35\ncol value for a60\n\n-- Check FRA parameters\nSELECT name, value\nFROM   v$parameter\nWHERE  name IN (\n    'db_recovery_file_dest',\n    'db_recovery_file_dest_size',\n    'log_archive_dest_1',\n    'log_archive_format'\n)\nORDER BY name;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">4.3 \u2014 Check FRA Space Usage<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Check FRA space usage\nset linesize 200\nset pagesize 100\ncol file_type          for a30\ncol percent_space_used for 999.99\ncol percent_space_reclaimable for 999.99\ncol number_of_files    for 999999\n\nSELECT file_type,\n       percent_space_used,\n       percent_space_reclaimable,\n       number_of_files\nFROM   v$recovery_area_usage\nORDER BY file_type;\n\n-- Overall FRA space\nset linesize 200\ncol name               for a50\ncol space_limit_gb     for 9999.99\ncol space_used_gb      for 9999.99\ncol space_reclaimable_gb for 9999.99\ncol number_of_files    for 999999\n\nSELECT name,\n       space_limit\/1024\/1024\/1024          space_limit_gb,\n       space_used\/1024\/1024\/1024           space_used_gb,\n       space_reclaimable\/1024\/1024\/1024    space_reclaimable_gb,\n       number_of_files\nFROM   v$recovery_file_dest;<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\u26a0\ufe0f <strong>IMPORTANT:<\/strong> FRA space used above 85% is a warning. Above 95% Oracle starts refusing archive log generation which will crash the database. Monitor FRA space constantly and extend it before it fills up.<\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">4.4 \u2014 Check Disk Space for Backup Destination<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code># Check disk space for FRA and backup destinations\ndf -hP \/u01\/app\/oracle\/fast_recovery_area\ndf -hP \/u01\/app\/oracle\/backup\n\n# Convention B\ndf -hP \/oracle\/fast_recovery_area\ndf -hP \/oracle\/backup<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">4.5 \u2014 Verify All Datafiles are Online<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>sqlplus \/ as sysdba\n\nset linesize 200\nset pagesize 100\ncol file#           for 999\ncol tablespace_name for a25\ncol status          for a12\ncol name            for a70\n\n-- All datafiles must be ONLINE before backup\nSELECT file#, tablespace_name, status, name\nFROM   v$datafile\nWHERE  status != 'ONLINE'\nORDER BY file#;\n\n-- Should return no rows -- if any rows returned fix before backup<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">4.6 \u2014 Check for Block Corruption Before Backup<\/h4>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>Why?<\/strong> Backing up a database that already has block corruption just backs up the corruption. Run a block check before backup to identify any existing corruption that needs to be fixed first.<\/p>\n<\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Check v$database_block_corruption\nset linesize 200\nset pagesize 100\ncol file#      for 999\ncol block#     for 9999999\ncol blocks     for 9999\ncol corruption_type for a20\n\nSELECT file#, block#, blocks, corruption_type\nFROM   v$database_block_corruption\nORDER BY file#, block#;\n\n-- No rows = no known corruption (good)<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">5. RMAN Configuration<\/h3>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>What is RMAN configuration?<\/strong> RMAN has persistent configuration settings stored in the control file (or catalog). These settings apply to every RMAN session automatically \u2014 you do not need to specify them every time you run a backup. Configure them once and they are remembered.<\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">5.1 \u2014 Connect to RMAN<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code># Connect to target database only (no catalog)\nsu - oracle\nrman target \/\n\n# Connect with catalog (if catalog is configured)\nrman target \/ catalog rman_user\/rman_password@RMANCAT\n\n# Connect to specific database\nrman target sys\/Oracle_123@ORCL\n\n# Verify connection\nRMAN&gt; SELECT name, db_unique_name FROM v$database;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">5.2 \u2014 Show Current RMAN Configuration<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Display all current RMAN configuration settings\nRMAN&gt; SHOW ALL;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Default output (before any configuration):<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>RMAN configuration parameters for database with db_unique_name ORCL are:\nCONFIGURE RETENTION POLICY TO REDUNDANCY 1;\nCONFIGURE BACKUP OPTIMIZATION OFF;\nCONFIGURE DEFAULT DEVICE TYPE TO DISK;\nCONFIGURE CONTROLFILE AUTOBACKUP OFF;\nCONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F';\nCONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET;\nCONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1;\nCONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1;\nCONFIGURE MAXSETSIZE TO UNLIMITED;\nCONFIGURE ENCRYPTION FOR DATABASE OFF;\nCONFIGURE ENCRYPTION ALGORITHM 'AES128';\nCONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE;\nCONFIGURE ARCHIVELOG DELETION POLICY TO NONE;\nCONFIGURE SNAPSHOT CONTROLFILE NAME TO '\/u01\/app\/oracle\/product\/19.3.0\/dbhome_1\/dbs\/snapcf_ORCL.f';<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">5.3 \u2014 Configure FRA (Fast Recovery Area)<\/h4>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>Why configure FRA?<\/strong> FRA is Oracle&#8217;s managed location for all recovery-related files. When configured, Oracle automatically manages space \u2014 deleting obsolete backups when space is needed for new ones (within the retention policy). FRA is the recommended backup destination for disk-based backups.<\/p>\n<\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Configure FRA in the database (run as SYSDBA, not RMAN)\nsqlplus \/ as sysdba\n\n-- Set FRA location\n-- Convention A\nALTER SYSTEM SET DB_RECOVERY_FILE_DEST=\n    '\/u01\/app\/oracle\/fast_recovery_area'\n    SCOPE=BOTH;\n\n-- Convention B\n-- ALTER SYSTEM SET DB_RECOVERY_FILE_DEST=\n--     '\/oracle\/fast_recovery_area'\n--     SCOPE=BOTH;\n\n-- Set FRA size -- set to at least 3x your database size\nALTER SYSTEM SET DB_RECOVERY_FILE_DEST_SIZE=200G SCOPE=BOTH;\n\n-- Verify\nSHOW PARAMETER db_recovery_file_dest;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">5.4 \u2014 Set RMAN Retention Policy<\/h4>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>What is retention policy?<\/strong> Defines how long RMAN keeps backups before marking them obsolete. Two types:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>REDUNDANCY n<\/code> \u2014 keep n copies of each datafile backup<\/li>\n\n\n\n<li><code>RECOVERY WINDOW OF n DAYS<\/code> \u2014 keep enough backups to recover to any point within the last n days<\/li>\n<\/ul>\n<\/blockquote>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>Which to use?<\/strong> <code>RECOVERY WINDOW<\/code> is more predictable for compliance requirements. <code>REDUNDANCY<\/code> is simpler for operations. Most production environments use <code>RECOVERY WINDOW OF 7 DAYS<\/code>.<\/p>\n<\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Connect to RMAN\nrman target \/\n\n-- Set retention policy to recovery window of 7 days\n-- This means RMAN keeps enough backups to recover to any point\n-- in the last 7 days\nRMAN&gt; CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;\n\n-- Alternative: keep exactly 2 copies of each backup\n-- RMAN&gt; CONFIGURE RETENTION POLICY TO REDUNDANCY 2;\n\n-- Verify\nRMAN&gt; SHOW RETENTION POLICY;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">5.5 \u2014 Configure Controlfile Autobackup<\/h4>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>Why is controlfile autobackup critical?<\/strong> The control file contains the RMAN backup repository when no catalog is used. If the control file is lost and there is no autobackup, you cannot restore the database because RMAN does not know where the backups are. Enable autobackup ALWAYS.<\/p>\n<\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>RMAN&gt; CONFIGURE CONTROLFILE AUTOBACKUP ON;\n\n-- Set the format for autobackup\n-- %F = unique format including DB ID, timestamp\n-- Convention A\nRMAN&gt; CONFIGURE CONTROLFILE AUTOBACKUP FORMAT\n        FOR DEVICE TYPE DISK TO\n        '\/u01\/app\/oracle\/fast_recovery_area\/ORCL\/autobackup\/%F';\n\n-- Convention B\n-- RMAN&gt; CONFIGURE CONTROLFILE AUTOBACKUP FORMAT\n--         FOR DEVICE TYPE DISK TO\n--         '\/oracle\/fast_recovery_area\/ORCL\/autobackup\/%F';\n\n-- Verify\nRMAN&gt; SHOW CONTROLFILE AUTOBACKUP;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">5.6 \u2014 Configure Backup Parallelism<\/h4>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>Why parallelize?<\/strong> RMAN can use multiple channels to backup simultaneously \u2014 like having multiple backup streams running at the same time. More channels = faster backup. The optimal number of channels equals the number of available disk spindles or CPU cores (whichever is smaller).<\/p>\n<\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Configure parallelism for disk backups\n-- PARALLELISM 4 = use 4 simultaneous backup channels\nRMAN&gt; CONFIGURE DEVICE TYPE DISK PARALLELISM 4 BACKUP TYPE TO BACKUPSET;\n\n-- For tape (SBT) -- match number of tape drives available\n-- RMAN&gt; CONFIGURE DEVICE TYPE SBT PARALLELISM 2 BACKUP TYPE TO BACKUPSET;\n\n-- Verify\nRMAN&gt; SHOW DEVICE TYPE;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">5.7 \u2014 Configure Backup Optimization<\/h4>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>Why enable optimization?<\/strong> Backup optimization tells RMAN to skip backing up files that have already been backed up and have not changed \u2014 specifically archivelogs and datafiles that are already backed up to the required redundancy. Saves significant time on large databases with stable data.<\/p>\n<\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>RMAN&gt; CONFIGURE BACKUP OPTIMIZATION ON;\n\n-- Verify\nRMAN&gt; SHOW BACKUP OPTIMIZATION;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">5.8 \u2014 Configure Backup Compression<\/h4>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>Why compress?<\/strong> RMAN compression reduces backup size significantly \u2014 typically 50-70% reduction for typical Oracle data. Reduces disk space needed and speeds up network transfer for off-site backup. The trade-off is CPU overhead during backup.<\/p>\n<\/blockquote>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>Compression algorithms:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>BASIC<\/code> \u2014 low CPU, moderate compression. Available without Advanced Compression license.<\/li>\n\n\n\n<li><code>LOW<\/code> \u2014 very fast, less compression. Requires Advanced Compression license.<\/li>\n\n\n\n<li><code>MEDIUM<\/code> \u2014 balanced. Requires Advanced Compression license.<\/li>\n\n\n\n<li><code>HIGH<\/code> \u2014 best compression, highest CPU. Requires Advanced Compression license.<\/li>\n<\/ul>\n<\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>-- BASIC compression (no license required)\nRMAN&gt; CONFIGURE COMPRESSION ALGORITHM 'BASIC';\n\n-- Enable compression for backups (set in backup command or globally)\n-- Using compression in the BACKUP command:\n-- BACKUP AS COMPRESSED BACKUPSET DATABASE;\n\n-- Verify compression setting\nRMAN&gt; SHOW COMPRESSION ALGORITHM;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">5.9 \u2014 Configure Archivelog Deletion Policy<\/h4>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>Why configure deletion policy?<\/strong> Controls when RMAN deletes archivelogs from the FRA after they have been backed up. Setting this correctly prevents the FRA from filling up with archivelogs that have already been safely backed up.<\/p>\n<\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Delete archivelogs only after they have been backed up at least once\n-- AND only after they have been applied on all registered standby databases\nRMAN&gt; CONFIGURE ARCHIVELOG DELETION POLICY TO BACKED UP 1 TIMES TO DISK;\n\n-- For Data Guard environment:\n-- RMAN&gt; CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON ALL STANDBY;\n\n-- Verify\nRMAN&gt; SHOW ARCHIVELOG DELETION POLICY;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">5.10 \u2014 Configure Snapshot Controlfile Location<\/h4>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>Why?<\/strong> When RMAN backs up the control file, it creates a snapshot (temporary consistent copy) of the control file first. The default location is inside ORACLE_HOME which may not have enough space. Move it to FRA or backup area.<\/p>\n<\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Convention A\nRMAN&gt; CONFIGURE SNAPSHOT CONTROLFILE NAME TO\n        '\/u01\/app\/oracle\/fast_recovery_area\/ORCL\/snapcf_ORCL.f';\n\n-- Convention B\n-- RMAN&gt; CONFIGURE SNAPSHOT CONTROLFILE NAME TO\n--         '\/oracle\/fast_recovery_area\/ORCL\/snapcf_ORCL.f';\n\nRMAN&gt; SHOW SNAPSHOT CONTROLFILE NAME;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">5.11 \u2014 Verify All RMAN Configuration Settings<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Display complete RMAN configuration after all settings\nRMAN&gt; SHOW ALL;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">6. RMAN Catalog Setup (Optional but Recommended)<\/h3>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>What is the RMAN Recovery Catalog?<\/strong> The catalog is a separate Oracle database schema that stores RMAN repository information for all your target databases. Instead of RMAN storing backup metadata only in the control file (which can be lost with the database), the catalog stores it externally. The catalog provides:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Longer backup history than the control file allows<\/li>\n\n\n\n<li>Stored scripts that can be shared across databases<\/li>\n\n\n\n<li>Ability to recover a database even if you lose the entire control file<\/li>\n\n\n\n<li>Central reporting on all database backups<\/li>\n<\/ul>\n<\/blockquote>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>When is a catalog mandatory?<\/strong> In large environments with many databases, the catalog is effectively mandatory for proper backup management. For single databases in small environments, control file only is acceptable.<\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">6.1 \u2014 Create RMAN Catalog Database and Schema<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>-- On CATALOG DATABASE SERVER (a separate Oracle DB -- RMANCAT)\nsqlplus \/ as sysdba\n\n-- Create dedicated tablespace for RMAN catalog\nCREATE TABLESPACE rman_ts\n    DATAFILE '\/u01\/app\/oracle\/oradata\/RMANCAT\/rman_ts01.dbf'\n    SIZE 5G\n    AUTOEXTEND ON NEXT 1G MAXSIZE 50G;\n\n-- Create RMAN catalog owner user\nCREATE USER rman_user\n    IDENTIFIED BY Rman_Password_123\n    DEFAULT TABLESPACE rman_ts\n    TEMPORARY TABLESPACE temp\n    QUOTA UNLIMITED ON rman_ts;\n\n-- Grant RECOVERY_CATALOG_OWNER role\n-- This role contains all privileges needed to own and manage the catalog\nGRANT RECOVERY_CATALOG_OWNER TO rman_user;\nGRANT CREATE SESSION TO rman_user;\n\n-- Verify\nSELECT username, default_tablespace\nFROM   dba_users\nWHERE  username = 'RMAN_USER';<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">6.2 \u2014 Create the Catalog Schema<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code># Connect to RMAN as catalog owner\nrman catalog rman_user\/Rman_Password_123@RMANCAT<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Create the catalog schema (creates all catalog tables)\n-- This takes 1-2 minutes\nRMAN&gt; CREATE CATALOG;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Expected output:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>recovery catalog created<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">6.3 \u2014 Register Target Database with Catalog<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code># Connect to RMAN with both target and catalog\nrman target sys\/Oracle_123@ORCL catalog rman_user\/Rman_Password_123@RMANCAT<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Register the target database in the catalog\nRMAN&gt; REGISTER DATABASE;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Expected output:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>database registered in recovery catalog\nstarting full resync of recovery catalog\nfull resync complete<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Verify registration\nRMAN&gt; REPORT SCHEMA;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">6.4 \u2014 Create Stored Scripts in Catalog<\/h4>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>Why stored scripts?<\/strong> Stored scripts are RMAN scripts saved in the catalog that can be executed by name. They standardize backup procedures across all DBAs and can be shared across multiple databases.<\/p>\n<\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Create a full database backup script\nRMAN&gt; CREATE SCRIPT full_db_backup\n{\n   BACKUP AS COMPRESSED BACKUPSET\n   INCREMENTAL LEVEL 0\n   DATABASE\n   FORMAT '\/u01\/app\/oracle\/fast_recovery_area\/ORCL\/backupset\/full_%d_%T_%s_%p'\n   TAG 'WEEKLY_FULL';\n\n   BACKUP ARCHIVELOG ALL\n   FORMAT '\/u01\/app\/oracle\/fast_recovery_area\/ORCL\/archivelog\/arch_%d_%T_%s_%p'\n   DELETE INPUT\n   TAG 'ARCH_WITH_FULL';\n\n   DELETE NOPROMPT OBSOLETE;\n}\n\n-- Create incremental backup script\nRMAN&gt; CREATE SCRIPT incr_db_backup\n{\n   BACKUP AS COMPRESSED BACKUPSET\n   INCREMENTAL LEVEL 1 CUMULATIVE\n   DATABASE\n   FORMAT '\/u01\/app\/oracle\/fast_recovery_area\/ORCL\/backupset\/incr_%d_%T_%s_%p'\n   TAG 'DAILY_INCR';\n\n   BACKUP ARCHIVELOG ALL\n   FORMAT '\/u01\/app\/oracle\/fast_recovery_area\/ORCL\/archivelog\/arch_%d_%T_%s_%p'\n   DELETE INPUT\n   TAG 'ARCH_WITH_INCR';\n}\n\n-- List stored scripts\nRMAN&gt; LIST SCRIPT NAMES;\n\n-- Execute a stored script\nRMAN&gt; EXECUTE SCRIPT full_db_backup;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">7. RMAN Backup Operations<\/h3>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">7.1 \u2014 Full Database Backup (Level 0)<\/h4>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>What does Level 0 mean?<\/strong> Level 0 is a full backup that also serves as the base for subsequent incremental backups. It backs up ALL used blocks in the database. Run this weekly.<\/p>\n<\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>su - oracle\nrman target \/<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Full database backup with compressed backupset\n-- Including archivelog backup and control file\nBACKUP AS COMPRESSED BACKUPSET\n    INCREMENTAL LEVEL 0\n    DATABASE\n    FORMAT '\/u01\/app\/oracle\/fast_recovery_area\/ORCL\/backupset\/full_%d_%T_%s_%p'\n    TAG 'WEEKLY_FULL_BACKUP'\n    PLUS ARCHIVELOG\n    FORMAT '\/u01\/app\/oracle\/fast_recovery_area\/ORCL\/archivelog\/arch_%d_%T_%s_%p'\n    DELETE INPUT;\n\n-- Immediately after full backup -- delete obsolete backups\nDELETE NOPROMPT OBSOLETE;\n\n-- Verify backup completed successfully\nLIST BACKUP SUMMARY;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">7.2 \u2014 Incremental Level 1 Backup (Daily)<\/h4>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>What does incremental backup contain?<\/strong> Only blocks that have changed since the last Level 0 backup (or last Level 1 if differential). Significantly smaller and faster than Level 0. Run daily between weekly full backups.<\/p>\n<\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Daily cumulative incremental backup\n-- CUMULATIVE = back up all changes since last Level 0\nBACKUP AS COMPRESSED BACKUPSET\n    INCREMENTAL LEVEL 1 CUMULATIVE\n    DATABASE\n    FORMAT '\/u01\/app\/oracle\/fast_recovery_area\/ORCL\/backupset\/incr_%d_%T_%s_%p'\n    TAG 'DAILY_INCR_BACKUP'\n    PLUS ARCHIVELOG\n    FORMAT '\/u01\/app\/oracle\/fast_recovery_area\/ORCL\/archivelog\/arch_%d_%T_%s_%p'\n    DELETE INPUT;\n\n-- Verify\nLIST BACKUP SUMMARY;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">7.3 \u2014 Archivelog Backup Only<\/h4>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>Why backup archivelogs separately?<\/strong> Archivelogs fill up the FRA quickly. Backing them up regularly (every 4 hours) and deleting them from the FRA after backup keeps FRA space usage under control while ensuring they are safely stored.<\/p>\n<\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Backup all unbackedup archivelogs\n-- DELETE INPUT removes them from disk after backup\nBACKUP\n    ARCHIVELOG ALL\n    FORMAT '\/u01\/app\/oracle\/fast_recovery_area\/ORCL\/archivelog\/arch_%d_%T_%s_%p'\n    DELETE INPUT\n    TAG 'ARCHIVELOG_BACKUP';\n\n-- Backup archivelogs from last 4 hours only\nBACKUP\n    ARCHIVELOG FROM TIME 'SYSDATE-1\/6'\n    FORMAT '\/u01\/app\/oracle\/fast_recovery_area\/ORCL\/archivelog\/arch_%d_%T_%s_%p'\n    TAG 'ARCHIVELOG_4H';\n\n-- Verify\nLIST ARCHIVELOG ALL;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">7.4 \u2014 Backup Specific Tablespace<\/h4>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>When to use?<\/strong> After making significant changes to a specific tablespace (large data load, schema change) \u2014 backup just that tablespace immediately without waiting for the nightly backup.<\/p>\n<\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Backup specific tablespaces\nBACKUP\n    TABLESPACE users, example\n    FORMAT '\/u01\/app\/oracle\/fast_recovery_area\/ORCL\/backupset\/ts_%d_%T_%s_%p'\n    TAG 'TABLESPACE_BACKUP';\n\n-- With archivelogs for consistent recovery\nBACKUP\n    TABLESPACE users\n    FORMAT '\/u01\/app\/oracle\/fast_recovery_area\/ORCL\/backupset\/ts_%d_%T_%s_%p'\n    TAG 'USERS_TS_BACKUP'\n    PLUS ARCHIVELOG\n    FORMAT '\/u01\/app\/oracle\/fast_recovery_area\/ORCL\/archivelog\/arch_%d_%T_%s_%p';\n\nLIST BACKUP OF TABLESPACE users;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">7.5 \u2014 Backup Control File and SPFILE<\/h4>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>Why separate controlfile backup?<\/strong> The controlfile contains the database structure and RMAN backup catalog. If lost, recovery becomes extremely difficult. Back it up explicitly and often, especially after any structural changes (adding tablespaces, datafiles etc.).<\/p>\n<\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Backup controlfile explicitly\nBACKUP CURRENT CONTROLFILE\n    FORMAT '\/u01\/app\/oracle\/fast_recovery_area\/ORCL\/ctrl\/ctrl_%d_%T_%s_%p'\n    TAG 'CONTROLFILE_BACKUP';\n\n-- Backup SPFILE\nBACKUP SPFILE\n    FORMAT '\/u01\/app\/oracle\/fast_recovery_area\/ORCL\/spfile\/spfile_%d_%T_%s_%p'\n    TAG 'SPFILE_BACKUP';\n\n-- Backup both together\nBACKUP CURRENT CONTROLFILE\n    FORMAT '\/u01\/app\/oracle\/fast_recovery_area\/ORCL\/ctrl\/ctrl_%d_%T_%s_%p'\n    INCLUDE CURRENT CONTROLFILE SPFILE;\n\nLIST BACKUP OF CONTROLFILE;\nLIST BACKUP OF SPFILE;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">7.6 \u2014 Backup to Tape (SBT Channel)<\/h4>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>What is SBT?<\/strong> System Backup to Tape \u2014 RMAN&#8217;s interface to third-party media managers like Veritas NetBackup, IBM Spectrum Protect (TSM), Commvault, and others. The media manager provides a shared library (sbt_tape) that RMAN loads to communicate with the tape system.<\/p>\n<\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Configure SBT channel for tape backup\n-- The parms string is specific to your tape media manager\n-- Example shown for Veritas NetBackup:\nCONFIGURE CHANNEL DEVICE TYPE SBT\n    PARMS 'SBT_LIBRARY=\/usr\/openv\/netbackup\/bin\/nbora,\n           ENV=(NB_ORA_SERV=netbackup_server,\n           NB_ORA_CLASS=Oracle_Backup_Policy)';\n\n-- Backup to tape using SBT\nBACKUP\n    DEVICE TYPE SBT\n    DATABASE\n    FORMAT 'ORCL_%d_%T_%s_%p'\n    TAG 'TAPE_FULL_BACKUP'\n    PLUS ARCHIVELOG\n    DELETE INPUT;\n\n-- Backup to both disk AND tape simultaneously\nBACKUP\n    DATABASE\n    FORMAT '\/u01\/app\/oracle\/fast_recovery_area\/ORCL\/backupset\/%d_%T_%s_%p'\n    PLUS ARCHIVELOG;\n\nBACKUP\n    DEVICE TYPE SBT\n    BACKUPSET ALL;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">7.7 \u2014 RMAN Backup with Encryption<\/h4>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>Why encrypt backups?<\/strong> Backup files stored on disk or tape can be stolen. Encrypting RMAN backups ensures backup files are unreadable without the encryption key. This is separate from TDE (which encrypts the database itself). RMAN backup encryption encrypts the backup files on media.<\/p>\n<\/blockquote>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>Two encryption modes:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>TRANSPARENT<\/code> \u2014 uses TDE wallet. Requires TDE to be configured. Key managed by Oracle wallet.<\/li>\n\n\n\n<li><code>PASSWORD<\/code> \u2014 uses a password you provide. No TDE required but password must be available during restore.<\/li>\n<\/ul>\n<\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Enable transparent encryption (uses TDE wallet -- preferred)\n-- TDE must be configured and wallet must be open\nCONFIGURE ENCRYPTION FOR DATABASE ON;\nCONFIGURE ENCRYPTION ALGORITHM 'AES256';\n\n-- Backup with transparent encryption\nBACKUP AS ENCRYPTED BACKUPSET\n    DATABASE\n    FORMAT '\/u01\/app\/oracle\/fast_recovery_area\/ORCL\/backupset\/enc_%d_%T_%s_%p'\n    TAG 'ENCRYPTED_FULL_BACKUP';\n\n-- Enable password-based encryption (no TDE required)\nSET ENCRYPTION ON IDENTIFIED BY BackupEncPwd_123 ONLY;\n\nBACKUP AS ENCRYPTED BACKUPSET\n    DATABASE\n    FORMAT '\/u01\/app\/oracle\/fast_recovery_area\/ORCL\/backupset\/enc_%d_%T_%s_%p'\n    TAG 'PWD_ENCRYPTED_BACKUP';\n\n-- Verify encryption setting\nSHOW ENCRYPTION FOR DATABASE;\nSHOW ENCRYPTION ALGORITHM;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">7.8 \u2014 Multisection Backup (Large Files)<\/h4>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>Why multisection?<\/strong> For very large datafiles (hundreds of GBs to TBs), a single file cannot be parallelized across channels. Multisection backup splits a single large file into sections that can be backed up in parallel \u2014 dramatically reducing backup time for VLDB (Very Large Database) environments.<\/p>\n<\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Enable multisection backup\n-- Each section is 32GB -- adjust based on file size\nBACKUP\n    AS COMPRESSED BACKUPSET\n    DATABASE\n    SECTION SIZE 32G\n    FORMAT '\/u01\/app\/oracle\/fast_recovery_area\/ORCL\/backupset\/ms_%d_%T_%s_%p'\n    TAG 'MULTISECTION_FULL';\n\nLIST BACKUP SUMMARY;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">8. RMAN Backup Validation and Crosscheck<\/h3>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">8.1 \u2014 List Backup Summary<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Complete backup listing\nRMAN&gt; LIST BACKUP SUMMARY;\n\n-- Detailed listing\nRMAN&gt; LIST BACKUP;\n\n-- List backups of specific type\nRMAN&gt; LIST BACKUP OF DATABASE;\nRMAN&gt; LIST BACKUP OF ARCHIVELOG ALL;\nRMAN&gt; LIST BACKUP OF CONTROLFILE;\nRMAN&gt; LIST BACKUP OF SPFILE;\n\n-- List backups from last 7 days\nRMAN&gt; LIST BACKUP COMPLETED AFTER 'SYSDATE-7';\n\n-- List expired backups\nRMAN&gt; LIST EXPIRED BACKUP;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">8.2 \u2014 Crosscheck Backups<\/h4>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>What is crosscheck?<\/strong> Crosscheck compares what RMAN believes exists (from its repository in control file or catalog) against what actually exists on disk or tape. If a backup file was manually deleted or corrupted, crosscheck marks it as EXPIRED in the repository.<\/p>\n<\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Crosscheck all backups on disk\nRMAN&gt; CROSSCHECK BACKUP;\n\n-- Crosscheck specific backup types\nRMAN&gt; CROSSCHECK BACKUP OF DATABASE;\nRMAN&gt; CROSSCHECK BACKUP OF ARCHIVELOG ALL;\nRMAN&gt; CROSSCHECK BACKUP OF CONTROLFILE;\n\n-- Crosscheck tape backups\nRMAN&gt; CROSSCHECK BACKUP DEVICE TYPE SBT;\n\n-- After crosscheck -- list expired backups\nRMAN&gt; LIST EXPIRED BACKUP;\n\n-- Delete expired backups from repository\nRMAN&gt; DELETE NOPROMPT EXPIRED BACKUP;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">8.3 \u2014 Validate Backups (Check for Corruption)<\/h4>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>What does validate do?<\/strong> VALIDATE reads backup pieces and checks every block for corruption \u2014 without actually restoring anything. Use it regularly to confirm your backups are restorable.<\/p>\n<\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Validate all backups (reads backup pieces and checks block integrity)\n-- This can take a while for large databases\nRMAN&gt; VALIDATE BACKUPSET ALL;\n\n-- Validate specific backup set\nRMAN&gt; VALIDATE BACKUPSET &lt;backupset_key&gt;;\n\n-- Validate database backup (simulates restore without writing files)\nRMAN&gt; RESTORE DATABASE VALIDATE;\n\n-- Validate specific tablespace restore\nRMAN&gt; RESTORE TABLESPACE users VALIDATE;\n\n-- Validate that database can be recovered to current time\nRMAN&gt; RESTORE DATABASE VALIDATE PREVIEW;\n\n-- After validate -- check for any corruption found\nSELECT *\nFROM   v$database_block_corruption;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">8.4 \u2014 Delete Obsolete Backups<\/h4>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>Why delete obsolete?<\/strong> RMAN tracks which backups are obsolete based on the retention policy. Deleting them reclaims disk\/tape space. RMAN only deletes backups that are no longer needed to meet the retention policy.<\/p>\n<\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Preview what would be deleted (REPORT first, then DELETE)\nRMAN&gt; REPORT OBSOLETE;\n\n-- Delete obsolete backups (confirms before deleting)\nRMAN&gt; DELETE OBSOLETE;\n\n-- Delete without confirmation prompt (for scripts)\nRMAN&gt; DELETE NOPROMPT OBSOLETE;\n\n-- Delete obsolete backups for a specific retention window override\nRMAN&gt; DELETE OBSOLETE RECOVERY WINDOW OF 14 DAYS;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">8.5 \u2014 Report Database Structure and Backup Requirements<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Report current database file structure\nRMAN&gt; REPORT SCHEMA;\n\n-- Report files that need backup\n-- Files needing backup according to retention policy\nRMAN&gt; REPORT NEED BACKUP;\n\n-- Files unrecoverable (no backup exists)\nRMAN&gt; REPORT UNRECOVERABLE;\n\n-- Files not backed up in last 2 days\nRMAN&gt; REPORT NEED BACKUP DAYS 2;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">9. RMAN Recovery Operations<\/h3>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\u26a0\ufe0f <strong>IMPORTANT:<\/strong> Recovery is a high-stress operation usually performed during an outage. Prepare and practice these procedures in a non-production environment BEFORE you ever need them in production. Know these steps by heart.<\/p>\n<\/blockquote>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>Recovery scenario decision tree:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Lost one or few datafiles \u2192 Section 9.2 (Datafile Recovery)<\/li>\n\n\n\n<li>Lost entire database \u2192 Section 9.3 (Complete Database Recovery)<\/li>\n\n\n\n<li>Need specific point in time \u2192 Section 9.4 (PITR)<\/li>\n\n\n\n<li>Lost control file \u2192 Section 9.5 (Control File Recovery)<\/li>\n\n\n\n<li>Corrupt blocks in datafile \u2192 Section 9.6 (Block Media Recovery)<\/li>\n\n\n\n<li>Lost tablespace \u2192 Section 9.7 (Tablespace Recovery)<\/li>\n<\/ul>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">9.1 \u2014 Pre-Recovery Checklist<\/h4>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\u26a0\ufe0f <strong>IMPORTANT:<\/strong> Before starting any recovery, complete this checklist.<\/p>\n<\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code># 1. Identify exactly what is missing or corrupt\nsqlplus \/ as sysdba<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Check what is missing\nSELECT file#, name, status FROM v$datafile WHERE status != 'ONLINE';\nSELECT * FROM v$recover_file;\nSELECT * FROM v$database_block_corruption;\n\n-- Check alert log for error details\nEXIT;<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code># 2. Check available backups\nrman target \/<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>RMAN&gt; LIST BACKUP SUMMARY;\nRMAN&gt; LIST BACKUP OF DATABASE COMPLETED AFTER 'SYSDATE-7';\n\n-- Check what is available for recovery\nRMAN&gt; RESTORE DATABASE PREVIEW;<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code># 3. Confirm FRA has sufficient space for recovery\ndf -hP \/u01\/app\/oracle\/fast_recovery_area<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">9.2 \u2014 Datafile Recovery (One or More Datafiles Lost)<\/h4>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>Scenario:<\/strong> One or more datafiles are missing (accidentally deleted, disk failure, filesystem corruption). Database is either still running with that tablespace offline, or database is mounted but not open.<\/p>\n<\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Step 1: Identify missing\/corrupt datafile\nsqlplus \/ as sysdba\n\nSELECT file#, name, status\nFROM   v$datafile\nWHERE  status != 'ONLINE';\n\nSELECT * FROM v$recover_file;<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Step 2: Take offline the affected datafile (if DB is open)\n-- Skip this if DB is already not open\nALTER DATABASE DATAFILE '\/u01\/app\/oracle\/oradata\/ORCL\/users01.dbf' OFFLINE;<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code># Step 3: Restore and recover the specific datafile\nrman target \/<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Restore the missing datafile\nRESTORE DATAFILE '\/u01\/app\/oracle\/oradata\/ORCL\/users01.dbf';\n\n-- Alternative: restore by file number\nRESTORE DATAFILE 5;\n\n-- Recover the datafile (applies archivelogs to bring it current)\nRECOVER DATAFILE '\/u01\/app\/oracle\/oradata\/ORCL\/users01.dbf';\n\n-- Alternative: recover by file number\nRECOVER DATAFILE 5;<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Step 4: Bring the datafile back online\nsqlplus \/ as sysdba\n\nALTER DATABASE DATAFILE '\/u01\/app\/oracle\/oradata\/ORCL\/users01.dbf' ONLINE;\n\n-- Verify\nSELECT file#, name, status FROM v$datafile WHERE file# = 5;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">9.3 \u2014 Complete Database Recovery (All Datafiles Lost)<\/h4>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>Scenario:<\/strong> Complete database loss \u2014 all datafiles, redo logs, and possibly control files are gone. Server rebuilt on same or new hardware. This is the worst-case scenario.<\/p>\n<\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code># Step 1: Set Oracle environment\nexport ORACLE_SID=ORCL\nexport ORACLE_HOME=\/u01\/app\/oracle\/product\/19.3.0\/dbhome_1\n\n# Step 2: Create required directories if they do not exist\nmkdir -p \/u01\/app\/oracle\/oradata\/ORCL\nmkdir -p \/u01\/app\/oracle\/fast_recovery_area\nmkdir -p \/u01\/app\/oracle\/admin\/ORCL\/adump\n\n# Step 3: Start RMAN and connect to target\nrman target \/<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Step 4: Start instance in NOMOUNT (only init.ora\/spfile needed)\n-- If spfile is also lost, create a minimal pfile first\nSTARTUP NOMOUNT;\n\n-- Step 5: Restore the SPFILE from autobackup\n-- Replace &lt;DBID&gt; with your actual database ID\nSET DBID &lt;DBID&gt;;\nRESTORE SPFILE FROM AUTOBACKUP;\n\n-- Restart with restored spfile\nSTARTUP FORCE NOMOUNT;\n\n-- Step 6: Restore control file from autobackup\nRESTORE CONTROLFILE FROM AUTOBACKUP;\n\n-- Step 7: Mount the database\nALTER DATABASE MOUNT;\n\n-- Step 8: Restore the entire database\nRESTORE DATABASE;\n\n-- Step 9: Recover the database (apply archivelogs)\nRECOVER DATABASE;\n\n-- Step 10: Open database with RESETLOGS (always required after full recovery)\nALTER DATABASE OPEN RESETLOGS;\n\n-- Step 11: Verify database is open and healthy\nSELECT name, open_mode FROM v$database;<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Step 12: Check for INVALID objects after recovery\nsqlplus \/ as sysdba\n\nSELECT COUNT(*) FROM dba_objects WHERE status = 'INVALID';\n\n-- Recompile if needed\n@?\/rdbms\/admin\/utlrp.sql<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">9.4 \u2014 Point-in-Time Recovery (PITR)<\/h4>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>Scenario:<\/strong> A user accidentally dropped a table or corrupted data at 2:00 PM and you need to recover the database to 1:55 PM. PITR restores the database to a specific point in time, recovering all data that existed at that moment.<\/p>\n<\/blockquote>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\u26a0\ufe0f <strong>IMPORTANT:<\/strong> PITR recovers the ENTIRE database to a point in time \u2014 all changes after that time are lost across the entire database. If only one tablespace or table needs recovery, use Flashback (if enabled) or Tablespace PITR instead.<\/p>\n<\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>rman target \/<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Identify the target time or SCN\n-- First check what time the problem occurred\n-- Ask user when they ran the bad statement\n\n-- Option A: Recovery to specific time\n-- Shutdown database first\nSHUTDOWN IMMEDIATE;\nSTARTUP MOUNT;\n\n-- Set time for recovery\nRUN {\n    SET UNTIL TIME \"TO_DATE('2024-01-15 13:55:00','YYYY-MM-DD HH24:MI:SS')\";\n    RESTORE DATABASE;\n    RECOVER DATABASE;\n}\n\n-- Open with RESETLOGS (mandatory after PITR)\nALTER DATABASE OPEN RESETLOGS;\n\n-- Option B: Recovery to specific SCN (more precise)\n-- Get SCN from flashback query or logminer if needed\nSHUTDOWN IMMEDIATE;\nSTARTUP MOUNT;\n\nRUN {\n    SET UNTIL SCN 1234567;\n    RESTORE DATABASE;\n    RECOVER DATABASE;\n}\n\nALTER DATABASE OPEN RESETLOGS;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">9.5 \u2014 Control File Recovery<\/h4>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>Scenario:<\/strong> All copies of the control file are lost. Database cannot start because it cannot find the control file.<\/p>\n<\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code># Step 1: Start RMAN\nrman target \/<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Step 2: Start in NOMOUNT\nSTARTUP NOMOUNT;\n\n-- Step 3: Restore control file from autobackup\n-- If you know the autobackup path:\nRESTORE CONTROLFILE FROM\n    '\/u01\/app\/oracle\/fast_recovery_area\/ORCL\/autobackup\/2024_01_15\/o1_mf_s_12345_%.bkp';\n\n-- Or restore from autobackup (RMAN searches FRA automatically)\nRESTORE CONTROLFILE FROM AUTOBACKUP;\n\n-- Or restore from specific backup set\nRESTORE CONTROLFILE FROM BACKUPSET &lt;key&gt;;\n\n-- Step 4: Mount the database\nALTER DATABASE MOUNT;\n\n-- Step 5: Recover database (apply archivelogs)\nRECOVER DATABASE;\n\n-- Step 6: Open with RESETLOGS\nALTER DATABASE OPEN RESETLOGS;\n\n-- Step 7: Resync catalog if using catalog\nRESYNC CATALOG;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">9.6 \u2014 Block Media Recovery (BMR)<\/h4>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>What is BMR?<\/strong> Block Media Recovery allows RMAN to recover individual corrupt blocks within a datafile without taking the datafile offline. This is the least disruptive recovery method \u2014 the tablespace stays online and other blocks in the same datafile are still accessible during recovery.<\/p>\n<\/blockquote>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>How to identify corrupt blocks?<\/strong> From alert log (<code>ORA-01578<\/code>, <code>ORA-01110<\/code>) or from <code>v$database_block_corruption<\/code>.<\/p>\n<\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>-- First identify corrupt blocks\nsqlplus \/ as sysdba\n\nset linesize 200\nset pagesize 100\ncol corruption_type for a20\n\nSELECT file#, block#, blocks, corruption_type\nFROM   v$database_block_corruption;\n\n-- Also check alert log for ORA-01578 errors\nEXIT;<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>rman target \/<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Recover specific corrupt blocks (database stays OPEN)\n-- Syntax: RECOVER DATAFILE &lt;file#&gt; BLOCK &lt;block#&gt;\n\n-- Example: recover blocks 100-105 in datafile 5\nRECOVER DATAFILE 5 BLOCK 100, 101, 102, 103, 104, 105;\n\n-- Example: recover a range of blocks\nRECOVER DATAFILE 5 BLOCK 100 TO 105;\n\n-- Recover all corrupt blocks found in v$database_block_corruption\nRECOVER CORRUPTION LIST;\n\n-- After BMR -- verify corruption is cleared<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Verify no corrupt blocks remain\nsqlplus \/ as sysdba\nSELECT file#, block#, blocks, corruption_type\nFROM   v$database_block_corruption;\n-- Should return no rows<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">9.7 \u2014 Tablespace Point-in-Time Recovery (TSPITR)<\/h4>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>What is TSPITR?<\/strong> Allows you to recover a specific tablespace to a point in the past while keeping the rest of the database at the current point in time. This is much less disruptive than full database PITR because only the affected tablespace is rolled back.<\/p>\n<\/blockquote>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>Limitation:<\/strong> Objects in the recovered tablespace cannot have dependencies on objects in other tablespaces (foreign keys etc.). Check dependencies before TSPITR.<\/p>\n<\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>rman target \/<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Check for dependencies that would block TSPITR\n-- Run this first to see if TSPITR is feasible\nRMAN&gt; TSPITR TABLESPACE users UNTIL TIME\n        \"TO_DATE('2024-01-15 13:55:00','YYYY-MM-DD HH24:MI:SS')\";\n\n-- Actual TSPITR execution\nRUN {\n    -- Auxiliary destination is where RMAN creates a temp instance\n    SET AUXILIARY DESTINATION '\/u01\/app\/oracle\/tspitr_aux';\n\n    RECOVER TABLESPACE users\n    UNTIL TIME \"TO_DATE('2024-01-15 13:55:00','YYYY-MM-DD HH24:MI:SS')\"\n    AUXILIARY DESTINATION '\/u01\/app\/oracle\/tspitr_aux';\n}\n\n-- After TSPITR -- tablespace is recovered and back online\n-- Verify<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>sqlplus \/ as sysdba\nSELECT tablespace_name, status FROM dba_tablespaces WHERE tablespace_name = 'USERS';\nSELECT file#, name, status FROM v$datafile WHERE ts# IN\n    (SELECT ts# FROM v$tablespace WHERE name = 'USERS');<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">10. RMAN Duplicate Database<\/h3>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>What is RMAN DUPLICATE?<\/strong> Creates a copy of a database on the same or different server. Used for:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Creating standby databases (covered in DG SOP)<\/li>\n\n\n\n<li>Creating test\/dev copies of production<\/li>\n\n\n\n<li>Database migration (to new server, new storage)<\/li>\n\n\n\n<li>Cloning for application testing<\/li>\n<\/ul>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">10.1 \u2014 Duplicate for Test\/Dev Environment<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code># On TARGET (duplicate) server -- start instance in NOMOUNT\nexport ORACLE_SID=TESTDB\nsqlplus \/ as sysdba<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>STARTUP NOMOUNT PFILE='\/u01\/app\/oracle\/product\/19.3.0\/dbhome_1\/dbs\/initTESTDB.ora';\nEXIT;<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code># From SOURCE server -- run RMAN duplicate\nrman target sys\/Oracle_123@ORCL auxiliary sys\/Oracle_123@TESTDB<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Duplicate from active database (no backup needed)\nDUPLICATE TARGET DATABASE TO testdb\n    FROM ACTIVE DATABASE\n    SPFILE\n        SET DB_UNIQUE_NAME='TESTDB'\n        SET DB_NAME='TESTDB'\n        SET DB_FILE_NAME_CONVERT=\n            '\/u01\/app\/oracle\/oradata\/ORCL',\n            '\/u01\/app\/oracle\/oradata\/TESTDB'\n        SET LOG_FILE_NAME_CONVERT=\n            '\/u01\/app\/oracle\/oradata\/ORCL',\n            '\/u01\/app\/oracle\/oradata\/TESTDB'\n        SET LOG_ARCHIVE_DEST_1=\n            'LOCATION=\/u01\/app\/oracle\/fast_recovery_area\/TESTDB'\n        SET AUDIT_FILE_DEST='\/u01\/app\/oracle\/admin\/TESTDB\/adump'\n        SET DIAGNOSTIC_DEST='\/u01\/app\/oracle'\n    NOFILENAMECHECK;\n\n-- After duplication verify new database\nRMAN&gt; CONNECT TARGET sys\/Oracle_123@TESTDB\nRMAN&gt; REPORT SCHEMA;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">11. RMAN in RAC Environment<\/h3>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>What is different about RMAN in RAC?<\/strong> In a RAC environment, RMAN can use channels on multiple nodes simultaneously for faster backup and recovery. The backup repository is shared (in the control file or catalog). Backup and recovery operations can be initiated from any node.<\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">11.1 \u2014 Configure RMAN Channels for RAC<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Connect to RAC database\nrman target \/\n\n-- Configure channels across multiple nodes\nCONFIGURE CHANNEL 1 DEVICE TYPE DISK\n    CONNECT 'sys\/Oracle_123@RACDB1'\n    FORMAT '\/u01\/app\/oracle\/fast_recovery_area\/RACDB\/backupset\/node1_%d_%T_%s_%p';\n\nCONFIGURE CHANNEL 2 DEVICE TYPE DISK\n    CONNECT 'sys\/Oracle_123@RACDB1'\n    FORMAT '\/u01\/app\/oracle\/fast_recovery_area\/RACDB\/backupset\/node1_%d_%T_%s_%p';\n\nCONFIGURE CHANNEL 3 DEVICE TYPE DISK\n    CONNECT 'sys\/Oracle_123@RACDB2'\n    FORMAT '\/u01\/app\/oracle\/fast_recovery_area\/RACDB\/backupset\/node2_%d_%T_%s_%p';\n\nCONFIGURE CHANNEL 4 DEVICE TYPE DISK\n    CONNECT 'sys\/Oracle_123@RACDB2'\n    FORMAT '\/u01\/app\/oracle\/fast_recovery_area\/RACDB\/backupset\/node2_%d_%T_%s_%p';<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">11.2 \u2014 RAC Full Backup Using Multiple Nodes<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Backup using all configured channels (runs on both nodes simultaneously)\nBACKUP AS COMPRESSED BACKUPSET\n    INCREMENTAL LEVEL 0\n    DATABASE\n    TAG 'RAC_WEEKLY_FULL'\n    PLUS ARCHIVELOG\n    DELETE INPUT;\n\nLIST BACKUP SUMMARY;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">12. Automated Backup Scripts<\/h3>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>Why automate?<\/strong> Manual backups are error-prone and easy to forget. Automate all backup types and schedule them using cron. Every production database must have automated backup scripts.<\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">12.1 \u2014 Create Full Backup Shell Script<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code># Create full backup script\nvi \/u01\/app\/oracle\/admin\/ORCL\/scripts\/rman_full_backup.sh<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>#!\/bin\/bash<\/strong>\n# -------------------------------------------------------\n# RMAN Full Backup Script \u2014 Level 0\n# Schedule: Every Sunday at 01:00 AM\n# File: \/u01\/app\/oracle\/admin\/ORCL\/scripts\/rman_full_backup.sh\n# -------------------------------------------------------\n\n# Set Oracle environment\nexport ORACLE_BASE=\/u01\/app\/oracle\nexport ORACLE_HOME=\/u01\/app\/oracle\/product\/19.3.0\/dbhome_1\nexport ORACLE_SID=ORCL\nexport PATH=$ORACLE_HOME\/bin:$PATH\nexport LD_LIBRARY_PATH=$ORACLE_HOME\/lib:\/lib:\/usr\/lib\n\n# Log file location\nLOG_DIR=\/u01\/app\/oracle\/admin\/ORCL\/rman_logs\nmkdir -p $LOG_DIR\nLOG_FILE=$LOG_DIR\/rman_full_$(date +%Y%m%d_%H%M%S).log\n\n# Run RMAN full backup\n$ORACLE_HOME\/bin\/rman target \/ &lt;&lt; EOF &gt;&gt; $LOG_FILE 2&gt;&amp;1\n\n-- Log the backup start time\nSQL \"SELECT TO_CHAR(SYSDATE,''YYYY-MM-DD HH24:MI:SS'') start_time FROM dual\";\n\n-- Full Level 0 backup\nBACKUP AS COMPRESSED BACKUPSET\n    INCREMENTAL LEVEL 0\n    DATABASE\n    FORMAT '\/u01\/app\/oracle\/fast_recovery_area\/ORCL\/backupset\/full_%d_%T_%s_%p'\n    TAG 'WEEKLY_FULL_BACKUP'\n    PLUS ARCHIVELOG\n    FORMAT '\/u01\/app\/oracle\/fast_recovery_area\/ORCL\/archivelog\/arch_%d_%T_%s_%p'\n    DELETE INPUT;\n\n-- Delete obsolete backups\nDELETE NOPROMPT OBSOLETE;\n\n-- List backup summary\nLIST BACKUP SUMMARY;\n\n-- Log the backup end time\nSQL \"SELECT TO_CHAR(SYSDATE,''YYYY-MM-DD HH24:MI:SS'') end_time FROM dual\";\n\nEXIT;\nEOF\n\n# Check if backup succeeded\nRMAN_EXIT=$?\nif &#91; $RMAN_EXIT -eq 0 ]; then\n    echo \"$(date): RMAN full backup completed successfully\" &gt;&gt; $LOG_FILE\nelse\n    echo \"$(date): RMAN full backup FAILED with exit code $RMAN_EXIT\" &gt;&gt; $LOG_FILE\n    # Send alert email if mail is configured\n    echo \"RMAN full backup FAILED for ORCL on $(hostname)\" | \\\n        mail -s \"RMAN BACKUP FAILURE - $(hostname) - $(date)\" dba@company.com\nfi\n\n# Keep log files for 30 days\nfind $LOG_DIR -name \"rman_full_*.log\" -mtime +30 -delete\n\nexit $RMAN_EXIT<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>chmod 750 \/u01\/app\/oracle\/admin\/ORCL\/scripts\/rman_full_backup.sh<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">12.2 \u2014 Create Incremental Backup Shell Script<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>vi \/u01\/app\/oracle\/admin\/ORCL\/scripts\/rman_incr_backup.sh<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>#!\/bin\/bash<\/strong>\n# -------------------------------------------------------\n# RMAN Incremental Backup Script \u2014 Level 1 Cumulative\n# Schedule: Monday-Saturday at 01:00 AM\n# File: \/u01\/app\/oracle\/admin\/ORCL\/scripts\/rman_incr_backup.sh\n# -------------------------------------------------------\n\nexport ORACLE_BASE=\/u01\/app\/oracle\nexport ORACLE_HOME=\/u01\/app\/oracle\/product\/19.3.0\/dbhome_1\nexport ORACLE_SID=ORCL\nexport PATH=$ORACLE_HOME\/bin:$PATH\nexport LD_LIBRARY_PATH=$ORACLE_HOME\/lib:\/lib:\/usr\/lib\n\nLOG_DIR=\/u01\/app\/oracle\/admin\/ORCL\/rman_logs\nmkdir -p $LOG_DIR\nLOG_FILE=$LOG_DIR\/rman_incr_$(date +%Y%m%d_%H%M%S).log\n\n$ORACLE_HOME\/bin\/rman target \/ &lt;&lt; EOF &gt;&gt; $LOG_FILE 2&gt;&amp;1\n\nSQL \"SELECT TO_CHAR(SYSDATE,''YYYY-MM-DD HH24:MI:SS'') start_time FROM dual\";\n\nBACKUP AS COMPRESSED BACKUPSET\n    INCREMENTAL LEVEL 1 CUMULATIVE\n    DATABASE\n    FORMAT '\/u01\/app\/oracle\/fast_recovery_area\/ORCL\/backupset\/incr_%d_%T_%s_%p'\n    TAG 'DAILY_INCR_BACKUP'\n    PLUS ARCHIVELOG\n    FORMAT '\/u01\/app\/oracle\/fast_recovery_area\/ORCL\/archivelog\/arch_%d_%T_%s_%p'\n    DELETE INPUT;\n\nDELETE NOPROMPT OBSOLETE;\n\nLIST BACKUP SUMMARY;\n\nSQL \"SELECT TO_CHAR(SYSDATE,''YYYY-MM-DD HH24:MI:SS'') end_time FROM dual\";\n\nEXIT;\nEOF\n\nRMAN_EXIT=$?\nif &#91; $RMAN_EXIT -ne 0 ]; then\n    echo \"$(date): RMAN incremental backup FAILED with exit code $RMAN_EXIT\" &gt;&gt; $LOG_FILE\n    echo \"RMAN incremental backup FAILED for ORCL on $(hostname)\" | \\\n        mail -s \"RMAN BACKUP FAILURE - $(hostname) - $(date)\" dba@company.com\nfi\n\nfind $LOG_DIR -name \"rman_incr_*.log\" -mtime +30 -delete\nexit $RMAN_EXIT<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>chmod 750 \/u01\/app\/oracle\/admin\/ORCL\/scripts\/rman_incr_backup.sh<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">12.3 \u2014 Create Archivelog Backup Script<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>vi \/u01\/app\/oracle\/admin\/ORCL\/scripts\/rman_arch_backup.sh<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>#!\/bin\/bash<\/strong>\n# -------------------------------------------------------\n# RMAN Archivelog Backup Script\n# Schedule: Every 4 hours (00:00, 04:00, 08:00, 12:00, 16:00, 20:00)\n# File: \/u01\/app\/oracle\/admin\/ORCL\/scripts\/rman_arch_backup.sh\n# -------------------------------------------------------\n\nexport ORACLE_BASE=\/u01\/app\/oracle\nexport ORACLE_HOME=\/u01\/app\/oracle\/product\/19.3.0\/dbhome_1\nexport ORACLE_SID=ORCL\nexport PATH=$ORACLE_HOME\/bin:$PATH\nexport LD_LIBRARY_PATH=$ORACLE_HOME\/lib:\/lib:\/usr\/lib\n\nLOG_DIR=\/u01\/app\/oracle\/admin\/ORCL\/rman_logs\nmkdir -p $LOG_DIR\nLOG_FILE=$LOG_DIR\/rman_arch_$(date +%Y%m%d_%H%M%S).log\n\n$ORACLE_HOME\/bin\/rman target \/ &lt;&lt; EOF &gt;&gt; $LOG_FILE 2&gt;&amp;1\n\nBACKUP\n    ARCHIVELOG ALL\n    FORMAT '\/u01\/app\/oracle\/fast_recovery_area\/ORCL\/archivelog\/arch_%d_%T_%s_%p'\n    DELETE INPUT\n    TAG 'ARCHIVELOG_BACKUP';\n\nLIST BACKUP OF ARCHIVELOG ALL COMPLETED AFTER 'SYSDATE-1';\n\nEXIT;\nEOF\n\nRMAN_EXIT=$?\nfind $LOG_DIR -name \"rman_arch_*.log\" -mtime +7 -delete\nexit $RMAN_EXIT<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>chmod 750 \/u01\/app\/oracle\/admin\/ORCL\/scripts\/rman_arch_backup.sh<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">12.4 \u2014 Schedule Backups in Cron<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code># Edit oracle user's crontab\nsu - oracle\ncrontab -e<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Add the following cron entries:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># -------------------------------------------------------\n# Oracle RMAN Backup Schedule\n# -------------------------------------------------------\n\n# Full backup every Sunday at 1:00 AM\n0 1 * * 0 \/u01\/app\/oracle\/admin\/ORCL\/scripts\/rman_full_backup.sh\n\n# Incremental backup Monday-Saturday at 1:00 AM\n0 1 * * 1-6 \/u01\/app\/oracle\/admin\/ORCL\/scripts\/rman_incr_backup.sh\n\n# Archivelog backup every 4 hours\n0 0,4,8,12,16,20 * * * \/u01\/app\/oracle\/admin\/ORCL\/scripts\/rman_arch_backup.sh<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code># Verify crontab\ncrontab -l<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">13. Post-Backup Verification Checks<\/h3>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\u26a0\ufe0f <strong>IMPORTANT:<\/strong> Never assume a backup succeeded just because the script ran. Verify backup completion every day. A backup that silently fails is the worst possible situation \u2014 you only discover it when you need to recover.<\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">13.1 \u2014 Verify Latest Backup Exists and Is Recent<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>rman target \/<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Check most recent backups\nRMAN&gt; LIST BACKUP COMPLETED AFTER 'SYSDATE-1' SUMMARY;\n\n-- Check specific backup completion\nRMAN&gt; LIST BACKUP OF DATABASE COMPLETED AFTER 'SYSDATE-2';\nRMAN&gt; LIST BACKUP OF ARCHIVELOG ALL COMPLETED AFTER 'SYSDATE-1';\nRMAN&gt; LIST BACKUP OF CONTROLFILE COMPLETED AFTER 'SYSDATE-1';<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">13.2 \u2014 Check Backup Status via SQL<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>sqlplus \/ as sysdba\n\nset linesize 200\nset pagesize 100\ncol input_type       for a25\ncol status           for a25\ncol start_time       for a25\ncol end_time         for a25\ncol input_bytes_gb   for 9999.99\ncol output_bytes_gb  for 9999.99\ncol output_device_type for a15\n\n-- Recent RMAN backup jobs\nSELECT input_type,\n       status,\n       TO_CHAR(start_time,'YYYY-MM-DD HH24:MI:SS')  start_time,\n       TO_CHAR(end_time,'YYYY-MM-DD HH24:MI:SS')    end_time,\n       input_bytes\/1024\/1024\/1024                    input_bytes_gb,\n       output_bytes\/1024\/1024\/1024                   output_bytes_gb,\n       output_device_type\nFROM   v$rman_backup_job_details\nWHERE  start_time &gt; SYSDATE - 7\nORDER BY start_time DESC;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">13.3 \u2014 Check for Failed Backup Jobs<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Check for any FAILED backup jobs\nset linesize 200\nset pagesize 100\ncol input_type for a25\ncol status     for a25\ncol start_time for a25\ncol end_time   for a25\n\nSELECT input_type, status,\n       TO_CHAR(start_time,'YYYY-MM-DD HH24:MI:SS') start_time,\n       TO_CHAR(end_time,  'YYYY-MM-DD HH24:MI:SS') end_time\nFROM   v$rman_backup_job_details\nWHERE  status  != 'COMPLETED'\nAND    start_time &gt; SYSDATE - 7\nORDER BY start_time DESC;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>What to look for:<\/strong> No rows with status <code>FAILED<\/code> or <code>COMPLETED WITH WARNINGS<\/code>. If any failed jobs exist \u2014 investigate immediately.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">13.4 \u2014 Verify FRA Space After Backup<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>sqlplus \/ as sysdba\n\nset linesize 200\nset pagesize 100\ncol file_type                for a30\ncol percent_space_used       for 999.99\ncol percent_space_reclaimable for 999.99\ncol number_of_files          for 999999\n\nSELECT file_type,\n       percent_space_used,\n       percent_space_reclaimable,\n       number_of_files\nFROM   v$recovery_area_usage\nORDER BY file_type;\n\n-- Overall FRA usage\nSELECT name,\n       space_limit\/1024\/1024\/1024       space_limit_gb,\n       space_used\/1024\/1024\/1024        space_used_gb,\n       space_reclaimable\/1024\/1024\/1024 space_reclaimable_gb\nFROM   v$recovery_file_dest;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">13.5 \u2014 Verify Backup Is Restorable (Weekly Validation)<\/h4>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\ud83d\udcdd <strong>Why validate weekly?<\/strong> Just because RMAN wrote a backup does not mean the backup is readable. Backup media can corrupt silently. Run VALIDATE weekly to confirm backups are actually restorable.<\/p>\n<\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>rman target \/<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Validate most recent backup without actually restoring\nRMAN&gt; RESTORE DATABASE VALIDATE;\n\n-- This reads every backup piece and validates every block\n-- Output should show: Total blocks examined: XXXXX\n--                     Blocks declared corrupt: 0\n\n-- Validate specific backup set\nRMAN&gt; VALIDATE BACKUPSET &lt;backupset_key&gt;;\n\n-- Check for corruption found during validation<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>sqlplus \/ as sysdba\nSELECT file#, block#, blocks, corruption_type\nFROM   v$database_block_corruption;\n-- Should return no rows<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">13.6 \u2014 Check Alert Log for RMAN Errors<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code># Scan alert log for RMAN-related errors\ntail -300 \/u01\/app\/oracle\/diag\/rdbms\/orcl\/ORCL\/trace\/alert_ORCL.log \\\n     | grep -E \"RMAN-|ORA-|archiver|cannot archive\"\n\n# Convention B\ntail -300 \/oracle\/diag\/rdbms\/orcl\/ORCL\/trace\/alert_ORCL.log \\\n     | grep -E \"RMAN-|ORA-|archiver|cannot archive\"<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">13.7 \u2014 Check Backup Log Files<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code># Check latest RMAN log for errors\nls -lt \/u01\/app\/oracle\/admin\/ORCL\/rman_logs\/ | head -5\n\n# View latest log\ntail -50 \/u01\/app\/oracle\/admin\/ORCL\/rman_logs\/rman_full_*.log | head -50\n\n# Search for errors in log\ngrep -E \"RMAN-|ORA-|error|failed|ERROR\" \\\n    \/u01\/app\/oracle\/admin\/ORCL\/rman_logs\/rman_full_*.log<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">13.8 \u2014 Verify Controlfile Autobackup Exists<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>rman target \/<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>-- List control file autobackups\nRMAN&gt; LIST BACKUP OF CONTROLFILE;\n\n-- Crosscheck controlfile backups\nRMAN&gt; CROSSCHECK BACKUP OF CONTROLFILE;\nRMAN&gt; LIST EXPIRED BACKUP OF CONTROLFILE;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">13.9 \u2014 Check Database Backup Coverage<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>rman target \/<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>-- Report files that are NOT backed up\n-- Any files listed here need immediate backup attention\nRMAN&gt; REPORT NEED BACKUP;\n\n-- Report files with no backup\nRMAN&gt; REPORT UNRECOVERABLE;\n\n-- Check database recoverability\n-- This checks if all archivelogs needed for recovery are available\nRMAN&gt; RESTORE DATABASE PREVIEW SUMMARY;<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">14. Quick Reference Card<\/h3>\n\n\n\n<figure class=\"wp-block-table has-small-font-size\"><table><thead><tr><th>Task<\/th><th>Command<\/th><\/tr><\/thead><tbody><tr><td>Connect RMAN (no catalog)<\/td><td><code>rman target \/<\/code><\/td><\/tr><tr><td>Connect RMAN (with catalog)<\/td><td><code>rman target \/ catalog rman_user\/pwd@RMANCAT<\/code><\/td><\/tr><tr><td>Show RMAN config<\/td><td><code>RMAN&gt; SHOW ALL;<\/code><\/td><\/tr><tr><td>Configure retention<\/td><td><code>CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;<\/code><\/td><\/tr><tr><td>Enable controlfile autobackup<\/td><td><code>CONFIGURE CONTROLFILE AUTOBACKUP ON;<\/code><\/td><\/tr><tr><td>Configure parallelism<\/td><td><code>CONFIGURE DEVICE TYPE DISK PARALLELISM 4 BACKUP TYPE TO BACKUPSET;<\/code><\/td><\/tr><tr><td>Full Level 0 backup<\/td><td><code>BACKUP AS COMPRESSED BACKUPSET INCREMENTAL LEVEL 0 DATABASE PLUS ARCHIVELOG DELETE INPUT;<\/code><\/td><\/tr><tr><td>Daily Level 1 backup<\/td><td><code>BACKUP AS COMPRESSED BACKUPSET INCREMENTAL LEVEL 1 CUMULATIVE DATABASE PLUS ARCHIVELOG DELETE INPUT;<\/code><\/td><\/tr><tr><td>Archivelog backup<\/td><td><code>BACKUP ARCHIVELOG ALL DELETE INPUT;<\/code><\/td><\/tr><tr><td>Backup controlfile<\/td><td><code>BACKUP CURRENT CONTROLFILE;<\/code><\/td><\/tr><tr><td>Backup spfile<\/td><td><code>BACKUP SPFILE;<\/code><\/td><\/tr><tr><td>Backup tablespace<\/td><td><code>BACKUP TABLESPACE users;<\/code><\/td><\/tr><tr><td>List backup summary<\/td><td><code>LIST BACKUP SUMMARY;<\/code><\/td><\/tr><tr><td>List backups last 7d<\/td><td><code>LIST BACKUP COMPLETED AFTER 'SYSDATE-7' SUMMARY;<\/code><\/td><\/tr><tr><td>Crosscheck backups<\/td><td><code>CROSSCHECK BACKUP;<\/code><\/td><\/tr><tr><td>Validate backup<\/td><td><code>RESTORE DATABASE VALIDATE;<\/code><\/td><\/tr><tr><td>Report need backup<\/td><td><code>REPORT NEED BACKUP;<\/code><\/td><\/tr><tr><td>Report unrecoverable<\/td><td><code>REPORT UNRECOVERABLE;<\/code><\/td><\/tr><tr><td>Report schema<\/td><td><code>REPORT SCHEMA;<\/code><\/td><\/tr><tr><td>Delete obsolete<\/td><td><code>DELETE NOPROMPT OBSOLETE;<\/code><\/td><\/tr><tr><td>Delete expired<\/td><td><code>DELETE NOPROMPT EXPIRED BACKUP;<\/code><\/td><\/tr><tr><td>Restore datafile<\/td><td><code>RESTORE DATAFILE 5; RECOVER DATAFILE 5;<\/code><\/td><\/tr><tr><td>Full DB restore<\/td><td><code>RESTORE DATABASE; RECOVER DATABASE; ALTER DATABASE OPEN RESETLOGS;<\/code><\/td><\/tr><tr><td>PITR by time<\/td><td><code>SET UNTIL TIME \"TO_DATE('...')\"; RESTORE DATABASE; RECOVER DATABASE;<\/code><\/td><\/tr><tr><td>PITR by SCN<\/td><td><code>SET UNTIL SCN 1234567; RESTORE DATABASE; RECOVER DATABASE;<\/code><\/td><\/tr><tr><td>Block recovery<\/td><td><code>RECOVER DATAFILE 5 BLOCK 100;<\/code><\/td><\/tr><tr><td>Corrupt block list<\/td><td><code>RECOVER CORRUPTION LIST;<\/code><\/td><\/tr><tr><td>TSPITR<\/td><td><code>RECOVER TABLESPACE users UNTIL TIME \"...\" AUXILIARY DESTINATION '...';<\/code><\/td><\/tr><tr><td>Control file restore<\/td><td><code>RESTORE CONTROLFILE FROM AUTOBACKUP;<\/code><\/td><\/tr><tr><td>Duplicate database<\/td><td><code>DUPLICATE TARGET DATABASE TO testdb FROM ACTIVE DATABASE ...;<\/code><\/td><\/tr><tr><td>Register DB in catalog<\/td><td><code>REGISTER DATABASE;<\/code><\/td><\/tr><tr><td>Resync catalog<\/td><td><code>RESYNC CATALOG;<\/code><\/td><\/tr><tr><td>Check FRA usage (SQL)<\/td><td><code>SELECT file_type,percent_space_used FROM v$recovery_area_usage;<\/code><\/td><\/tr><tr><td>Check backup jobs (SQL)<\/td><td><code>SELECT input_type,status,start_time FROM v$rman_backup_job_details WHERE start_time&gt;SYSDATE-7;<\/code><\/td><\/tr><tr><td>Check block corruption<\/td><td><code>SELECT file#,block#,corruption_type FROM v$database_block_corruption;<\/code><\/td><\/tr><tr><td>MOS RMAN Best Practices<\/td><td>Doc ID 1513912.1<\/td><\/tr><tr><td>MOS RMAN Performance<\/td><td>Doc ID 1116108.1<\/td><\/tr><tr><td>MOS RMAN 19c<\/td><td>Doc ID 2505669.1<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"wp-block-paragraph\">This SOP covers everything you need to configure, run, and manage Oracle RMAN backup and recovery on Linux without referring to any other source. Always verify FRA space before backup, always enable controlfile autobackup, always validate your backups weekly to confirm they are restorable, always automate backups with cron scripts and check the logs daily, and always test your recovery procedures in a non-production environment before you ever need them in production.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A complete production-ready SOP for Oracle RMAN backup and recovery on Linux. Covers RMAN configuration, full and incremental backups, archivelog backups, backup to tape, RMAN catalog setup, point-in-time recovery, tablespace and datafile recovery, block media recovery, RMAN duplicate, crosscheck and validation, backup encryption, and full post-backup validation \u2014 with real commands, expected outputs, and consultant-level [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":5794,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"googlesitekit_rrm_CAowu461DA:productID":"","footnotes":""},"categories":[1534],"tags":[],"class_list":["post-5793","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oracle-sop"],"_links":{"self":[{"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/posts\/5793","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/comments?post=5793"}],"version-history":[{"count":3,"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/posts\/5793\/revisions"}],"predecessor-version":[{"id":5810,"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/posts\/5793\/revisions\/5810"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/media\/5794"}],"wp:attachment":[{"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/media?parent=5793"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/categories?post=5793"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/w3buddy.com\/blog\/wp-json\/wp\/v2\/tags?post=5793"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}