RMAN -Practicals / CATALOG

RMAN

Connecting to RMAN
1.Open the DOS command prompt.
2.C:>rman
3.RMAN>
4.RMAN>exit
Connecting to the target database
1.Open the DOS command prompt.
2.C:>SET ORACLE_SID=kendb
3.RMAN> connect target
Or
rman target / NOCATALOG
Or
rman target/
4.RMAN>exit
Creating the Repository in the Recovery Catalog Database
RMAN repository in a separate database called RCMDB.
Add entry in tnsnames.ora file.
Make sure RCMDB is in ArchiveLog Mode.
Make sure Target Database (KENDB) is in archivelog mode.

  1. sqlplus to RCMDB as SYSDBA
    Set oracle_sid=RCMDB
    Sqlplus ì/as sysdbaî
    Sql>select name from v$database; (Verify you connected to rcmdb)
  2. CREATE USER RMANUSER
    IDENTIFIED BY RMANUSER
    DEFAULT TABLESPACE USERS
    TEMPORARY TABLESPACE TEMP;
  3. sql>grant connect, resource,recovery_catalog_owner to rmanuser;
    4.sql>exit;
  4. Invoke RMAN executable
    RMAN
    RMAN>connect catalog rmanuser/[email protected]
  5. Create catalog for RMANUSER
    RMAN>CREATE CATALOG;
  6. RMAN>EXIT;
    Connecting to Target and Recovery Catalog Database
  7. C:>set oracle_sid=TESTDB
  8. C:>RMAN
  9. RMAN>CONNECT TARGET
  10. RMAN>CONNECT CATALOG RMANUSER/[email protected]
  11. RMAN>EXIT;
    Or
    Instead or step3,4 and 5 You can use following:
    C:>RMAN TARGET / CATALOG RMANUSER/[email protected]
    Registering the Target Database.
  12. C:>SET ORACLE_SID=TESTDB
  13. C:>RMAN
  14. RMAN>CONNECT TARGET
  15. RMAN>CONNECT CATALOG RMANUSER/[email protected]
  16. RMAN>REGISTER DATABASE;
  17. RMAN>EXIT;
    Setting the Retention Policy
  18. Launch RMAN again
  19. C:>rman target/
  20. RMAN>configure retention policy to redundancy 2;
  21. RMAN>show retention policy;
  22. RMAN>configure retention policy to recovery window of 3 days;
  23. RMAN>configure retention policy clear;
  24. RMAN>exit;
    Configuring the Default Device Type
  25. C>rman target/
  26. RMAN>configure default device type to sbt; (for tape)
  27. RMAN>configure default device type to disk;
  28. RMAN>show default device type;
  29. RMAN>configure default device type clear;
  30. RMAN>exit;
    format for device type disk
    Configuring Controlfile Autobackup
  31. C>rman target/
  32. RMAN>configure controlfile autobackup on;
  33. RMAN> configure controlfile autobackup format for device type disk to ‘f:\backup\kendb\rman\%F’;
  34. RMAN>show controlfile autobackup;
  35. RMAN>show controlfile autobackup format;
  36. RMAN>configure controlfile autobackup clear;
  37. RMAN>configure controlfile autobackup format for device type disk clear;
  38. RMAN>exit;
    Configuring the Default Backup Type
  39. C>rman target/
  40. RMAN>configure device type disk backup type to backupset;
  41. RMAN>configure device type disk backup type to copy;
  42. RMAN>configure device type disk backup type to compressed backupset;
  43. RMAN>show device type;
  44. RMAN>backup database;
  45. RMAN>list backup;
  46. RMAN>configure device type disk clear;
  47. RMAN>exit;
    Parallelizing backups
  48. C>set oracle_sid=kendb
  49. C>rman target/
  50. RMAN>configure device type disk parallelism 4;
  51. RMAN>backup datafile 2, 3;
    RMAN>exit
    Backup entire Database
  52. C>set oracle_sid=kendb
  53. C>rman
  54. RMAN>CONNECT TARGET
  55. RMAN>CONNECT CATALOG RMANUSER/[email protected];
  56. RMAN>CONFIGURE DEVICE TYPE DISK CLEAR;
  57. RMAN>BACKUP DATABASE;
    OR
  58. RMAN> BACKUP DATABASE FORMAT ëO:\ORABACKUP\KENDB\BACKUP.RMAN\db_%u_%d_%s_%pí;
    OR
  59. RMAN>BACKUP DATABASE MAXSETSIZE=500M;
  60. RMAN>EXIT;
    Backup Tablespace
  61. C>set oracle_sid=kendb
  62. C>rman target/
  63. RMAN>backup tablespace system;
  64. RMAN>backup tablespace system, sysaux;
    Backup Datafile
  65. C>set oracle_sid=kendb
  66. C>rman target/
  67. RMAN>report schema;
  68. RMAN>backup datafile 3;
  69. RMAN>backup datafile 2,4;
  70. RMAN>exit;
    Backup Controlfile
  71. C>rman target/
  72. RMAN>backup current controlfile;
  73. RMAN>exit;
    Creating Compressed Backups
  74. C>set oracle_sid=kendb
  75. C>rman target/
  76. RMAN>backup as compressed backupset datafile 3;
    RMAN>exit;
    Backup ArchiveLogs
  77. C>set oracle_sid=kendb
  78. C>rman
  79. RMAN>backup archivelog all;
    OR
  80. RMAN>backup archivelog all delete input;
    (This deletes archivelog files after they have been backed up.)
  81. Backup Archivelogs generated in the past 2 days.
  82. RMAN>backup archivelog from time ësysdate-2í until time ësysdateí;
  83. RMAN>exit;
    Performing Incremental Backups
  84. C>set oracle_sid=kendb
  85. C>rman target/
  86. RMAN>backup incremental level 0 database;
    Incremental backups may be taken at Tablespace or datafile level.
    OR
  87. RMAN>BACKUP INCREMENTAL LEVEL 0 DATAFILE 2, 4;
  88. RMAN>BACKUP INCREMENTAL LEVEL 0 TABLESPACE USERS;
    Create Incremental Level 1 backups
  89. RMAN>backup incremental level 1 tablespace users;
  90. RMAN>backup incremental level 1 database;
    Create Cumulative Level 1 backups
  91. RMAN>backup incremental level 1 cumulative tablespace users;
  92. RMAN>backup incremental level 1 cumulative database;
  93. RMAN>backup incremental level 1 cumulative datafile 2, 4;
  94. RMAN>exit;
    Create Image Copies
  95. C>set oracle_sid=kendb
  96. C>rman target/
  97. RMAN>backup as copy database;
    OR
  98. RMAN>backup as copy tag ìusers_wkly_bkpî tablespace users;
    OR
  99. RMAN>backup as copy datafile 4;
  100. RMAN>exit;
    LIST COMMAND
    Which backups are currently available.
  101. C>set oracle_sid=kendb
  102. C>rman target/
  103. rman>list backup by backup;
  104. rman>list backupset by backup;
  105. rman>list backup by backup verbose;
  106. rman>list backup by backup summary;
  107. rman>list backup by file;
  108. rman>list copy of database; ?image copies
  109. rman>list copy of tablespace users;
  110. rman>list copy of datafile 3;
  111. rman>list incarnation; ?to view different incarnation
    Identify files that are in need of backup
  112. c>set oracle_sid=kendb
  113. c>rman target/
  114. rman>configure retention policy to redundancy 2;
  115. rman> report need backup;
  116. rman> report need backup days=7 database; ?files that need a minimum of 7 days of logfiles to be applied in the event of recovery.
  117. rman>exit;
    Report Obsolete
  118. c>set oracle_sid=kendb
  119. c> rman target/
  120. rman> report obsolete;
  121. rman> delete obsolete;
  122. rman>exit;