1.创建临时存统计信息表:
DBMS_STATS.CREATE_STAT_TABLE('DMTEST', 'OADB_ALLTB');
2.收集用户统计信息:
DBMS_STATS.GATHER_SCHEMA_STATS('DMTEST',100,TRUE,'FOR ALL COLUMNS SIZE AUTO');
3.导出统计信息
DECLARE
BEGIN
FOR RS IN (SELECT OWNER,TABLE_NAME FROM DBA_TABLES WHERE OWNER IN ('DMTEST'))
LOOP
DBMS_STATS.EXPORT_TABLE_STATS(RS.OWNER,RS.TABLE_NAME,STATTAB=>'OADB_ALLTB',statid=>'v1',
statown=>'DMTEST');
END LOOP;
END;
4.查看表结构:(可选)
SP_TABLEDEF ('DMTEST','STAT$_OADB_ALLTB');
结果如下:
CREATE TABLE "SYSDBA"."STAT$_OADB_ALLTB"
(
"STATID" VARCHAR(128) NOT NULL,
"OWNNAME" VARCHAR(128) NOT NULL,
"TABNAME" VARCHAR(128) NOT NULL,
"NAME" VARCHAR(128) NOT NULL,
"T_FLAG" CHAR(1) NOT NULL,
"T_TOTAL" BIGINT,
"N_SAMPLE" BIGINT,
"N_DISTINCT" BIGINT,
"N_NULL" BIGINT,
"V_MIN" VARBINARY(255),
"V_MAX" VARBINARY(255),
"BLEVEL" TINYINT,
"N_LEAF_PAGES" BIGINT,
"N_LEAF_USED_PAGES" BIGINT,
"CLUSTER_FACTOR" INT,
"N_BUCKETS" SMALLINT,
"DATA" BLOB,
"COL_AVG_LEN" INT,
"LAST_GATHERED" DATETIME(6),
"INFO1" VARBINARY(255),
"INFO2" VARBINARY(255),
NOT CLUSTER PRIMARY KEY("STATID", "OWNNAME", "TABNAME", "NAME", "T_FLAG"))
STORAGE(ON "MAIN", CLUSTERBTR)
DISTRIBUTED BY HASH ("STATID", "OWNNAME", "TABNAME", "NAME", "T_FLAG") ;
5.编写控制文件
vi test.ctl
-- load data
-- infile '/opt/test.txt'
-- INTO TABLE "DMTEST"."STAT$_OADB_ALLTB"
-- FIELDS '|'
6.通过dmfldr导出txt
./dmfldr 数据用户名/密码 control='/opt/test.ctl' mode='OUT'
7.查看
cat /opt/test.txt
文章
阅读量
获赞