麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 數據庫 > SQL Server > 正文

System表空間不足的報警問題淺析

2024-08-31 01:05:13
字體:
來源:轉載
供稿:網友

廢話不多說了,具體代碼如下所示:

--SYSTEM表空間不足的報警 登錄之后,查詢,發現是sys.aud$占的地方太多。 SQL> select owner, segment_name, segment_type, sum(bytes)/1024/1024 space_m    from dba_segments    where tablespace_name = 'SYSTEM'  group by owner, segment_name, segment_type having sum(bytes)/1024/1024 >= 20 order by space_m desc ;  4  5  6  7  OWNER  SEGMENT_NAME   SEGMENT_TYPE SPACE_M -------- ------------------------------- ------- SYS   AUD$       TABLE      4480 SYS   IDL_UB1$     TABLE       272 SYS   SOURCE$      TABLE       72 SYS   IDL_UB2$     TABLE       32 SYS   C_OBJ#_INTCOL#  CLUSTER      27 SYS   C_TOID_VERSION#  CLUSTER      24 6 rows selected. SQL> 查看是哪個記得比較多。 col userhost format a30 select userid, userhost, count(1) from sys.aud$  where ntimestamp# >=CAST(to_date('2014-03-01 00:00:00', 'YYYY-MM-DD hh24:mi:ss') AS TIMESTAMP)  group by userid, userhost having count(1) > 500 order by count(1) desc ; 再繼續找哪天比較多。 select to_char(ntimestamp#, 'YYYY-MM-DD') audit_date, count(1)  from sys.aud$  where ntimestamp# >=CAST(to_date('2014-03-01 00:00:00', 'YYYY-MM-DD hh24:mi:ss') AS TIMESTAMP)  and userid = 'xxxx' and userhost = 'xxxx' group by to_char(ntimestamp#, 'YYYY-MM-DD')  order by count(1) desc ; select spare1, count(1) from sys.aud$  where ntimestamp# between CAST(to_date('2014-03-10 00:00:00', 'YYYY-MM-DD hh24:mi:ss') AS TIMESTAMP)  and CAST(to_date('2014-03-11 00:00:00', 'YYYY-MM-DD hh24:mi:ss') AS TIMESTAMP) and userid = 'xxxx' and userhost = 'xxxx' group by spare1 ; select action#, count(1) from sys.aud$  where ntimestamp# between CAST(to_date('2014-03-10 00:00:00', 'YYYY-MM-DD hh24:mi:ss') AS TIMESTAMP)  and CAST(to_date('2014-03-11 00:00:00', 'YYYY-MM-DD hh24:mi:ss') AS TIMESTAMP) and userid = 'xxxx' and userhost = 'xxxx' and spare1 = 'xxxx' group by action# order by count(1) desc ; 結果如下:   ACTION#  COUNT(1) ---------- ----------     101   124043     100   124043 SQL> 其實是上次打開的audit一直沒有關閉。 關閉: SQL> noaudit session; 清空: truncate table sys.aud$; ------------------------------------------------------------------------ 實戰 ------------------------------------------------------------------------ --1,查詢表空間占用情況 select dbf.tablespace_name as tablespace_name,      dbf.totalspace as totalspace,      dbf.totalblocks as totalblocks,      dfs.freespace freespace,      dfs.freeblocks freeblocks,      (dfs.freespace / dbf.totalspace) * 100 as freeRate       from (select t.tablespace_name,      sum(t.bytes) / 1024 / 1024 totalspace,      sum(t.blocks) totalblocks      from DBA_DATA_FILES t      group by t.tablespace_name) dbf,      (select tt.tablespace_name,      sum(tt.bytes) / 1024 / 1024 freespace,      sum(tt.blocks) freeblocks      from DBA_FREE_SPACE tt      group by tt.tablespace_name) dfs      where trim(dbf.tablespace_name) = trim(dfs.tablespace_name) --2,查看哪里占的比較多 SYSTEM 為step1中查詢 tablespace_name 內容 select owner, segment_name, segment_type, sum(bytes)/1024/1024 space_m    from dba_segments    where tablespace_name = 'SYSTEM'  group by owner, segment_name, segment_type having sum(bytes)/1024/1024 >= 20 order by space_m desc --3,查看是哪個記得比較多 count(1) 越大,說明占得比較多 select userid, userhost, count(1) from sys.aud$  where ntimestamp# >=CAST(to_date('2014-03-01 00:00:00', 'YYYY-MM-DD hh24:mi:ss') AS TIMESTAMP)  group by userid, userhost having count(1) > 500 order by count(1) desc --4,再繼續找哪天比較多 userid userhost 為上一步查詢內容 select to_char(ntimestamp#, 'YYYY-MM-DD') audit_date, count(1)  from sys.aud$  where ntimestamp# >=CAST(to_date('2015-03-01 00:00:00', 'YYYY-MM-DD hh24:mi:ss') AS TIMESTAMP)  and userid = 'userid' and userhost = 'userhost' group by to_char(ntimestamp#, 'YYYY-MM-DD')  order by count(1) desc ; select spare1, count(1) from sys.aud$  where ntimestamp# between CAST(to_date('2016-03-10 00:00:00', 'YYYY-MM-DD hh24:mi:ss') AS TIMESTAMP)  and CAST(to_date('2016-12-11 00:00:00', 'YYYY-MM-DD hh24:mi:ss') AS TIMESTAMP) and userid = 'userid' and userhost = 'userhost' group by spare1 ; --spare1 為上一步查詢內容 select action#, count(1) from sys.aud$  where ntimestamp# between CAST(to_date('2016-03-10 00:00:00', 'YYYY-MM-DD hh24:mi:ss') AS TIMESTAMP)  and CAST(to_date('2016-12-11 00:00:00', 'YYYY-MM-DD hh24:mi:ss') AS TIMESTAMP) and userid = 'userid' and userhost = 'userhost' and spare1 = 'Administrator' group by action# order by count(1) desc --5,關閉seeion noaudit session; --6,清空: truncate table sys.aud$; 

總結

以上所述是小編給大家介紹的System表空間不足的報警,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對VeVb武林網網站的支持!

 

注:相關教程知識閱讀請移步到MSSQL教程頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 越南一级黄色片 | 亚洲午夜在线视频 | 精品成人免费一区二区在线播放 | 久久伊| 叉逼视频 | 四季久久免费一区二区三区四区 | 国产大片全部免费看 | 免费观看黄色一级视频 | 激情在线视频 | 91精品久久久久久久久 | 欧美在线中文字幕 | 黄色免费入口 | 日韩一级片一区二区三区 | 日本va在线观看 | 精品亚洲在线 | 91在线精品亚洲一区二区 | 欧美一区2区三区4区公司二百 | 久久久精品视频国产 | 国产精品久久久久久238 | 91黄瓜视频 | 欧美精品一区二区三区在线 | av国产片 | 国产一区二区二 | 91精品国产一区二区三区四区在线 | 国产精品久久久毛片 | 黑色丝袜美美女被躁视频 | 鸳鸯谱在线观看高清 | 国产一区二区欧美精品 | 国产成人精品免高潮在线观看 | 国产高潮好爽受不了了夜色 | 久久久久久久国产a∨ | 5xx免费看| 久久久线视频 | 免费观看欧美一级片 | 精品国产1区2区3区 av视屏 | 亚洲成人福利 | 综合在线一区 | 91成人在线免费 | 国产18视频 | 今井夏帆av一区二区 | 国产一区免费 |