小編給大家分享一下如何解決System表空間不足的報(bào)警問(wèn)題,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!
成都創(chuàng)新互聯(lián)是一家集網(wǎng)站建設(shè),運(yùn)河企業(yè)網(wǎng)站建設(shè),運(yùn)河品牌網(wǎng)站建設(shè),網(wǎng)站定制,運(yùn)河網(wǎng)站建設(shè)報(bào)價(jià),網(wǎng)絡(luò)營(yíng)銷(xiāo),網(wǎng)絡(luò)優(yōu)化,運(yùn)河網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強(qiáng)企業(yè)競(jìng)爭(zhēng)力??沙浞譂M足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時(shí)我們時(shí)刻保持專(zhuān)業(yè)、時(shí)尚、前沿,時(shí)刻以成就客戶(hù)成長(zhǎng)自我,堅(jiān)持不斷學(xué)習(xí)、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實(shí)用型網(wǎng)站。具體代碼如下所示:
--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 hh34: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 hh34: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 hh34:mi:ss') AS TIMESTAMP) and CAST(to_date('2014-03-11 00:00:00', 'YYYY-MM-DD hh34: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 hh34:mi:ss') AS TIMESTAMP) and CAST(to_date('2014-03-11 00:00:00', 'YYYY-MM-DD hh34: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 hh34: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 hh34: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 hh34:mi:ss') AS TIMESTAMP) and CAST(to_date('2016-12-11 00:00:00', 'YYYY-MM-DD hh34: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 hh34:mi:ss') AS TIMESTAMP) and CAST(to_date('2016-12-11 00:00:00', 'YYYY-MM-DD hh34: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$;
以上是“如何解決System表空間不足的報(bào)警問(wèn)題”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對(duì)大家有所幫助,如果還想學(xué)習(xí)更多知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)成都網(wǎng)站設(shè)計(jì)公司行業(yè)資訊頻道!
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性?xún)r(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專(zhuān)為企業(yè)上云打造定制,能夠滿足用戶(hù)豐富、多元化的應(yīng)用場(chǎng)景需求。