下載吧 - 綠色安全的游戲和軟件下載中心

          軟件下載吧

          當(dāng)前位置:軟件下載吧 > 數(shù)據(jù)庫(kù) > MS_SQL > ORACLE故障處理:System表空間不足的報(bào)警問(wèn)題

          ORACLE故障處理:System表空間不足的報(bào)警問(wèn)題

          時(shí)間:2024-03-10 11:43作者:下載吧人氣:23

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

          –SYSTEM表空間不足的報(bào)警
          登錄之后,查詢(xún),發(fā)現(xiàn)是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>
          查看是哪個(gè)記得比較多。
          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
          ;
          再繼續(xù)找哪天比較多。
          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
          ;
          結(jié)果如下:
          ACTION# COUNT(1)
          ———- ———-
          101 124043
          100 124043
          SQL>
          其實(shí)是上次打開(kāi)的audit一直沒(méi)有關(guān)閉。
          關(guān)閉:
          SQL> noaudit session;
          清空:
          truncate table sys.aud$;
          ————————————————————————
          實(shí)戰(zhàn)
          ————————————————————————
          –1,查詢(xún)表空間占用情況
          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中查詢(xún) tablespace_name 內(nèi)容
          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,查看是哪個(gè)記得比較多 count(1) 越大,說(shuō)明占得比較多
          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,再繼續(xù)找哪天比較多 userid userhost 為上一步查詢(xún)內(nèi)容
          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 為上一步查詢(xún)內(nèi)容
          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,關(guān)閉seeion
          noaudit session;
          –6,清空:
          truncate table sys.aud$;

          標(biāo)簽MSSQL,SQLServer,技術(shù)文檔,數(shù)據(jù)庫(kù),SQLSERVER

          相關(guān)下載

          查看所有評(píng)論+

          網(wǎng)友評(píng)論

          網(wǎng)友
          您的評(píng)論需要經(jīng)過(guò)審核才能顯示

          熱門(mén)閱覽

          最新排行

          公眾號(hào)

          主站蜘蛛池模板: 久久99热狠狠色精品一区| 国产精品无码一区二区在线观一| 亚洲一区二区免费视频| 无码少妇一区二区三区浪潮AV| 乱色精品无码一区二区国产盗| 老湿机一区午夜精品免费福利| 免费一本色道久久一区| 少妇精品无码一区二区三区| 免费萌白酱国产一区二区三区| www一区二区三区| 国产福利一区二区在线视频| 国模大胆一区二区三区| 精品无码一区二区三区爱欲九九| AV怡红院一区二区三区| 狠狠做深爱婷婷综合一区 | 国产乱码精品一区二区三区四川| AV鲁丝一区鲁丝二区鲁丝三区 | 伊人久久精品一区二区三区| 亚洲日本一区二区| 奇米精品视频一区二区三区| 亚洲AV综合色区无码一区| 亚洲AV无码一区二区三区DV | 一区二区在线电影| 色窝窝无码一区二区三区| 3d动漫精品一区视频在线观看| 91在线精品亚洲一区二区| 亚洲一区二区三区深夜天堂| 亚洲中文字幕一区精品自拍| 日本一区二区三区免费高清 | 亚洲国产情侣一区二区三区| 久久久无码一区二区三区| 国产日韩精品视频一区二区三区| 在线精品视频一区二区| 精品一区二区三区在线观看l | 久久久精品一区二区三区| 日韩人妻无码一区二区三区久久| 国产自产对白一区| 成人在线视频一区| 亚洲电影一区二区| 天堂一区二区三区精品| 日韩精品一区二区午夜成人版 |