關於Transportable模式下能否對匯出表空間的dumpfile進行加密的測試

dbhelper發表於2014-12-03

Ttstbs1是一個加密表空間,現在欲將其以transportable方式匯出來,並且對生成的dmpfile以加密方式儲存,試過了下面三條命令:

expdp scott/abcd_1234@shzwbcv2 directory=hisdmp logfile=exp_ttstab1.log dumpfile=ttstab1.dmp reuse_dumpfiles=yes transport_tablespaces=ttstbs1 encryption=all

ORA-39005: inconsistent arguments

ORA-39032: function ENCRYPTION is not supported in TRANSPORT_TABLESPACES jobs

 

expdp scott/abcd_1234@shzwbcv2 directory=hisdmp logfile=exp_ttstab1.log dumpfile=ttstab1.dmp reuse_dumpfiles=yes transport_tablespaces=ttstbs1 encryption_password=abcd_1234

ORA-39005: inconsistent arguments

ORA-39032: function ENCRYPTION_PASSWORD is not supported in TRANSPORT_TABLESPACES

 

expdp scott/abcd_1234@shzwbcv2 directory=hisdmp logfile=exp_ttstab1.log dumpfile=ttstab1.dmp reuse_dumpfiles=yes transport_tablespaces=ttstbs1 encryption=data_only encryption_mode=transparent

ORA-39005: inconsistent arguments

ORA-39032: function ENCRYPTION is not supported in TRANSPORT_TABLESPACES

 

上面三種方法都會遇到ORA-39005ORA-39032錯誤,都是因為encryption引數設定的值和transport tablespace型別的匯出行為相沖突,其實transportable方式匯出的表空間的dump檔案裡本身就只包含metadata,不包含使用者資料(其中第二條命令隱含了encryption=all)

 

--改為如下語句後成功

expdp scott/abcd_1234@shzwbcv2 directory=hisdmp logfile=exp_ttstab1.log dumpfile=ttstab1.dmp reuse_dumpfiles=yes transport_tablespaces=ttstbs1 encryption=metadata_only encryption_mode=transparent

 

上面雖然定義了encryption_mode=transparent,意在透過TDE對匯出的dmpfile檔案進行加密,結果是否真的加密了,我們進一步測試一下

 

--關閉源庫上的encryption Wallet重新進行expdp操作

SQL> Alter system set encryption wallet close identified by "tde_1234";

 

System altered.

 

SQL> select * from v$encryption_wallet;

 

WRL_TYPE

--------------------

WRL_PARAMETER

--------------------------------------------------------------------------------

STATUS

------------------

file

/oradata06/wallet

CLOSED

 

expdp scott/abcd_1234@shzwbcv2 directory=hisdmp logfile=exp_ttstab1.log dumpfile=ttstab1.dmp reuse_dumpfiles=yes transport_tablespaces=ttstbs1 encryption=metadata_only encryption_mode=transparent

 

Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK

Processing object type TRANSPORTABLE_EXPORT/TABLE

Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK

Master table "SCOTT"."SYS_EXPORT_TRANSPORTABLE_01" successfully loaded/unloaded

******************************************************************************

Dump file set for SCOTT.SYS_EXPORT_TRANSPORTABLE_01 is:

  /oradata01/hisdmp/monthly/ttstab1.dmp

******************************************************************************

Datafiles required for transportable tablespace TTSTBS1:

  /oradata06/ttstbs1.dbf

Job "SCOTT"."SYS_EXPORT_TRANSPORTABLE_01" successfully completed at 11:45:30

 

可見在wallet close的情況下依然能成功生成dumpfile,說明encryption_mode引數被忽略,dumpfile並沒有以加密形式儲存,那麼是否因為匯出的是metadata所以oracle就不對其進行加密了,再接著下一輪的測試:

 

--encryption wallet依然保持close狀態

SQL> select * from v$encryption_wallet;

 

WRL_TYPE

--------------------

WRL_PARAMETER

--------------------------------------------------------------------------------

STATUS

------------------

file

/oradata06/wallet

CLOSED

 

--table modeexpdp metadata

expdp scott/abcd_1234@shzwbcv2 directory=hisdmp logfile=exp_s240.log dumpfile=s240.dmp reuse_dumpfiles=yes tables=s240 content=metadata_only encryption=metadata_only encryption_mode=transparent

 

ORA-39002: invalid operation

ORA-39188: unable to encrypt dump file set

ORA-28365: wallet is not open

 

--tablespace modeexpdp metadata

expdp scott/abcd_1234 directory=hisdmp logfile=ttstbs1_con.log dumpfile=ttstbs1_con.dmp tablespaces=ttstbs1 encryption=metadata_only content=metadata_only reuse_dumpfiles=yes  encryption_mode=transparent

 

ORA-39002: invalid operation

ORA-39188: unable to encrypt dump file set

ORA-28365: wallet is not open

 

總結:在我們測試的三種expdp模式(tablespace modetable modetransportable mode)裡匯出的都是僅包含metadatadumpfile,其中tablespace modetable mode裡如果需要對dumpfile使用TDE進行加密,都要求encryption wallet處於open狀態,可以推斷,這兩種模式下如果encryption Wallet open,生成的dmpfile的確能夠以加密形式儲存。而transportable modeencryption相關的引數被忽略,說明transportable mode下生成的dumpfile都是明文存放的,無法實現加密。但是查閱了官方的相關文件都沒有明確提到這點,在此加以記錄

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/8494287/viewspace-1354983/,如需轉載,請註明出處,否則將追究法律責任。

相關文章