CREATE TABLESPACE TABLESPACE_NAME
datafile ...
encryption
Using 'algorithm' ( optional )
defult storage ( ENCRYPT );
{CODE}
SQL> create tablespace new_encrypted
2 datafile 'D:\app\LG\data_file\new_encrypted.dbf' size 1m
3 encryption
4 default storage( encrypt );
테이블스페이스가 생성되었습니다.
SQL> create tablespace new_clear
2 datafile 'D:\app\LG\data_file\new_clear.dbf' size 1m
3 autoextend on next 1m;
테이블스페이스가 생성되었습니다.
SQL> create table scott.stage
2 as
3 select *
4 from all_objects;
테이블이 생성되었습니다.
SQL> create table scott.nonencrypted
2 tablespace new_clear
3 as
4 select *
5 from scott.stage
6 where 1=0;
테이블이 생성되었습니다.
SQL> alter table scott.nonencrypted add constraint nonencrypted_pk primary key( object_id )
2 using index
3 (create index scott.nonencrypted_pk on scott.nonencrypted( object_id )
4 tablespace new_clear
5 );
테이블이 변경되었습니다.
SQL> create table scott.encrypted
2 tablespace new_encrypted
3 as
4 select *
5 from scott.stage
6 where 1=0
7
SQL> /
테이블이 생성되었습니다.
SQL> alter table scott.encrypted add constraint encrypted_pk primary key( object_id )
2 using index
3 (create index scott.encrypted_pk on scott.encrypted( object_id )
4 tablespace new_encrypted
5 );
테이블이 변경되었습니다.
SQL>
프로시저가 생성되었습니다.
SQL> ALTER TABLESPACE new_encrypted ADD DATAFILE 'D:\app\LG\data_file\new_encrypted01.dbf' SIZE 1M autoextend on next 1m;
테이블스페이스가 변경되었습니다.
SQL>
SQL> begin
2 do_sql( 'insert into #TNAME# SELECT * FROM SCOTT.STAGE', 'SCOTT.nonencrypted' );
3 do_sql( 'insert into #TNAME# SELECT * FROM SCOTT.STAGE', 'SCOTT.encrypted' );
4 end;
5 /
insert into SCOTT.nonencrypted SELECT * FROM SCOTT.STAGE
234 cpu hsecs
3,2 mbytes redo
insert into SCOTT.encrypted SELECT * FROM SCOTT.STAGE
396 cpu hsecs
3,2 mbytes redo
PL/SQL 처리가 정상적으로 완료되었습니다.
SQL>
– CPU 활용 측면에서 영향도는 거의 없다는데 1.5정도 _
{CODE}
SQL> begin
2 do_sql( 'insert /*+ append */ into #TNAME# SELECT * FROM SCOTT.STAGE', 'SCOTT.nonencrypted' );
3 do_sql( 'insert /*+ append */ into #TNAME# SELECT * FROM SCOTT.STAGE', 'SCOTT.encrypted' );
4 end;
5 /
insert /*+ append */ into SCOTT.nonencrypted SELECT * FROM SCOTT.STAGE
207 cpu hsecs
2,0 mbytes redo
insert /*+ append */ into SCOTT.encrypted SELECT * FROM SCOTT.STAGE
326 cpu hsecs
2,0 mbytes redo
PL/SQL 처리가 정상적으로 완료되었습니다.
-- 음..ㅠ
SQL> declare
2 l_sql long := 'begin ' || 'for x in (select * from scott.stage) ' ||
3 'loop ' ||
4 'insert into #TNAME# values x; ' ||
5 'end loop; ' ||
6 'end; ';
7 begin
8 do_sql( l_sql, 'SCOTT.nonencrypted' );
9 do_sql( l_sql, 'SCOTT.encrypted' );
10 end;
11 /
begin for x in (select * from scott.stage) loop insert into SCOTT.nonencrypted
values x; end loop; end;
1408 cpu hsecs
5,2 mbytes redo
begin for x in (select * from scott.stage) loop insert into SCOTT.encrypted
values x; end loop; end;
1745 cpu hsecs
5,2 mbytes redo
SQL> declare
2 l_sql long := 'begin ' || 'for x in (select object_id from scott.stage) ' ||
3 'loop ' ||
4 'for y in (select * from #TNAME# where object_id = x.object_id ) ' ||
5 'loop ' ||
6 'null; ' ||
7 'end loop;' ||
8 'end loop; ' ||
9 'end; ';
10 begin
11 do_sql( l_sql, 'SCOTT.nonencrypted', false );
12 do_sql( l_sql, 'SCOTT.encrypted', false );
13 end;
14 /
begin for x in (select object_id from scott.stage) loop for y in (select * from
SCOTT.nonencrypted where object_id = x.object_id ) loop null; end loop;end loop;
end;
1120 cpu hsecs
0 mbytes redo
begin for x in (select object_id from scott.stage) loop for y in (select * from
SCOTT.encrypted where object_id = x.object_id ) loop null; end loop;end loop;
end;
1140 cpu hsecs
0 mbytes redo
PL/SQL 처리가 정상적으로 완료되었습니다.
SQL> declare
2 l_sql long := 'begin ' || 'for x in (select object_id from scott.stage) ' ||
3 'loop ' ||
4 'for y in (select * from #TNAME# where object_id = x.object_id ) ' ||
5 'loop ' ||
6 'null; ' ||
7 'end loop;' ||
8 'end loop; ' ||
9 'end; ';
10 begin
11 do_sql( l_sql, 'SCOTT.nonencrypted', false );
12 -- do_sql( l_sql, 'SCOTT.encrypted', false );
13 end;
14 /
begin for x in (select object_id from scott.stage) loop for y in (select * from
SCOTT.nonencrypted where object_id = x.object_id ) loop null; end loop;end loop;
end;
1081 cpu hsecs
0 mbytes redo
PL/SQL 처리가 정상적으로 완료되었습니다.
ALTER SYSTEM FLUSH BUFFER_CACHE;
SQL> declare
2 l_sql long := 'begin ' || 'for x in (select object_id from scott.stage) ' ||
3 'loop ' ||
4 'for y in (select * from #TNAME# where object_id = x.object_id ) ' ||
5 'loop ' ||
6 'null; ' ||
7 'end loop;' ||
8 'end loop; ' ||
9 'end; ';
10 begin
11 -- do_sql( l_sql, 'SCOTT.nonencrypted', false );
12 do_sql( l_sql, 'SCOTT.encrypted', false );
13 end;
14 /
begin for x in (select object_id from scott.stage) loop for y in (select * from
SCOTT.encrypted where object_id = x.object_id ) loop null; end loop;end loop;
end;
1095 cpu hsecs
0 mbytes redo
{CODE}
PL/SQL 처리가 정상적으로 완료되었습니다.
SQL> EXEC DBMS_STATS.GATHER_TABLE_STATS( 'SCOTT', 'encrypted' , METHOD_OPT => 'for columns object_name size 254' );
PL/SQL 처리가 정상적으로 완료되었습니다.
SQL>
SQL>
SQL> set autotrace traceonly explain
SQL> select * from SCOTT.nonencrypted where object_name = 'ALL_OBJECT';
Execution Plan
Id | Operation | Name | Rows | Bytes | Cost (%CPU) | Time |
0 | SELECT STATEMENT | 2 | 196 | 342 (1) | 00:00:05 |
| TABLE ACCESS FULL | NONENCRYPTED | 2 | 196 | 342 (1) | 00:00:05 |
Predicate Information (identified by operation id):
1 - filter("OBJECT_NAME"='ALL_OBJECT')
SQL> select * from SCOTT.encrypted where object_name = 'ALL_OBJECT';
Execution Plan
Id | Operation | Name | Rows | Bytes | Cost (%CPU) | Time |
0 | SELECT STATEMENT | 2 | 196 | 342 (1) | 00:00:05 | |
| TABLE ACCESS FULL | ENCRYPTED | 2 | 196 | 342 (1) | 00:00:05 |
Predicate Information (identified by operation id):
1 - filter("OBJECT_NAME"='ALL_OBJECT')
SQL>
{CODE}