Here we will see how we can password based encrypted backup.

I am taking a fresh backup using password based encryption. To know more about password based encryption of RMAN go through following article

http://oracle-help.com/backup-and-recovery/password-based-encryption-in-rman-backup/

Step 1 : Take encrypted backup using following command in RMAN


RMAN> SET ENCRYPTION ON ALGORITHM 'AES128' IDENTIFIED BY 'orarmanbkp' ONLY;

executing command: SET encryption
using target database control file instead of recovery catalog

RMAN> backup database;

Starting backup at 2019-05-23:23:03:09
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=69 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/jdb1/system01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/jdb1/sysaux01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/jdb1/undotbs01.dbf
input datafile file number=00007 name=/u01/app/oracle/oradata/jdb1/users01.dbf
channel ORA_DISK_1: starting piece 1 at 2019-05-23:23:03:19
channel ORA_DISK_1: finished piece 1 at 2019-05-23:23:05:26
piece handle=/u01/app/oracle/fast_recovery_area/jdb1/JDB1/backupset/2019_05_23/o1_mf_nnndf_TAG20190523T230317_ggfpbzvk_.bkp tag=TAG20190523T230317 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:02:07
Finished backup at 2019-05-23:23:05:26

Starting Control File and SPFILE Autobackup at 2019-05-23:23:05:29
piece handle=/u01/app/oracle/fast_recovery_area/jdb1/JDB1/autobackup/2019_05_23/o1_mf_s_1009062330_ggfph41d_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 2019-05-23:23:05:33

RMAN> 

Note : I gave “orarmanbkp” password for encryption.

Check taken backup using list backup command of RMAN .

RMAN> list backup;


List of Backup Sets
===================


BS Key  Type LV Size       Device Type Elapsed Time Completion Time    
------- ---- -- ---------- ----------- ------------ -------------------
1       Full    1019.07M   DISK        00:01:54     2019-05-23:00:18:39
        BP Key: 1   Status: AVAILABLE  Compressed: NO  Tag: TAG20190523T001644
        Piece Name: /u01/app/oracle/fast_recovery_area/jdb1/JDB1/backupset/2019_05_23/o1_mf_nnndf_TAG20190523T001644_ggc68p8k_.bkp
  List of Datafiles in backup set 1
  File LV Type Ckp SCN    Ckp Time            Abs Fuz SCN Sparse Name
  ---- -- ---- ---------- ------------------- ----------- ------ ----
  1       Full 1422947    2019-05-23:00:16:45              NO    /u01/app/oracle/oradata/jdb1/system01.dbf
  3       Full 1422947    2019-05-23:00:16:45              NO    /u01/app/oracle/oradata/jdb1/sysaux01.dbf
  4       Full 1422947    2019-05-23:00:16:45              NO    /u01/app/oracle/oradata/jdb1/undotbs01.dbf
  7       Full 1422947    2019-05-23:00:16:45              NO    /u01/app/oracle/oradata/jdb1/users01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time    
------- ---- -- ---------- ----------- ------------ -------------------
2       Full    10.19M     DISK        00:00:02     2019-05-23:00:18:46
        BP Key: 2   Status: AVAILABLE  Compressed: NO  Tag: TAG20190523T001843
        Piece Name: /u01/app/oracle/fast_recovery_area/jdb1/JDB1/autobackup/2019_05_23/o1_mf_s_1008980324_ggc6dgt1_.bkp
  SPFILE Included: Modification time: 2019-05-23:00:14:39
  SPFILE db_unique_name: JDB1
  Control File Included: Ckp SCN: 1422996      Ckp time: 2019-05-23:00:18:44

BS Key  Type LV Size       Device Type Elapsed Time Completion Time    
------- ---- -- ---------- ----------- ------------ -------------------
3       Full    1.00G      DISK        00:02:02     2019-05-23:23:05:21
        BP Key: 3   Status: AVAILABLE  Compressed: NO  Tag: TAG20190523T230317
        Piece Name: /u01/app/oracle/fast_recovery_area/jdb1/JDB1/backupset/2019_05_23/o1_mf_nnndf_TAG20190523T230317_ggfpbzvk_.bkp
  List of Datafiles in backup set 3
  File LV Type Ckp SCN    Ckp Time            Abs Fuz SCN Sparse Name
  ---- -- ---- ---------- ------------------- ----------- ------ ----
  1       Full 1526160    2019-05-23:23:03:19              NO    /u01/app/oracle/oradata/jdb1/system01.dbf
  3       Full 1526160    2019-05-23:23:03:19 1526576      NO    /u01/app/oracle/oradata/jdb1/sysaux01.dbf
  4       Full 1526160    2019-05-23:23:03:19              NO    /u01/app/oracle/oradata/jdb1/undotbs01.dbf
  7       Full 1526160    2019-05-23:23:03:19              NO    /u01/app/oracle/oradata/jdb1/users01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time    
------- ---- -- ---------- ----------- ------------ -------------------
4       Full    10.19M     DISK        00:00:02     2019-05-23:23:05:32
        BP Key: 4   Status: AVAILABLE  Compressed: NO  Tag: TAG20190523T230530
        Piece Name: /u01/app/oracle/fast_recovery_area/jdb1/JDB1/autobackup/2019_05_23/o1_mf_s_1009062330_ggfph41d_.bkp
  SPFILE Included: Modification time: 2019-05-23:23:03:07
  SPFILE db_unique_name: JDB1
  Control File Included: Ckp SCN: 1526763      Ckp time: 2019-05-23:23:05:30

RMAN> 

Let us try restoring it without giving any extra parameter for decryption.

RMAN> restore database;

Starting restore at 2019-05-23:23:32:37
using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/jdb1/system01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/jdb1/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/jdb1/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00007 to /u01/app/oracle/oradata/jdb1/users01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/jdb1/JDB1/backupset/2019_05_23/o1_mf_nnndf_TAG20190523T230317_ggfpbzvk_.bkp
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 05/23/2019 23:32:41
ORA-19870: error while restoring backup piece /u01/app/oracle/fast_recovery_area/jdb1/JDB1/backupset/2019_05_23/o1_mf_nnndf_TAG20190523T230317_ggfpbzvk_.bkp
ORA-19913: unable to decrypt backup
ORA-28365: wallet is not open

RMAN> 

We can see here it gave us an error that it is unable to decrypt the available backup and wallet is not open

Let us set decryption using the password we set to encrypt the backup.

RMAN> set decryption identified by 'orarmanbkp';

executing command: SET decryption

RMAN> 

Now lets try restoring it again .

RMAN> restore database;

Starting restore at 2019-05-23:23:36:00
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=34 device type=DISK

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/jdb1/system01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/jdb1/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/jdb1/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00007 to /u01/app/oracle/oradata/jdb1/users01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/jdb1/JDB1/backupset/2019_05_23/o1_mf_nnndf_TAG20190523T230317_ggfpbzvk_.bkp
channel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/jdb1/JDB1/backupset/2019_05_23/o1_mf_nnndf_TAG20190523T230317_ggfpbzvk_.bkp tag=TAG20190523T230317
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:01:05
Finished restore at 2019-05-23:23:37:06

RMAN> 

We can see here encrypted backup is successfully restored.

Thank you for giving your valuable time to read the above information.

If you want to be updated with all our articles send us the Invitation or Follow us:

Telegram Channel: https://t.me/helporacle

Skant Gupta’s LinkedIn: www.linkedin.com/in/skantali/

Joel Perez’s LinkedIn: Joel Perez’s Profile

LinkedIn Group: Oracle Cloud DBAAS

Facebook Page: OracleHelp

About The Author

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.