ITPub博客

首页 > 数据库 > Oracle > 透明加密 实验

透明加密 实验

原创 Oracle 作者:刘锡亚 时间:2017-04-09 18:09:04 0 删除 编辑
  1. 透明加密的前提条件是要存在钱包(wallet), 并且钱包为打开状态
  2. 创建用于保存密钥的wallet,有两种方式,一是采用图形方式,即用own命令打开图形化界面,
  3. 本次试验采用命令方式来完成


    1. 在sqlnet.ora中添加必要的信息

      点击(此处)折叠或打开

      1. [oracle@host01 ~]$ cd $ORACLE_HOME/network/admin
      2. [oracle@host01 admin]$
      3. [oracle@host01 admin]$ ls
      4. samples shrept.lst
      5. [oracle@host01 admin]$ vi sqlnet.ora
      6. wallet_location=(source=(method=file)(method_data=(directory=/u01/app/oracle)))
    2. 创建钱包设置密码

      点击(此处)折叠或打开

      1. SQL> alter system set encryption key identified by oracle;

      2. System altered.

      3. SQL> select * from v$encryption_wallet;

      4. WRL_TYPE                    WRL_PARAMETER             STATUS
      5. -------------------- -------------------- ------------------
      6. file                      /u01/app/oracle               OPEN

    3. 关闭、打开钱包

      点击(此处)折叠或打开

      1. alter system set encryption wallet close identified by oracle;

      2. System altered.

      3. SQL> select * from v$encryption_wallet;

      4. WRL_TYPE                   WRL_PARAMETER              STATUS
      5. -------------------- -------------------- ------------------
      6. file                     /u01/app/oracle              CLOSED

      7. SQL> alter system set encryption wallet open identified by oracle;

      8. System altered.

      9. SQL> select * from v$encryption_wallet;

      10. WRL_TYPE                   WRL_PARAMETER               STATUS
      11. -------------------- -------------------- ------------------
      12. file                       /u01/app/oracle              OPEN
    4. 修改RMAN参数,启用透明加密(默认为未启用)

      点击(此处)折叠或打开

      1. RMAN> show encryption for database;

      2. using target database control file instead of recovery catalog
      3. RMAN configuration parameters for database with db_unique_name PROD1 are:
      4. CONFIGURE ENCRYPTION FOR DATABASE OFF; # default

      5. RMAN> configure encryption for database on;

      6. new RMAN configuration parameters:
      7. CONFIGURE ENCRYPTION FOR DATABASE ON;
      8. new RMAN configuration parameters are successfully stored

      9. RMAN> show encryption for database;

      10. RMAN configuration parameters for database with db_unique_name PROD1 are:
      11. CONFIGURE ENCRYPTION FOR DATABASE ON;

    5. 备份users表空间(钱包为打开状态)

      点击(此处)折叠或打开

      1. RMAN> backup tablespace users;

      2. Starting backup at 07-APR-17
      3. allocated channel: ORA_DISK_1
      4. channel ORA_DISK_1: SID=43 device type=DISK
      5. ignoring encryption for proxy or image copies
      6. channel ORA_DISK_1: starting datafile copy
      7. input datafile file number=00004 name=/u01/app/oracle/oradata/PROD1/users01.dbf
      8. output file name=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/data_D-PROD1_I-2157889328_TS-USERS_FNO-4_1es14akd tag=TAG20170407T213717 RECID=9 STAMP=940714637
      9. channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
      10. Finished backup at 07-APR-17

      11. Starting Control File and SPFILE Autobackup at 07-APR-17
      12. piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/c-2157889328-20170407-0b comment=NONE
      13. Finished Control File and SPFILE Autobackup at 07-APR-17

    6. 备份users表空间(钱包为关闭状态)

      点击(此处)折叠或打开

      1. SQL> alter system set encryption wallet close identified by oracle;

      2. System altered.


    7. RMAN恢复users表空间

      点击(此处)折叠或打开

      1. RMAN> restore tablespace users;

      2. Starting restore at 09-APR-17
      3. allocated channel: ORA_DISK_1
      4. channel ORA_DISK_1: SID=18 device type=DISK

      5. channel ORA_DISK_1: starting datafile backup set restore
      6. channel ORA_DISK_1: specifying datafile(s) to restore from backup set
      7. channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/PROD1/users01.dbf
      8. channel ORA_DISK_1: reading from backup piece /u01/app/oracle/product/11.2.0/dbhome_1/dbs/03s1940i_1_1
      9. RMAN-00571: ===========================================================
      10. RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
      11. RMAN-00571: ===========================================================
      12. RMAN-03002: failure of restore command at 04/09/2017 17:19:17
      13. ORA-19870: error while restoring backup piece /u01/app/oracle/product/11.2.0/dbhome_1/dbs/03s1940i_1_1
      14. ORA-19913: unable to decrypt backup
      15. ORA-28365: wallet is not open
      16. 提示的错误很明白,钱包没有打开
    8. 打开钱包,恢复users表空间

      点击(此处)折叠或打开

      1. SQL> alter system set encryption wallet open identified by oracle;

      2. System altered.

      3. RMAN> restore tablespace users;

      4. Starting restore at 09-APR-17
      5. using target database control file instead of recovery catalog
      6. allocated channel: ORA_DISK_1
      7. channel ORA_DISK_1: SID=1 device type=DISK

      8. channel ORA_DISK_1: starting datafile backup set restore
      9. channel ORA_DISK_1: specifying datafile(s) to restore from backup set
      10. channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/PROD1/users01.dbf
      11. channel ORA_DISK_1: reading from backup piece /u01/app/oracle/product/11.2.0/dbhome_1/dbs/03s1940i_1_1
      12. channel ORA_DISK_1: piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/03s1940i_1_1 tag=TAG20170409T171458
      13. channel ORA_DISK_1: restored backup piece 1
      14. channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
      15. Finished restore at 09-APR-17


    9. 点击(此处)折叠或打开

      1. RMAN> recover tablespace users;

      2. Starting recover at 09-APR-17
      3. using channel ORA_DISK_1

      4. starting media recovery
      5. media recovery complete, elapsed time: 00:00:00

      6. Finished recover at 09-APR-17

      7. RMAN> alter database open;

      8. database opened





来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/31405405/viewspace-2136871/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: 启用块跟踪
下一篇: 密码加密 实验
请登录后发表评论 登录
全部评论

注册时间:2016-10-25

  • 博文量
    13
  • 访问量
    18653