在运输系统中,通过pl/sql、系统表user_part_xxx 无法查询MLOS_TS_DUESDETAIL(散列分区)的详细表结构信息。
select distinct a.partition_name from user_part_col_statistics a where a.table_name = 'MLOS_TS_DUESDETAIL'
通过如下sql可以:
set pagesize 0
set long 90000
set feedback off
set echo off
spool get_schema.sql
SELECT DBMS_METADATA.GET_DDL('TABLE', u.table_name)
FROM USER_TABLES u
where table_name = 'MLOS_TS_DUESDETAIL';
查询结果如下:
CREATE TABLE "ETMS_SDJY"."MLOS_TS_DUESDETAIL"
( "SERIALNO" VARCHAR2(30) NOT NULL ENABLE,
"INSTIID" VARCHAR2(30),
"APPID" VARCHAR2(30),
"PROJECTID" VARCHAR2(30),
"POSTTYPE" VARCHAR2(2),
"POSTDATE" DATE DEFAULT sysdate,
"POSTOR" VARCHAR2(30),
"ORDERNO" VARCHAR2(30),
"DOCNO" VARCHAR2(30),
"ACCTYPE" VARCHAR2(2),
"DOCDATE" DATE DEFAULT sysdate,
"ITEMNO" VARCHAR2(30),
"ITEMNAME" VARCHAR2(30),
"INCOME" NUMBER(10,2) DEFAULT 0,
"RECEIVABLE" NUMBER(10,2) DEFAULT 0,
"DUESAMT" NUMBER(10,2) DEFAULT 0,
"INCOMEINSTI" VARCHAR2(30),
"DUESINSTI" VARCHAR2(30),
"DAYREPORTNO" VARCHAR2(30),
"BALANCETYPE" VARCHAR2(30),
"ACCID" VARCHAR2(30),
"CORRECTED" VARCHAR2(2),
"COMMITED" VARCHAR2(2),
"SETTLED" VARCHAR2(2),
"INCMONTHREPORTNO" VARCHAR2(30),
"DUESMONTHREPORTNO" VARCHAR2(30),
"CERTIFICATEID" VARCHAR2(30),
"CERTYFLAG" VARCHAR2(2),
CONSTRAINT "PK_MLOS_TS_DUESDETAIL" PRIMARY KEY ("SERIALNO")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 100663296 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "P_TS_SDJY" ENABLE
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
STORAGE(
BUFFER_POOL DEFAULT)
TABLESPACE "P_TS_SDJY"
PARTITION BY RANGE ("POSTDATE")
SUBPARTITION BY HASH ("INSTIID")
SUBPARTITIONS 10
(PARTITION "P1" VALUES LESS THAN (TO_DATE(' 2006-11-30 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
STORAGE(
BUFFER_POOL DEFAULT)
TABLESPACE "P_TS_SDJY"
( SUBPARTITION "SYS_SUBP1071"
TABLESPACE "P_TS_SDJY",
SUBPARTITION "SYS_SUBP1072"
TABLESPACE "P_TS_SDJY",
SUBPARTITION "SYS_SUBP1073"
TABLESPACE "P_TS_SDJY",
SUBPARTITION "SYS_SUBP1074"
TABLESPACE "P_TS_SDJY",
SUBPARTITION "SYS_SUBP1075"
TABLESPACE "P_TS_SDJY",
SUBPARTITION "SYS_SUBP1076"
TABLESPACE "P_TS_SDJY",
SUBPARTITION "SYS_SUBP1077"
TABLESPACE "P_TS_SDJY",
SUBPARTITION "SYS_SUBP1078"
TABLESPACE "P_TS_SDJY",
SUBPARTITION "SYS_SUBP1079"
TABLESPACE "P_TS_SDJY",
SUBPARTITION "SYS_SUBP1080"
TABLESPACE "P_TS_SDJY") ,
PARTITION "P2" VALUES LESS THAN (TO_DATE(' 2006-12-31 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
STORAGE(
BUFFER_POOL DEFAULT)
TABLESPACE "P_TS_SDJY"
( SUBPARTITION "SYS_SUBP1081"
TABLESPACE "P_TS_SDJY",
SUBPARTITION "SYS_SUBP1082"
TABLESPACE "P_TS_SDJY",
SUBPARTITION "SYS_SUBP1083"
TABLESPACE "P_TS_SDJY",
SUBPARTITION "SYS_SUBP1084"
TABLESPACE "P_TS_SDJY",
SUBPARTITION "SYS_SUBP1085"
TABLESPACE "P_TS_SDJY",
SUBPARTITION "SYS_SUBP1086"
TABLESPACE "P_TS_SDJY",
SUBPARTITION "SYS_SUBP1087"
TABLESPACE "P_TS_SDJY",
SUBPARTITION "SYS_SUBP1088"
TABLESPACE "P_TS_SDJY",
SUBPARTITION "SYS_SUBP1089"
TABLESPACE "P_TS_SDJY",
SUBPARTITION "SYS_SUBP1090"
TABLESPACE "P_TS_SDJY") 。
其余分区信息略。
select distinct a.partition_name from user_part_col_statistics a where a.table_name = 'MLOS_TS_DUESDETAIL'
通过如下sql可以:
set pagesize 0
set long 90000
set feedback off
set echo off
spool get_schema.sql
SELECT DBMS_METADATA.GET_DDL('TABLE', u.table_name)
FROM USER_TABLES u
where table_name = 'MLOS_TS_DUESDETAIL';
查询结果如下:
CREATE TABLE "ETMS_SDJY"."MLOS_TS_DUESDETAIL"
( "SERIALNO" VARCHAR2(30) NOT NULL ENABLE,
"INSTIID" VARCHAR2(30),
"APPID" VARCHAR2(30),
"PROJECTID" VARCHAR2(30),
"POSTTYPE" VARCHAR2(2),
"POSTDATE" DATE DEFAULT sysdate,
"POSTOR" VARCHAR2(30),
"ORDERNO" VARCHAR2(30),
"DOCNO" VARCHAR2(30),
"ACCTYPE" VARCHAR2(2),
"DOCDATE" DATE DEFAULT sysdate,
"ITEMNO" VARCHAR2(30),
"ITEMNAME" VARCHAR2(30),
"INCOME" NUMBER(10,2) DEFAULT 0,
"RECEIVABLE" NUMBER(10,2) DEFAULT 0,
"DUESAMT" NUMBER(10,2) DEFAULT 0,
"INCOMEINSTI" VARCHAR2(30),
"DUESINSTI" VARCHAR2(30),
"DAYREPORTNO" VARCHAR2(30),
"BALANCETYPE" VARCHAR2(30),
"ACCID" VARCHAR2(30),
"CORRECTED" VARCHAR2(2),
"COMMITED" VARCHAR2(2),
"SETTLED" VARCHAR2(2),
"INCMONTHREPORTNO" VARCHAR2(30),
"DUESMONTHREPORTNO" VARCHAR2(30),
"CERTIFICATEID" VARCHAR2(30),
"CERTYFLAG" VARCHAR2(2),
CONSTRAINT "PK_MLOS_TS_DUESDETAIL" PRIMARY KEY ("SERIALNO")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 100663296 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "P_TS_SDJY" ENABLE
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
STORAGE(
BUFFER_POOL DEFAULT)
TABLESPACE "P_TS_SDJY"
PARTITION BY RANGE ("POSTDATE")
SUBPARTITION BY HASH ("INSTIID")
SUBPARTITIONS 10
(PARTITION "P1" VALUES LESS THAN (TO_DATE(' 2006-11-30 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
STORAGE(
BUFFER_POOL DEFAULT)
TABLESPACE "P_TS_SDJY"
( SUBPARTITION "SYS_SUBP1071"
TABLESPACE "P_TS_SDJY",
SUBPARTITION "SYS_SUBP1072"
TABLESPACE "P_TS_SDJY",
SUBPARTITION "SYS_SUBP1073"
TABLESPACE "P_TS_SDJY",
SUBPARTITION "SYS_SUBP1074"
TABLESPACE "P_TS_SDJY",
SUBPARTITION "SYS_SUBP1075"
TABLESPACE "P_TS_SDJY",
SUBPARTITION "SYS_SUBP1076"
TABLESPACE "P_TS_SDJY",
SUBPARTITION "SYS_SUBP1077"
TABLESPACE "P_TS_SDJY",
SUBPARTITION "SYS_SUBP1078"
TABLESPACE "P_TS_SDJY",
SUBPARTITION "SYS_SUBP1079"
TABLESPACE "P_TS_SDJY",
SUBPARTITION "SYS_SUBP1080"
TABLESPACE "P_TS_SDJY") ,
PARTITION "P2" VALUES LESS THAN (TO_DATE(' 2006-12-31 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
STORAGE(
BUFFER_POOL DEFAULT)
TABLESPACE "P_TS_SDJY"
( SUBPARTITION "SYS_SUBP1081"
TABLESPACE "P_TS_SDJY",
SUBPARTITION "SYS_SUBP1082"
TABLESPACE "P_TS_SDJY",
SUBPARTITION "SYS_SUBP1083"
TABLESPACE "P_TS_SDJY",
SUBPARTITION "SYS_SUBP1084"
TABLESPACE "P_TS_SDJY",
SUBPARTITION "SYS_SUBP1085"
TABLESPACE "P_TS_SDJY",
SUBPARTITION "SYS_SUBP1086"
TABLESPACE "P_TS_SDJY",
SUBPARTITION "SYS_SUBP1087"
TABLESPACE "P_TS_SDJY",
SUBPARTITION "SYS_SUBP1088"
TABLESPACE "P_TS_SDJY",
SUBPARTITION "SYS_SUBP1089"
TABLESPACE "P_TS_SDJY",
SUBPARTITION "SYS_SUBP1090"
TABLESPACE "P_TS_SDJY") 。
其余分区信息略。