expdp時遇到ORA-31693&ORA-02354&ORA-01466,expdpora-31693

來源:互聯網
上載者:User

expdp時遇到ORA-31693&ORA-02354&ORA-01466,expdpora-31693
expdp時遇到ORA-31693&ORA-02354&ORA-01466
對一個schema執行expdp匯出,expdp命令:
nohup expdp HQ_X1/HQ_X1 DUMPFILE=HQ_X1.DMP DIRECTORY=DIR1 parallel=8  flashback_scn=10838324803 &
ORA-39095: Dump file space has been exhausted: Unable to allocate 8192 bytes
這通常是因為使用了parallel參數導致,官方文檔的解釋是parallel io server processes寫檔案不能同時寫一個,
並且當一個io server process在寫其餘io server process在等待的時候就會報ORA-39095。
所以解決辦法:(1).取消parallel,但這樣會影響expdp的效能;
(2)在寫匯出語句的時候指定dumpfile中使用變數 %u(大小寫均可),讓其自由分配轉儲檔案即可。
於是我使用了變數重新匯出:
nohup expdp HQ_X1/HQ_X1 DUMPFILE=HQ_X1%u.DMP DIRECTORY=DIR1 parallel=8  flashback_scn=10838324803 &
之前的問題已經解決了,但遇到了新的報錯:
ORA-31693: Table data object "HQ_X1"."TBL_BILL":"SYS_P109" failed to load/unload and is being skipped due to error:
ORA-02354: error in exporting/importing data
ORA-01466: unable to read data - table definition has changed
查看下dba_objects,果然在那個時間點有DDL操作:
LAST_DDL_TIME
2015-06-23/17:32:19
2015/1/12 22:57:10


懷疑是GRANT之類的可能性最大, 查下v$sql,果然有下面的SQL,時間也完全對應得上:
insert into objauth$(obj#, grantor#, grantee#, privilege#, sequence#, option$, col#) values(:1,:2,:3,:4,:5,:6,:7)  2015-06-23/17:32:19
--insert into objauth$(option$,grantor#,obj#,privilege#,grantee#,col#,sequence#) values(decode(:1,0,null,:1),:2,:3,:4,:5,decode(:6,0,null,:6),object_grant.nextval);
Oracle的一篇note是這樣說的:
The issue is discussed in
Bug 8534161 - ORA-1466 REPORTED BY EXPDP WHEN USING FLASHBACK_SCN AND PRIVILEGES WERE GRANTED
Oracle Development confirmed this is expected behavior and not a bug.
並且給出給解決方案:
WORKAROUND
Do not grant any privileges to any object while Expdp is running with FLASHBACK_SCN.


另附一個我自己做的測試:
開2個session,
session1先open一個遊標:
SQL> exec open :x for select * from b where user_id=100;
PL/SQL procedure successfully completed.
session2執行一個grant:
SQL>  grant select on b to mine;
Grant succeeded.
session1列印遊標:
SQL> print x
USERNAME                          USER_ID CREATED
------------------------------ ---------- --------------
HQ_X2                              100 12-9月 -14
HQ_X2                              100 12-9月 -14
可以看出對於SELECT操作,當執行期間在另一個session執行grant時沒有問題的,但在expdp下卻不行,這就是一開始Oracle認為這是一個BUG的原因。

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.