Oracle获取数据库中的对象创建语句(2)

select dbms_metadata.get_ddl('TABLE','T_PART','JINGYU') from dual;
select dbms_metadata.get_ddl('INDEX','IDX_T_PART','JINGYU') from dual;
select dbms_metadata.get_ddl('INDEX','PK_T_PART_ID','JINGYU') from dual;

SQL> set long 10000 SQL> select dbms_metadata.get_ddl('TABLE','T_PART','JINGYU') from dual; CREATE TABLE "JINGYU"."T_PART" ( "ID" NUMBER, "NAME" VARCHAR2(20), "START_TIME" DATE, "CONTENT" VARCHAR2(200), CONSTRAINT "PK_T_PART_ID" PRIMARY KEY ("START_TIME", "ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE( BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "DBS_I_JINGYU" LOCAL (PARTITION "P20150101" PCTFREE 10 INITRANS 2 MAXTRANS 255 LOGGING STORAGE( BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "DBS_I_JINGYU" , PARTITION "P20150102" PCTFREE 10 INITRANS 2 MAXTRANS 255 LOGGING STORAGE( BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "DBS_I_JINGYU" , PARTITION "P20150103" PCTFREE 10 INITRANS 2 MAXTRANS 255 LOGGING STORAGE( BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "DBS_I_JINGYU" ) ENABLE ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE( BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "DBS_D_JINGYU" PARTITION BY RANGE ("START_TIME") (PARTITION "P20150101" VALUES LESS THAN (TO_DATE(' 2015-01-01 00:00:00', 'SYYY Y-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION DEFERRED PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE( BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "DBS_D_JINGYU" , PARTITION "P20150102" VALUES LESS THAN (TO_DATE(' 2015-01-02 00:00:00', 'SYYYY -MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION DEFERRED PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE( BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "DBS_D_JINGYU" , PARTITION "P20150103" VALUES LESS THAN (TO_DATE(' 2015-01-03 00:00:00', 'SYYYY -MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION DEFERRED PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE( BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "DBS_D_JINGYU" ) SQL> select dbms_metadata.get_ddl('INDEX','IDX_T_PART','JINGYU') from dual; CREATE INDEX "JINGYU"."IDX_T_PART" ON "JINGYU"."T_PART" ("START_TIME", "ID", " NAME") PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE( BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "DBS_I_JINGYU" LOCAL (PARTITION "P20150101" PCTFREE 10 INITRANS 2 MAXTRANS 255 LOGGING STORAGE( BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "DBS_I_JINGYU" , PARTITION "P20150102" PCTFREE 10 INITRANS 2 MAXTRANS 255 LOGGING STORAGE( BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "DBS_I_JINGYU" , PARTITION "P20150103" PCTFREE 10 INITRANS 2 MAXTRANS 255 LOGGING STORAGE( BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "DBS_I_JINGYU" ) SQL> select dbms_metadata.get_ddl('INDEX','PK_T_PART_ID','JINGYU') from dual; CREATE UNIQUE INDEX "JINGYU"."PK_T_PART_ID" ON "JINGYU"."T_PART" ("START_TIME" , "ID") PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE( BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "DBS_I_JINGYU" LOCAL (PARTITION "P20150101" PCTFREE 10 INITRANS 2 MAXTRANS 255 LOGGING STORAGE( BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "DBS_I_JINGYU" , PARTITION "P20150102" PCTFREE 10 INITRANS 2 MAXTRANS 255 LOGGING STORAGE( BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "DBS_I_JINGYU" , PARTITION "P20150103" PCTFREE 10 INITRANS 2 MAXTRANS 255 LOGGING STORAGE( BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "DBS_I_JINGYU" )

获取到的是最完整的对象创建语句。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/0daafa8665d6adc8633d8bf4b3afbb0e.html