如何加密/重新生成一张密钥表以及避免相关的性能问题和死锁[讨论]_MySQL, Oracle及数据库讨论区_Weblogic技术|Tuxedo技术|中间件技术|Oracle论坛|JAVA论坛|Linux/Unix技术|hadoop论坛_联动北方技术论坛  
网站首页 | 关于我们 | 服务中心 | 经验交流 | 公司荣誉 | 成功案例 | 合作伙伴 | 联系我们 |
联动北方-国内领先的云技术服务提供商
»  游客             当前位置:  论坛首页 »  自由讨论区 »  MySQL, Oracle及数据库讨论区 »
总帖数
1
每页帖数
101/1页1
返回列表
0
发起投票  发起投票 发新帖子
查看: 4463 | 回复: 0   主题: 如何加密/重新生成一张密钥表以及避免相关的性能问题和死锁[讨论]        下一篇 
zhouqingfa
注册用户
等级:中士
经验:234
发帖:13
精华:0
注册:2012-6-8
状态:离线
发送短消息息给zhouqingfa 加好友    发送短消息息给zhouqingfa 发消息
发表于: IP:您无权察看 2012-6-8 16:31:32 | [全部帖] [楼主帖] 楼主

应用于:

oracle服务器 企业级版本 - 10.2.0.1.11.2.0.2
    文档中的信息应用于任何平台

目标:

解决方式可以应用于下面的一些情景:

#1.TDE加密一个非加密的表
#2.为一个已经存在的加密表重新生成密钥或者改变加密算法
#3.column模式到tablespace模式移除一个已加密的表


解决方式:

参照文档:

"一个表可以暂时的在加密开启的情况下访问写操作,列数据正在重新生成密钥,或者加密算法正在被改变。 你也可以在这个程序中使用在线表格定义来确保表格对写操作是可以用的"

以下是一个对于如何使用DBMS_REDEFINITION来重新生成密钥表的一个基本的例子。默认情况下,加密算法是AES192AES256

--对象的架构的所有者的用户名为admin
drop table test;
drop table temp_table;
create table test(id number, name varchar2(20) encrypt);
insert into test values(1,'Test username');
commit;
alter table test add constraint pk_id primary key(id);
create table temp_table as
select *
from test where 1=2;
(drop the NOT NULL constraints that have been defined on table temp_table as a result of the CTAS.)
(If the table to encrypt/decrypt/re-encrypt is partitioned, extract its definition with:
select dbms_metadata.get_ddl('TABLE','TEST','<test owner schema>') from dual;
remove all the attached constraints and use this definition to create the temp_table.)
alter table temp_table modify (name encrypt using 'aes256');
EXEC DBMS_REDEFINITION.can_redef_table('admin', 'test');
EXEC DBMS_REDEFINITION.start_redef_table('admin', 'test', 'temp_table');
DECLARE
num_errors PLS_INTEGER;
BEGIN
DBMS_REDEFINITION.COPY_TABLE_DEPENDENTS(
'ADMIN','TEST','TEMP_TABLE',DBMS_REDEFINITION.CONS_ORIG_PARAMS,
TRUE, TRUE, TRUE, FALSE, num_errors, TRUE);
END;
/
EXEC DBMS_REDEFINITION.SYNC_INTERIM_TABLE('admin', 'test', 'temp_table');
EXEC DBMS_REDEFINITION.FINISH_REDEF_TABLE('admin', 'test', 'temp_table');
Now the tables have swapped the encryption algorithm and table TEST has retained all its dependent objects. To check this, run the following queries:
SQL> select constraint_name from user_constraints where table_name='TEST';
CONSTRAINT_NAME
------------------------------
PK_ID
SQL> select constraint_name from user_constraints where table_name='TEMP_TABLE';
CONSTRAINT_NAME
------------------------------
TMP$$_PK_ID0
SQL> select * from user_encrypted_columns;
TABLE_NAME COLUMN_NAME ENCRYPTION_ALG          SALT
------------         ----------------       ----------------------------- -------
TEST                  NAME                    AES 192 bits key                  YES
TEMP_TABLE   NAME                    AES 256 bits key                  YES


最后,删除中介表:

SQL> drop table temp_table;


         这段注释没有覆盖所有的重定义的方面,像使用ROWID和不是主键来重定义一���表
限制条件:

重定义在一段时间不能做一些部分,因为在表中的所有模块必须同时用相同的算法加密




赞(0)    操作        顶端 
总帖数
1
每页帖数
101/1页1
返回列表
发新帖子
请输入验证码: 点击刷新验证码
您需要登录后才可以回帖 登录 | 注册
技术讨论