2017-10-10 99 views
1

我正嘗試在oracle中使用dbms_metadata.get_ddl函數從我們的開發數據庫之一重新創建表。例如dbms_metadata.get_ddl ... DDL生成語法錯誤

SELECT dbms_metadata.get_ddl('TABLE','ogaPatch2892_TAB','XVIEWMGR')from dual; 

它確實產生,我需要但運行會產生錯誤

ORA-00904的DDL:無效的標識符

下面是DDL的語法時才:

CREATE TABLE "XVIEWMGR"."ogaPatch2892_TAB" OF XMLTYPE 
PCTFREE 10 
PCTUSED 40 
INITRANS 1 
MAXTRANS 255 
NOCOMPRESS 
LOGGING 
STORAGE (INITIAL 65536 
     NEXT 1048576 
     MINEXTENTS 1 
     MAXEXTENTS 2147483645 
     PCTINCREASE 0 
     FREELISTS 1 
     FREELIST GROUPS 1 
     BUFFER_POOL DEFAULT 
     FLASH_CACHE DEFAULT 
     CELL_FLASH_CACHE DEFAULT) 
TABLESPACE "TBSDATA" 
VARRAY "XMLEXTRA"."NAMESPACES" 
    STORE AS BASICFILE LOB "NAMESPACES2895_L" (
    ENABLE STORAGE IN ROW 
    CHUNK 8192 
    RETENTION 
    CACHE 
    STORAGE (INITIAL 65536 
      NEXT 1048576 
      MINEXTENTS 1 
      MAXEXTENTS 2147483645 
      PCTINCREASE 0 
      FREELISTS 1 
      FREELIST GROUPS 1 
      BUFFER_POOL DEFAULT 
      FLASH_CACHE DEFAULT 
      CELL_FLASH_CACHE DEFAULT)) 
VARRAY "XMLEXTRA"."EXTRADATA" 
    STORE AS BASICFILE LOB "EXTRADATA2894_L" (
    ENABLE STORAGE IN ROW 
    CHUNK 8192 
    RETENTION 
    CACHE 
    STORAGE (INITIAL 65536 
      NEXT 1048576 
      MINEXTENTS 1 
      MAXEXTENTS 2147483645 
      PCTINCREASE 0 
      FREELISTS 1 
      FREELIST GROUPS 1 
      BUFFER_POOL DEFAULT 
      FLASH_CACHE DEFAULT 
      CELL_FLASH_CACHE DEFAULT)) 
VARRAY "XMLDATA"."SYS_XDBPD$" 
    STORE AS BASICFILE LOB "SYS_XDBPD$2893_L" (
    ENABLE STORAGE IN ROW 
    CHUNK 8192 
    RETENTION 
    CACHE 
    STORAGE (INITIAL 65536 
      NEXT 1048576 
      MINEXTENTS 1 
      MAXEXTENTS 2147483645 
      PCTINCREASE 0 
      FREELISTS 1 
      FREELIST GROUPS 1 
      BUFFER_POOL DEFAULT 
      FLASH_CACHE DEFAULT 
      CELL_FLASH_CACHE DEFAULT)) 

回答

0

您只需按照以下步驟操作即可。無需指定存儲參數。當DBA安裝或設置數據庫時,Oracle會自動選取默認值。

CREATE TABLE XVIEWMGR.ogaPatch2892_TAB OF XMLTYPE; 
+1

謝謝。你是對的只是想確保相應的lob段創建與這些名稱封裝在雙引號。 –

+1

@ Mr.Eva您可以在執行dbms_metadata.get_ddl()時將Storage參數設置爲false,以便輸出應排除存儲參數。閱讀此http://www.dba-oracle.com/t_1_dbms_metadata.htm – XING