表空间不足无法登录(System表空间不足的报警问题浅析)
类别:数据库 浏览量:410
时间:2021-10-24 10:59:06 表空间不足无法登录
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 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表空间不足的报警,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对开心学习网网站的支持!
您可能感兴趣
- 表空间不足无法登录(System表空间不足的报警问题浅析)
- 服务器启动nginx服务的命令(Nginx服务器添加Systemd自定义服务过程解析)
- System.Action委托
- php执行超时怎么办(PHP错误提示It is not safe to rely on the system……的解决方法)
- centos7docker部署(CentOS 7下设置Docker代理Linux下Systemd服务的环境变量配置)
- php目录使用教程学习(PHP FileSystem 文件系统常用api整理总结)
- 袁冰妍轧戏 拍《琉璃》的同时还在拍《将夜》,难怪被骂演技差(拍琉璃的同时还在拍将夜)
- 刚红就耍大牌,《琉璃》角色滤镜碎一地,心疼工作人员(琉璃角色滤镜碎一地)
- 袁冰妍郑业成这对可以处,有脸红情话他们是真的敢说(袁冰妍郑业成这对可以处)
- 《祝卿好》台词又土又甜,就喜欢这么直接的恋爱(祝卿好台词又土又甜)
- 大女主 汤唯垂青电视圈,搭档朱亚文出演《大明皇妃孙若微传》(汤唯垂青电视圈)
- 红色代表什么(红色代表什么情感和含义)
热门推荐
- docker查看镜像详细内容(Docker镜像分析工具dive原理解析)
- spring-boot 内置tomcat启动(centos环境下使用tomcat 部署SpringBoot的war包)
- hadoop集群怎么配置(Hadoop3.2.0集群搭建常见注意事项)
- 微信小程序怎么绕过人脸的(详解微信小程序官方人脸核身认证)
- dedecms有哪些功能(dedecms 二次开发之审核时间同步更新)
- mysql一次查询的过程(一篇文章弄懂MySQL查询语句的执行过程)
- dedecms添加广告栏(织梦DedeCMS v5.7 完美实现导航条下拉菜单的方法)
- html5按钮点击跳转(HTML5页面嵌入小程序没有返回按钮及返回页面空白的问题)
- mysql程序中判断select返回空值(解决MySQL读写分离导致insert后select不到数据的问题)
- wdcp命令工具(简单3条命令彻底清除WDCP占用空间)