日韩小视频-日韩久久一区二区三区-日韩久久一级毛片-日韩久久久精品中文字幕-国产精品亚洲精品影院-国产精品亚洲欧美云霸高清

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

軟件下載吧

當前位置:軟件下載吧 > 數據庫 > MS_SQL > ORACLE故障處理:System表空間不足的報警問題

ORACLE故障處理:System表空間不足的報警問題

時間:2024-03-10 11:43作者:下載吧人氣:19

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

–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$;

標簽MSSQL,SQLServer,技術文檔,數據庫,SQLSERVER

相關下載

查看所有評論+

網友評論

網友
您的評論需要經過審核才能顯示

熱門閱覽

最新排行

公眾號

主站蜘蛛池模板: 男女做性免费视频软件 | 99久久亚洲综合精品网站 | 色综合精品 | 黄色美女免费网站 | 欧美一区二区三区免费 | 日韩在线一区二区 | 日韩美女免费线视频 | 日本红怡院亚洲红怡院最新 | 欧美日本一道高清二区三区 | 日本污污网站 | 欧美第一精品 | 国产免费久久精品 | 亚洲欧洲一区二区三区在线 | 国产精品视频免费观看调教网 | 国产精品a人片在线观看 | 成年女人永久免费观看片 | 日韩手机看片福利精品 | 成人三级在线视频 | 日韩视频久久 | 欧美天堂| 国产三级网站在线观看 | a高清免费毛片久久 | 国产精品久久久久久久久福利 | 美国一级特a黄 | 高清色黄毛片一级毛片 | 欧美性xxxx18 | 国产tv在线观看 | 国产色司机在线视频免费观看 | 精品乱人伦一区二区 | 亚洲综合免费视频 | 在线亚洲观看 | 亚洲在线免费 | 欧美一级特黄特色大片 | 国产成人免费片在线视频观看 | 日韩精品中文字幕一区三区 | 久久精品国产免费一区 | 亚洲一区在线播放 | 国产精品欧美亚洲日本综合 | 91精品国产综合久久青草 | 久久精品国产99精品最新 | 亚洲 [12p] |