ITPub博客

首页 > 数据库 > Oracle > oracle 透明加密

oracle 透明加密

原创 Oracle 作者:fei890910 时间:2016-04-26 15:42:07 0 删除 编辑
一、sqlnet.ora文件添加wallet路径
beijing:/u01/app/oracle/admin/prod/wallet$ more /u01/app/oracle/product/11.1.0/db_1/network/admin/sqlnet.ora 
# sqlnet.ora Network Configuration File: /u01/app/oracle/product/11.1.0/db_1/network/admin/sqlnet.ora
# Generated by Oracle configuration tools.


NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)


ENCRYPTION_WALLET_LOCATION=(SOURCE=(METHOD=FILE)(METHOD_DATA=(DIRECTORY=/u01/app/oracle/admin/prod/wallet )
))
beijing:/u01/app/oracle/admin/prod/wallet$ 
二、打开透明加密功能
beijing:/u01/app/oracle/product/11.1.0/db_1/network/admin$ sqlplus / as sysdba


SQL*Plus: Release 11.1.0.6.0 - Production on Mon Apr 25 15:13:09 2016


Copyright (c) 1982, 2007, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> 
SQL> alter system set encryption key authenticated by "abcde";

System altered.


SQL> 
SQL> 
三、在wallet里产生一个密码文件
beijing:/u01/app/oracle/admin/prod/wallet$ 
beijing:/u01/app/oracle/admin/prod/wallet$ ll
total 4
-rw-r--r-- 1 oracle oinstall 1693 Apr 25 15:13 ewallet.p12
beijing:/u01/app/oracle/admin/prod/wallet$ 
beijing:/u01/app/oracle/admin/prod/wallet$ 
SQL> r
  1* select * from dba_encrypted_columns


OWNER      TABLE_NAME COLUMN_NAM ENCRYPTION_ALG                SAL
---------- ---------- ---------- ----------------------------- ---
SCOTT      T          INFO       AES 192 bits key              YES

SQL> 
SQL> 
SQL> insert into t values(1,'abcde');


1 row created.


SQL> commit;


Commit complete.


SQL> 


四、关闭wallet,加密列无法查询

SQL> alter system set wallet close identified by "abcde";
alter system set wallet close identified by "abcde"
                              *
ERROR at line 1:
ORA-28364: invalid wallet operation
SQL> alter system set wallet close;


System altered.


SQL> 




SQL> select * from t;  
select * from t
              *
ERROR at line 1:
ORA-28365: wallet is not open






SQL> select id from t;


        ID
----------
         1


SQL> 
SQL> 
SQL> 
SQL> 


SQL> alter system set wallet open identified by "abcde";


System altered.


SQL> 
SQL> 
SQL> col info for a20
SQL> r
  1* select * from t


        ID INFO
---------- --------------------
         1 abcde


SQL> 


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

下一篇: Data guard搭建
请登录后发表评论 登录
全部评论

注册时间:2013-08-15

  • 博文量
    122
  • 访问量
    811201