/* Encryption wallet은 데이터베이스가 shutdown 될 때마다 자동으로 닫힌다. */
난이도: ★★★☆☆
문제 1: AES192알고리즘을 활용하여 암호화된 테이블스페이스를 생성하여라. (10분)
$ cd $ORACLE_HOME
$ mkdir -p ./wallet
$ cd /u01/app/oracle/homes/OraDB21Home1/network/admin
$ vi sqlnet.ora
ENCRYPTION_WALLET_LOCATION=
(SOURCE =
(METHOD = FILE)
(METHOD_DATA =
(DIRECTORY= /u01/app/oracle/product/21.3.0/dbhome_1/wallet)))
ALTER SYSTEM SET ENCRYPTION KEY AUTHENTICATED BY asdf0930k;
SELECT status, wrl_parameter
FROM v$encryption_wallet;
STARTUP FORCE;
ALTER SYSTEM SET ENCRYPTION WALLET OPEN IDENTIFIED BY asdf0930k;
CREATE TABLESPACE tbs_encrypted DATAFILE '/tmp/tbs_encrypted01.dbf' SIZE 10M
ENCRYPTION USING 'AES192'
DEFAULT STORAGE(ENCRYPT);
CREATE TABLESPACE tbs_nonencrypted DATAFILE '/tmp/tbs_nonencrypted01.dbf' SIZE 10M;
CREATE TABLE tbl_encrypted (username VARCHAR2(10), password VARCHAR2(10)) TABLESPACE tbs_encrypted;
INSERT INTO tbs_encrypted VALUES ('MYUSER', 'MYPASS');
COMMIT;
CREATE TABLE tbl_nonencrypted (username VARCHAR2(10), password VARCHAR2(10)) TABLESPACE tbs_nonencrypted;
INSERT INTO tbs_encrypted VALUES ('MYUSER', 'MYPASS');
COMMIT;
ALTER SYSTEM FLUSH BUFFER_CACHE;
$ strings tbs_nonencrypted01.dbf | grep MY
$ strings tbs_encrypted01.dbf | grep MY
SELECT tablespace_name, encrypted
FROM dba_tablespaces;
SELECT b.name, a.*
FROM v$encrypted_tablespaces a,
v$tablespaces b
WHERE a.ts# = b.ts#