新网创想网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
实验:创建加密表空间,并插入测试数据
一:查看现有wallet
SQL> select * from v$encryption_wallet;
WRL_TYPE WRL_PARAMETER STATUS
-------------------- ----------------------------------- ------------------
file
/u01/app/oracle/admin/orcl/wallet
CLOSED
二:创建目录
SQL> ho mkdir /u01/app/oracle/admin/orcl/wallet
三:创建加密KEY
SQL> alter system set encryption key identified by oracle;
四:查看现有wallet状态
SQL> select * from v$encryption_wallet;
WRL_TYPE WRL_PARAMETER STATUS
-------------------- ----------------------------------- ------------------
file /u01/app/oracle/admin/orcl/wallet
OPEN
五:创建加密表空间
SQL> create tablespace test_encrypt datafile '/u01/app/oracle/oradata/orcl/test_encrypt01.dbf' size 10M encryption default storage(encrypt);
Tablespace created.
SQL> SELECT TABLESPACE_NAME, ENCRYPTED FROM DBA_TABLESPACES;
TABLESPACE_NAME ENC
------------------------------ ---
SYSTEM NO
SYSAUX NO
UNDOTBS1 NO
TEMP NO
USERS NO
TEST_ENCRYPT YES
6 rows selected.
SQL> SELECT NAME, ENCRYPTIONALG ENCRYPTEDTS
FROM V$ENCRYPTED_TABLESPACES, V$TABLESPACE
WHERE V$ENCRYPTED_TABLESPACES.TS# = V$TABLESPACE.TS#;
NAME ENCRYPT
------------------------------ -------
TEST_ENCRYPT AES128
六:创建测试数据
SQL> create table t1(id number,name varchar2(20)) tablespace
test_encrypt;
SQL> create table t2(id number,name varchar2(20)) tablespace users;
SQL> insert into t1 values(1,'a');
SQL> commit;
SQL> insert into t2 values(2,'b');
SQL> commit;
七:重启数据库后,钱包自动关闭,并且无法查询加密表空间里的数据
SQL> shutdown immediate
SQL> startup
SQL> select * from t1;
select * from t1
*
ERROR at line 1:
ORA-28365: wallet is not open
---数据库重启后,钱包会自动关闭
SQL> select * from v$encryption_wallet;
WRL_TYPE WRL_PARAMETER STATUS
-------------------- ----------------------------------- ------------------
file /u01/app/oracle/admin/orcl/wallet
CLOSED
八:打开钱包
SQL>
alter system set wallet open identified by oracle;
System altered.
---SQL> alter system set wallet close identified by oracle;(关闭钱包)
SQL> select * from t1;
ID NAME
---------- --------------------
1 a
九:将t2表移动到加密表空间中
SQL>
alter table t2 move tablespace test_encrypt;
System altered.
湄潭网站建设公司创新互联,湄潭网站设计制作,有大型网站制作公司丰富经验。已为湄潭成百上千提供企业网站建设服务。企业网站搭建\外贸网站建设要多少钱,请找那个售后服务好的湄潭做网站的公司定做!
欢迎关注我的微信公众号"IT小Chen",共同学习,共同成长!!!