暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

IMPDP报错ORA-39083 ORA-28365: wallet is not open

原创 章芋文 2019-12-20
4191

19c 引入了一个新的转换的参数, OMIT_ENCRYPTION_CLAUSE, 可以让 Data Pump 忽略/取消掉使用了encrypted columns的对象的加密选项。这个新的参数仅支持 non-transportable 的导入 job。 OMIT_ENCRYPTION_CLAUSE 适用于 materialized view, table, 和 tablespace objects。可以忽略源库对象的encrypted columns属性,实现导入到不支持加密属性的目标库中。

DataPump 的这个转换参数可以实现从启用了 TDE 的源库导入数据到不支持 TDE 的目标库的功能。
比如,在 Oracle Public Cloud,数据库默认启用了 TDE 加密以及 tablespace 加密功能。但这个环境不支持 encrypted column 功能。源数据库包含具有 encrypted column 的对象时,使用 Data Pump 将 non-cloud 数据库迁移到 Cloud 时会出现问题。在导入过程中,在目标数据库中创建对象时,DataPump将始终包含任何关联的加密属性语法。因此,由于无效/不受支持的加密语法,这些对象无法在目标数据库中创建。为了便于创建这些对象(表和 materialized views),新的transform参数允许用户在导入期间取消加密相关的语法。 对于这种迁移,OMIT_ENCRYPTION_CLAUSE指示 DataPump 忽略掉使用了encrypted columns的对象的加密属性语法。

Data Pump Import utility (impdp) 的命令行模式通过对参数 TRANSFORM 添加了一个新的关键词来支持这个功能:

TRANSFORM=OMIT_ENCRYPTION_CLAUSE: [ Y | N ]
Y - 产生的 DDL 不包括任何加密属性的语法
N - 产生的 DDL 包括任何加密属性的语法 (默认值)

如果指定为 Y,则产生的创建对象的 DDL 会取消所有加密属性的语法。这个参数默认为N。
这个功能也可以在 API 中使用 DBMS_METADATA.SET_TRANSFORM_PARAM:

DBMS_METADATA.SET_TRANSFORM_PARAM(job_handle, ‘OMIT_ENCRYPTION_CLAUSE’, true);

比如:

- 源库是启用了 TDE 的 12.1.0.2 数据库,目标库是 19.1。 - 在源库创建加密的表: SQL> administer key management set key identified by Oracle_123 with backup; keystore altered. SQL> create table scott.t1 (name varchar2(100) encrypt using 'AES256'); Table created. SQL> insert into scott.t1 values('AAA'); 1 row created. SQL> commit; SQL> select dbms_metadata.get_ddl('TABLE','T1','SCOTT') from dual; DBMS_METADATA.GET_DDL('TABLE','T1','SCOTT') -------------------------------------------------------------------------------- CREATE TABLE "SCOTT"."T1" ( "NAME" VARCHAR2(100) ENCRYPT USING 'AES256' 'SHA-1' ) SEGMENT CREATION IMMEDIATE ...... - 生成 export dump file:这个表的创建语句中包含了加密属性的语法 > expdp system/<password> dumpfile=test.dmp directory=DATA_PUMP_DIR tables=scott.t1 Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options Starting "SYSTEM"."SYS_EXPORT_TABLE_01": system/ ******** dumpfile=test.dmp directory=DATA_PUMP_DIR tables=scott.t1 Estimate in progress using BLOCKS method... Processing object type TABLE_EXPORT/TABLE/TABLE_DATA Total estimation using BLOCKS method: 64 KB ........ . . exported "SCOTT"."T1" 5.054 KB 1 rows ORA-39173: Encrypted data has been stored unencrypted in dump file set. Master table "SYSTEM"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded - 指定 transform=OMIT_ENCRYPTION_CLAUSE:N 来运行import > impdp system/oracle directory=dptest dumpfile=test.dmp remap_schema=scott:test transform=OMIT_ENCRYPTION_CLAUSE:N Import: Release 19.0.0.0.0 - Development on Tue Oct 9 02:45:56 2018 Version 19.1.0.0.0 Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Development Master table "SYSTEM"."SYS_IMPORT_FULL_01" successfully loaded/unloaded import done in WE8DEC character set and AL16UTF16 NCHAR character set export done in AL32UTF8 character set and AL16UTF16 NCHAR character set Warning: possible data loss in character set conversions Starting "SYSTEM"."SYS_IMPORT_FULL_01": system/ ******** directory=dptest dumpfile=test.dmp remap_schema=scott:test transform=OMIT_ENCRYPTION_CLAUSE:N Processing object type TABLE_EXPORT/TABLE/TABLE ORA-39083: Object type TABLE:"TEST"."T1" failed to create with error: ORA-28365: wallet is not open Failing sql is: CREATE TABLE "TEST"."T1" ("NAME" VARCHAR2(100 BYTE) ENCRYPT USING 'AES256' 'SHA-1') SEGMENT CREATION IMMEDIATE PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST ...) TABLESPACE "USERS" Processing object type TABLE_EXPORT/TABLE/TABLE_DATA Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS Processing object type TABLE_EXPORT/TABLE/STATISTICS/MARKER Job "SYSTEM"."SYS_IMPORT_FULL_01" completed with 1 error(s) at Tue Oct 9 02:46:09 2018 elapsed 0 00:00:06 - 指定 transform=OMIT_ENCRYPTION_CLAUSE:Y 来运行 import > impdp system/<password> directory=dptest dumpfile=test.dmp remap_schema=scott:test transform=OMIT_ENCRYPTION_CLAUSE:Y Import: Release 19.0.0.0.0 - Development on Tue Oct 9 02:46:45 2018 Version 19.1.0.0.0 Username: system/oracle Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Development Master table "SYSTEM"."SYS_IMPORT_FULL_01" successfully loaded/unloaded Warning: possible data loss in character set conversions Starting "SYSTEM"."SYS_IMPORT_FULL_01": system/ ******** directory=dptest dumpfile=test.dmp remap_schema=scott:test transform=OMIT_ENCRYPTION_CLAUSE:Y Processing object type TABLE_EXPORT/TABLE/TABLE Processing object type TABLE_EXPORT/TABLE/TABLE_DATA . . imported "TEST"."T1" 5.054 KB 1 rows Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS Processing object type TABLE_EXPORT/TABLE/STATISTICS/MARKER Job "SYSTEM"."SYS_IMPORT_FULL_01" successfully completed at Tue Oct 9 02:47:36 2018 elapsed 0 00:00:35 bash-4.2$ sqlplus SQL*Plus: Release 19.0.0.0.0 - Development on Tue Oct 9 03:58:25 2018 Version 19.1.0.0.0 Enter user-name: / as sysdba Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Development Version 19.1.0.0.0 SQL> select dbms_metadata.get_ddl('TABLE','T1','TEST') from dual; DBMS_METADATA.GET_DDL('TABLE','T1','TEST') -------------------------------------------------------------------------------- CREATE TABLE "TEST"."T1" ( "NAME" VARCHAR2(100) <------------------------------- 使用 transform=OMIT_ENCRYPTION_CLAUSE:Y impdp之后加密属性的语法没有了 ) SEGMENT CREATION IMMEDIATE PCTFREE 10 .....
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论