Oracle Encrypted Tablespaces
Oracle Encrypted Tablespaces
Lab: create encrypted tablespaces and insert test data
One: view the existing wallet
SQL > select * from v$encryption_wallet
WRL_TYPE WRL_PARAMETER STATUS
File / u01/app/oracle/admin/orcl/wallet CLOSED
Two: create a directory
SQL > ho mkdir / u01/app/oracle/admin/orcl/wallet
Three: create an encrypted KEY
SQL > alter system set encryption key identified by oracle
Four: check the status of existing wallet
SQL > select * from v$encryption_wallet
WRL_TYPE WRL_PARAMETER STATUS
File / u01/app/oracle/admin/orcl/wallet OPEN
Five: create encrypted tablespaces
SQL > create tablespace test_encrypt datafile'/ u01Accord size encryption default storage 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
Six: create test data
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)
SQL > commit
SQL > insert into T2 values (2mai Zhe b')
SQL > commit
Seven: after restarting the database, the wallet automatically closes and cannot query the data in the encrypted tablespace
SQL > shutdown immediate
SQL > startup
SQL > select * from T1
Select * from T1
*
ERROR at line 1:
ORA-28365: wallet is not open
-when the database is restarted, the wallet will be closed automatically
SQL > select * from v$encryption_wallet
WRL_TYPE WRL_PARAMETER STATUS
File / u01/app/oracle/admin/orcl/wallet CLOSED
Eight: open your wallet
SQL > alter system set wallet open identified by oracle
System altered.
-SQL > alter system set wallet close identified by oracle; (close wallet)
SQL > select * from T1
ID NAME
--
1 a
Nine: move the T2 table to the encrypted tablespace
SQL > alter table T2 move tablespace test_encrypt
System altered.
Welcome to follow my Wechat official account "IT Little Chen" and learn and grow together!