婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 知識庫 > Oracle 統(tǒng)計用戶下表的數(shù)據(jù)量實現(xiàn)腳本

Oracle 統(tǒng)計用戶下表的數(shù)據(jù)量實現(xiàn)腳本

熱門標簽:電話機器人那種好 地圖標注的坐標點 上海網(wǎng)絡(luò)外呼系統(tǒng) 區(qū)域地圖標注怎么設(shè)置 外呼系統(tǒng)好點子 南通電銷外呼系統(tǒng)哪家強 理財產(chǎn)品電銷機器人 百度地圖標注飯店位置怎么 百度地圖標注注解

要想統(tǒng)計用戶下所有表的數(shù)據(jù)量,可以查看user_tables,此表里面是統(tǒng)計信息,當然這個可能不太準,要想非常精確,需要直接count表。下面的腳本有異常不中斷,可以重復執(zhí)行的特點。

create table bk_count_tables
(
 owner VARCHAR2(30),
 table_name VARCHAR2(30),
 part_col varchar2(100),--分區(qū)字段
 row_s number,
 gather_time date
);
create index ind_bct_own_table on bk_count_tables(owner,table_name);
set serveroutput on
declare
cursor c_cursor is select s.OWNER, s.TABLE_NAME, col.column_name part_col
  from dba_tables s,
    (select owner,
        name,
        listagg(column_name, ',') within group(order by null) column_name
      from (select owner, name, column_name
          from dba_part_key_columns
         where owner in ('TEST')
          and object_type = 'TABLE'
          and name not like 'BIN$%'
         union all
         select owner, name, column_name
          from dba_subpart_key_columns
         where owner in ('TEST')
          and object_type = 'TABLE'
          and name not like 'BIN$%')
     group by owner, name) col
 where s.OWNER in ('TEST')
  and not regexp_like(table_name, '[0-9]{3,8}')
  and s.table_name not like '%BAK%'
  and s.table_name not like '%A2K%'
  and s.table_name not like 'BK%'
  and s.table_name not like 'BIN%'
  and s.OWNER = col.owner(+)
  and s.TABLE_NAME = col.name(+)
order by s.TABLE_NAME ;
c_row c_cursor%rowtype;
t_rows number;
begin
 for c_row in c_cursor loop
  begin
   execute immediate 'select count(*) from bk_count_tables where owner=:1 and TABLE_NAME=:2 and rownum=1' 
   into t_rows using c_row.OWNER,c_row.TABLE_NAME ;
   if(t_rows = 0) then 
    execute immediate 'select count(*) from "'||c_row.TABLE_NAME||'"' into t_rows;
    insert into bk_count_tables values(c_row.OWNER,c_row.TABLE_NAME,c_row.part_col,t_rows,sysdate);
    commit; 
    end if;
  EXCEPTION
   WHEN OTHERS THEN
   DBMS_OUTPUT.PUT_LINE(c_row.OWNER||'---'||c_row.TABLE_NAME);
   rollback; 
  end;
 end loop;
end;
/

總結(jié)

以上所述是小編給大家介紹的Oracle 統(tǒng)計用戶下表的數(shù)據(jù)量實現(xiàn)腳本,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!

您可能感興趣的文章:
  • PDO取Oracle lob大字段,當數(shù)據(jù)量太大無法取出的問題的解決辦法
  • Oracle 12c新特性之如何檢測有用的多列統(tǒng)計信息詳解
  • Oracle 11g收集多列統(tǒng)計信息詳解
  • Oracle Translate 統(tǒng)計字符出現(xiàn)的次數(shù)示例代碼
  • Oracle數(shù)據(jù)庫按時間進行分組統(tǒng)計數(shù)據(jù)的方法
  • oracle表空間中空表統(tǒng)計方法示例介紹
  • oracle數(shù)據(jù)庫下統(tǒng)計專營店的男女數(shù)量的語句

標簽:中衛(wèi) 昭通 寧波 紹興 百色 自貢 遼源 海東

巨人網(wǎng)絡(luò)通訊聲明:本文標題《Oracle 統(tǒng)計用戶下表的數(shù)據(jù)量實現(xiàn)腳本》,本文關(guān)鍵詞  Oracle,統(tǒng)計,用戶,下表,的,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《Oracle 統(tǒng)計用戶下表的數(shù)據(jù)量實現(xiàn)腳本》相關(guān)的同類信息!
  • 本頁收集關(guān)于Oracle 統(tǒng)計用戶下表的數(shù)據(jù)量實現(xiàn)腳本的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    主站蜘蛛池模板: 丹寨县| 四川省| 西城区| 饶平县| 隆子县| 安仁县| 丰顺县| 克什克腾旗| 玛多县| 都兰县| 信丰县| 临江市| 广灵县| 达州市| 宜章县| 汉沽区| 美姑县| 津南区| 固镇县| 琼结县| 清水河县| 大渡口区| 东乌| 泽州县| 任丘市| 鸡东县| 汝州市| 长海县| 阿拉善右旗| 禄丰县| 桃江县| 浦江县| 武安市| 锡林浩特市| 舞阳县| 兰考县| 会同县| 四子王旗| 科尔| 阿勒泰市| 吉安市|