天天看點

【導入導出】EXP-00068分析

當導出資料時,會遇到exp-00068 錯誤。

   about to export specified tables via conventional path ...

   . . exporting table      testlob

   exp-00068: tablespace test_exp is offline

   exp-00068: tablespace test_exp is offline          1 rows exported

   export terminated successfully without warnings.

一般來說,exp-68 的症狀,原因和解決辦法是:

text  : tablespace  %s is offline

cause : export failed to export tablespace (tablespace being offline).

action: make tablespace online and re-export.

但是 也有時候甚至會遇到明明表空間online時,卻報錯誤。

解決辦法如下:

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

1 連接配接資料庫,執行如下查詢,檢查錯誤中出現的表空間和資料檔案的狀态:

      select d.tablespace_name,d.status,d.extent_management,f.file#,f.status

         from dba_tablespaces d, v$datafile f, v$tablespace t

         where d.tablespace_name=t.name and t.ts#=f.ts#(+);

2.a. 如果狀态顯示為 offline,則将表空間online

      alter tablespace tablespace_name online;

  b. 如果表空間裡的一個或多個資料檔案offline,則将相應的資料檔案online

      alter database datafile datafile# online;

  c. 如果表空間裡的一個或多個資料檔案的狀态為 recover,則将其恢複并online

      recover datafile datafile#

          sql> host exp system/****** file=d:\exp.dmp full=y

  d. 将報錯的表空間和資料檔案online後,再次執行導出操作。

3. 如果表空間和資料檔案已經online 并且是表空間是本地管理的時候,可以忽略次錯誤!

執行個體:

-- export log

    about to export the entire database ...

    . exporting tablespace definitions

    exp-00068: tablespace ts1 is offline

    -- 檢視 dba_tablespaces 視圖 ts1的狀态

    sql> select tablespace_name,status

    from dba_tablespaces where tablespace_name='ts1';

    tablespace_name                   status

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

    ts1                               online

    ts1 顯示為online,此時需要做更深一步的研究。執行如下查詢來檢視表空間ts1下的所有資料檔案的狀态。

    sql> select a.file#, a.name, a.status

    2    from v$datafile a, v$tablespace b

    3    where a.ts#=b.ts#

    4    and b.name='ts1';

         file# name                        status

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

            6 d:\ts1-1.dbf                 online

            7 d:\ts1-2.dbf                 recover <== datafile requires recovery.

            9 d:\ts1-3.dbf                 online

從這裡可以看出 ts-2.dbf 需要恢複,這就是導緻exp-00068錯誤的原因。

 解決辦法

    -- 恢複資料檔案 7;

    sql> recover datafile 7;

    media recovery complete.

    sql> alter database datafile 7 online;

    database altered.

    ---再次檢查

    2 from v$datafile a, v$tablespace b

    3 where a.ts#=b.ts#

    4 and b.name='ts1';

         file# name                     status

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

             6 d:\ts1-1.dbf             online

             7 d:\ts1-2.dbf             online <== datafile is online now.

             9 d:\ts1-3.dbf             online

   --再次執行導出就好!