Oracle案例08——xx.xx.xx.xx,表空间 SYSAUX 使用率>95%%
本实例主要针对Oracle表空间饱满问题处理方法做个步骤分享。
一、告警信息
收到zabbix告警信息,表空间 SYSAUX 使用率>95%%,系统表空间sysaux使用率超过了95%。

二、处理步骤
1.登录具体数据库做相应的数据库空间使用率查询
set line 200;
set pagesize 20000;
set feedback off;
col tablespace_name for a20;
col c_free_percent for a12;
col c_used_percent for a12;
col m_free_percent for a12;
col m_USED_PERCENT for a12;
select d.tablespace_name,round(d.MB_current_Bytes,2) Curr_Size_MB,round(f.free_mb_bytes,2) Free_Szie_MB,round(d.MB_maxbytes,2) MAX_Size_MB,round((f.free_mb_bytes/d.MB_current_Bytes)*100,2) c_free_percent,round((d.MB_current_Bytes-f.free_mb_bytes)/d.MB_current_Bytes,4)*100 || '%' c_used_percent,round(((d.MB_maxbytes-d.MB_current_Bytes+f.free_mb_bytes)/d.MB_maxbytes)*100,2) m_free_percent,round((d.MB_current_Bytes-f.free_mb_bytes)/d.MB_maxbytes,4)*100 || '%' m_used_percent
from (select tablespace_name,sum(bytes/1024/1024) MB_current_Bytes,sum(maxbytes/1024/1024) MB_maxbytes from dba_data_files group by tablespace_name ) d,(select tablespace_name,sum(bytes/1024/1024) free_mb_bytes from dba_free_space group by tablespace_name) f
where d.tablespace_name=f.tablespace_name
order by c_free_percent ;

2.查询表空间对应的对象占用情况
select OWNER,segment_name,segment_type,PARTITION_NAME,bytes/1024/1024/1024 Size_GB from dba_segments where tablespace_name='SYSAUX' order by Size_GB desc

3.根据具体大对象做排查,对可以清理的相关数据清理
根据上述SQL查到的大对象主要是
1 SYS WRH$_LATCH_CHILDREN WRH$_LATCH__1153813778_29290 TABLE PARTITION 29.927734375
2 SYS WRH$_LATCH_CHILDREN_PK WRH$_LATCH__1153813778_29290 INDEX PARTITION 14.984375
3 SYS WRH$_ACTIVE_SESSION_HISTORY WRH$_ACTIVE_1153813778_29290 TABLE PARTITION 3.6474609375
4 SYS WRH$_SQLSTAT WRH$_SQLSTA_1153813778_29290 TABLE PARTITION 1.2529296875
WRH$_LATCH_CHILDREN 表示快照使用的,其中分区1153813778是DBID, 29290是快照ID
查看29290的快照ID是什么时间的
select snap_id, begin_interval_time from sys.dba_hist_snapshot order by snap_id; select snap_id, begin_interval_time from sys.dba_hist_snapshot where snap_id=29290

4.清空分区WRH$_LATCH__1153813778_29290
select * from WRH$_LATCH_CHILDREN partition ( WRH$_LATCH__1153813778_29290); alter table WRH$_LATCH_CHILDREN truncate partition WRH$_LATCH__1153813778_29290;
5.清理后表空间查看
select d.tablespace_name,round(d.MB_current_Bytes,2) Curr_Size_MB,round(f.free_mb_bytes,2) Free_Szie_MB,round(d.MB_maxbytes,2) MAX_Size_MB,round((f.free_mb_bytes/d.MB_current_Bytes)*100,2) c_free_percent,round((d.MB_current_Bytes-f.free_mb_bytes)/d.MB_current_Bytes,4)*100 || '%' c_used_percent,round(((d.MB_maxbytes-d.MB_current_Bytes+f.free_mb_bytes)/d.MB_maxbytes)*100,2) m_free_percent,round((d.MB_current_Bytes-f.free_mb_bytes)/d.MB_maxbytes,4)*100 || '%' m_used_percent
from (select tablespace_name,sum(bytes/1024/1024) MB_current_Bytes,sum(maxbytes/1024/1024) MB_maxbytes from dba_data_files group by tablespace_name ) d,(select tablespace_name,sum(bytes/1024/1024) free_mb_bytes from dba_free_space group by tablespace_name) f
where d.tablespace_name=f.tablespace_name and f.tablespace_name='SYSAUX'
order by c_free_percent ;

三、脚本附录
1.表空间segment大小查询
select OWNER,segment_name,PARTITION_NAME,segment_type,bytes/1024/1024/1024 Size_GB from dba_segments where tablespace_name='SYSAUX' order by Size_GB desc
2.表空间使用率查询
set line 200;
set pagesize 20000;
set feedback off;
col tablespace_name for a20;
col c_free_percent for a12;
col c_used_percent for a12;
col m_free_percent for a12;
col m_USED_PERCENT for a12;
select d.tablespace_name,round(d.MB_current_Bytes,2) Curr_Size_MB,round(f.free_mb_bytes,2) Free_Szie_MB,round(d.MB_maxbytes,2) MAX_Size_MB,round((f.free_mb_bytes/d.MB_current_Bytes)*100,2) c_free_percent,round((d.MB_current_Bytes-f.free_mb_bytes)/d.MB_current_Bytes,4)*100 || '%' c_used_percent,round(((d.MB_maxbytes-d.MB_current_Bytes+f.free_mb_bytes)/d.MB_maxbytes)*100,2) m_free_percent,round((d.MB_current_Bytes-f.free_mb_bytes)/d.MB_maxbytes,4)*100 || '%' m_used_percent
from (select tablespace_name,sum(bytes/1024/1024) MB_current_Bytes,sum(maxbytes/1024/1024) MB_maxbytes from dba_data_files group by tablespace_name ) d,(select tablespace_name,sum(bytes/1024/1024) free_mb_bytes from dba_free_space group by tablespace_name) f
where d.tablespace_name=f.tablespace_name
order by c_free_percent ;
3.查看快照ID、查看快照设置信息、设置快照信息
select snap_id, begin_interval_time from sys.dba_hist_snapshot order by snap_id;
select * from DBA_HIST_WR_CONTROL;
begin
DBMS_WORKLOAD_REPOSITORY.MODIFY_SNAPSHOT_SETTINGS(retention =>43200,interval =>30, topnsql =>'MAXIMUM');
end;
/

4.统计信息清理
exec dbms_stats.purge_stats(systimestamp -11);
Oracle案例08——xx.xx.xx.xx,表空间 SYSAUX 使用率>95%%的更多相关文章
- 基础概念:Oracle数据库、实例、用户、表空间、表之间的关系
基础概念:Oracle数据库.实例.用户.表空间.表之间的关系 数据库: Oracle数据库是数据的物理存储.这就包括(数据文件ORA或者DBF.控制文件.联机日志.参数文件).其实Oracle数据库 ...
- oracle service name sid , 用户 和 表空间
oracle 的四个概念: 数据库: 就是一堆静态的数据文件.注意是静态的 instance 实例: 可以类比数据库连接. 实例就是为了操作数据库而开辟的进程和内存空间,有了这个实例你才能操作数据库. ...
- oracle数据库_实例_用户_表空间之间的关系
基础概念:Oracle数据库.实例.用户.表空间.表之间的关系 数据库:Oracle数据库是数据的物理存储.这就包括(数据文件ORA或者DBF.控制文件.联机日志.参数文件).其实Oracle数据库的 ...
- Oracle学习笔记—数据库,实例,表空间,用户、表之间的关系
之前一直使用的关系型数据库是Mysql,而新公司使用Oracle,所以最近从网上搜集了一些资料,整理到这里,如果有不对的地方,欢迎大家讨论. 基本概念: 数据库:Oracle 数据库是数据的物理存储. ...
- Oracle 删除用户和表空间////Oracle创建删除用户、角色、表空间、导入导出、...命令总结/////Oracle数据库创建表空间及为用户指定表空间
Oracle 使用时间长了, 新增了许多user 和tablespace. 需要清理一下 对于单个user和tablespace 来说, 可以使用如下命令来完成. 步骤一: 删除user drop ...
- 老生常谈:关于undo表空间的使用率
就在前几天,又有一个客户向我咨询undo表空间使用率的问题. 这让我想起几年前曾经有个省份的案例,客户的实际运维人员是一位刚毕业不久的女孩,几乎不懂Oracle原理,项目经理交给她的任务也是基础运维工 ...
- 数据库实例: STOREBOOK > 表空间 > 编辑 表空间: SYSAUX
ylbtech-Oracle:数据库实例: STOREBOOK > 表空间 > 编辑 表空间: SYSAUX 表空间 > 编辑 表空间: SYSAUX 1. 一般信息返 ...
- Oracle中关于清除数据和释放表空间
一.表的重命名 flashback table test2 to before drop rename to test3;--[to test3]将表重命名 drop table test3 purg ...
- (总结)Oracle 11g常用管理命令(用户、表空间、权限)
1.启动oracle数据库: 从root切换到oracle用户进入:su - oracle 进入sqlplus环境,nolog参数表示不登录:sqlplus /nolog 以管理员模式登录:sqlpl ...
随机推荐
- SymbolTable
在ClassReader中有两个重要的属性,如下定义: /** A hashtable containing the encountered top-level and member classes, ...
- centos6 vps部署rails
centos 6 vps初始化部署rails应用1 ssh登录 vpsssh -p port root@server_ip_address 2 添加用户 adduser usernamepasswd ...
- 利用keepalived构建高可用MySQL-HA
关于MySQL-HA,目前有多种解决方案,比如heartbeat.drbd.mmm.共享存储,但是它们各有优缺点.heartbeat.drbd配置较为复杂,需要自己写脚本才能实现MySQL自动切换,对 ...
- Understanding JVM Internals---不得不转载呀
http://www.cubrid.org/blog/dev-platform/understanding-jvm-internals/ http://architects.dzone.com/art ...
- ES6常用七大特性
ES6可谓是对JS语言的一个颠覆性改变,增加了Module改善JS一直被诟病的模块化.Promise解决异步函数的回调地狱.Class的面相对象编程... 在学习ES6的过程中,大家或多或少都有看过阮 ...
- iOS开源项目周报0302
由OpenDigg 出品的iOS开源项目周报第十期来啦.我们的iOS开源周报集合了OpenDigg一周来新收录的优质的iOS开源项目,方便iOS开发人员便捷的找到自己需要的项目工具等.TodayMin ...
- SQL Serever学习4
SQL Server系统中数据库相关概念 在SQLServer数据库系统中分为2大类,系统数据库和用户数据库. SQLServer安装后系统会自动生成4个系统数据库,他们是Master,Model,M ...
- [javaSE] 数据结构(栈)
栈(stack)是一种线性存储结构,有以下特点: 1.栈中数据是按照先进后出的方式进出栈的 2.向栈中添加删除元素时,只能从栈顶进行操作 使用数组实现栈 定义一个类ArrayStack 实现入栈方法p ...
- 关系型数据库之MySQL基础总结_part1
一:数据库的操作语言的种类 MySQL 是我们最常使用的关系型数据库,对于MySQL的操作的语言种类又可以分为:DDL,DML,DCL,DQL DDL:是数据库的定义语言:主要对于数据库信息的一些定义 ...
- java加载redis以及基本操作
前言: Redis是一款开源的.高性能的键-值存储(key-value store).它常被称作是一款数据结构服务器(data structure server).Redis的键值可以包括字符串(st ...