本实例主要针对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%%的更多相关文章

  1. 基础概念:Oracle数据库、实例、用户、表空间、表之间的关系

    基础概念:Oracle数据库.实例.用户.表空间.表之间的关系 数据库: Oracle数据库是数据的物理存储.这就包括(数据文件ORA或者DBF.控制文件.联机日志.参数文件).其实Oracle数据库 ...

  2. oracle service name sid , 用户 和 表空间

    oracle 的四个概念: 数据库: 就是一堆静态的数据文件.注意是静态的 instance 实例: 可以类比数据库连接. 实例就是为了操作数据库而开辟的进程和内存空间,有了这个实例你才能操作数据库. ...

  3. oracle数据库_实例_用户_表空间之间的关系

    基础概念:Oracle数据库.实例.用户.表空间.表之间的关系 数据库:Oracle数据库是数据的物理存储.这就包括(数据文件ORA或者DBF.控制文件.联机日志.参数文件).其实Oracle数据库的 ...

  4. Oracle学习笔记—数据库,实例,表空间,用户、表之间的关系

    之前一直使用的关系型数据库是Mysql,而新公司使用Oracle,所以最近从网上搜集了一些资料,整理到这里,如果有不对的地方,欢迎大家讨论. 基本概念: 数据库:Oracle 数据库是数据的物理存储. ...

  5. Oracle 删除用户和表空间////Oracle创建删除用户、角色、表空间、导入导出、...命令总结/////Oracle数据库创建表空间及为用户指定表空间

    Oracle 使用时间长了, 新增了许多user 和tablespace. 需要清理一下 对于单个user和tablespace 来说, 可以使用如下命令来完成. 步骤一:  删除user drop ...

  6. 老生常谈:关于undo表空间的使用率

    就在前几天,又有一个客户向我咨询undo表空间使用率的问题. 这让我想起几年前曾经有个省份的案例,客户的实际运维人员是一位刚毕业不久的女孩,几乎不懂Oracle原理,项目经理交给她的任务也是基础运维工 ...

  7. 数据库实例: STOREBOOK > 表空间 > 编辑 表空间: SYSAUX

    ylbtech-Oracle:数据库实例: STOREBOOK  >  表空间  >  编辑 表空间: SYSAUX  表空间  >  编辑 表空间: SYSAUX 1. 一般信息返 ...

  8. Oracle中关于清除数据和释放表空间

    一.表的重命名 flashback table test2 to before drop rename to test3;--[to test3]将表重命名 drop table test3 purg ...

  9. (总结)Oracle 11g常用管理命令(用户、表空间、权限)

    1.启动oracle数据库: 从root切换到oracle用户进入:su - oracle 进入sqlplus环境,nolog参数表示不登录:sqlplus /nolog 以管理员模式登录:sqlpl ...

随机推荐

  1. linux inotifywait 下监控是否有IO

    帮助: JDU:/host-001e67a8d50b /log/today # inotifywait -h inotifywait 3.14 Wait for a particular event ...

  2. mysql重复数据查询

    假设有表test mysql> select * from test; +----+------+------+ | id | name | sex | +----+------+------+ ...

  3. vue.js 开发环境搭建

    1.安装node.js(http://www.runoob.com/nodejs/nodejs-install-setup.html) 2.基于node.js,利用淘宝npm镜像安装相关依赖 在cmd ...

  4. ES6 读书笔记

    一.let和const命令 二.变量的解构赋值 三.字符串的扩展 四.数值的扩展 五.正则的扩展 六.数组的扩展 七.函数的扩展 八.对象的扩展 九.symbol 十.proxy和reflect 十一 ...

  5. [PY3]——基本语法

    Python3基本语法-xmind图 常量/变量 1. 常量:一旦赋值就不可再改变.不能对它重新赋值.python不存在常量2. 字面常量:一个单独出现的量,未赋值给任何变量或常量3. 变量: i=3 ...

  6. laravel数据迁移的时候遇到的字符串长度的问题

    问题截图:   问题解决办法:   use Illuminate\Support\facades\Schema; Schema::defaultStringLength(191);           ...

  7. jquery对象与dom对象之间互相转换的方法

    本文主要讲述jquery对象和js里的dom对象之间互相转换的方法,使jquery对象可以直接使用js里的方法,或js里的dom对象使用jquery里的方法. jquery对象和dom对象是不一样的, ...

  8. easyui多选与接收不一致解决方案

    附代码: function batchRefund(){ if(editIndex != undefined) { $('#refundList').datagrid('endEdit', editI ...

  9. 方法返回多个值参数Out使用的方法

    string str; Console.WriteLine("请输入用户名"); string user = Console.ReadLine().ToString(); Cons ...

  10. Label控件

    文本控件包含标签控件(label).按钮控件(button).文本框控件(textBox)和有格式文本控件(richtextBox)   Label控件可以说是最简单的控件,是System.windo ...