如何解决System表空间不足的报警问题-创新互联
小编给大家分享一下如何解决System表空间不足的报警问题,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!
成都创新互联是一家集网站建设,运河企业网站建设,运河品牌网站建设,网站定制,运河网站建设报价,网络营销,网络优化,运河网站推广为一体的创新建站企业,帮助传统企业提升企业形象加强企业竞争力。可充分满足这一群体相比中小企业更为丰富、高端、多元的互联网需求。同时我们时刻保持专业、时尚、前沿,时刻以成就客户成长自我,坚持不断学习、思考、沉淀、净化自己,让我们为更多的企业打造出实用型网站。具体代码如下所示:
--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 hh34: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 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 ; 结果如下: 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 hh34: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 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 为上一步查询内容 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,关闭seeion noaudit session; --6,清空: truncate table sys.aud$;
以上是“如何解决System表空间不足的报警问题”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注创新互联成都网站设计公司行业资讯频道!
另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
本文标题:如何解决System表空间不足的报警问题-创新互联
分享地址:http://abwzjs.com/article/dcpjds.html