由于oracle临时表空间不足导致的宕机

前提

    根据导出的线程和堆文件分析结果,发现大量的不同业务sql存在查询效率低下的情况(指向的基本是同一条查询业务则请优先进行该业务sql的解释执行计划的分析和优化)

 

分析步骤:

    1. 在上述分析前提下,可进行oracle的awr报告的抓取,来进行具体的sql分析和优化。

    -----awr拉取可参考如下步骤:

  


linux:~ # su - oracle
oracle@linux:~> sqlplus '/as sysdba'

SQL*Plus: Release 11.1.0.6.0 - Production on Sun Apr 7 14:02:38 2013

Copyright (c) 1982, 2007, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

2、输入分析命令
SQL> @?/rdbms/admin/awrrpt

Current Instance
~~~~~~~~~~~~~~~~

   DB Id    DB Name      Inst Num Instance
----------- ------------ -------- ------------
 2045388596 UTF8                1 utf8


Specify the Report Type
~~~~~~~~~~~~~~~~~~~~~~~
Would you like an HTML report, or a plain text report?
Enter 'html' for an HTML report, or 'text' for plain text
Defaults to 'html'
Enter value for report_type: html



3、输入要生成报告的文件格式
Type Specified:  html


Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

   DB Id     Inst Num DB Name      Instance     Host
------------ -------- ------------ ------------ ------------
* 2045388596        1 UTF8         utf8         linux

Using 2045388596 for database Id
Using          1 for instance number


Specify the number of days of snapshots to choose from
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Entering the number of days (n) will result in the most recent
(n) days of snapshots being listed.  Pressing <return> without
specifying a number lists all completed snapshots.


4、输入要生成报告相隔的天数
Enter value for num_days: 1

Listing the last day's Completed Snapshots

                                                        Snap
Instance     DB Name        Snap Id    Snap Started    Level
------------ ------------ --------- ------------------ -----
utf8         UTF8              2809 26 Oct 2014 00:00      1
                                 2810 26 Oct 2014 01:00      1
                                 2811 26 Oct 2014 02:00      1
                                 2812 26 Oct 2014 03:00      1
                                 2813 26 Oct 2014 04:00      1
                                 2814 26 Oct 2014 05:00      1
                                 2815 26 Oct 2014 06:00      1
                                 2816 26 Oct 2014 07:00      1
                                 2817 26 Oct 2014 08:00      1
                                 2818 26 Oct 2014 09:00      1
                                 2819 26 Oct 2014 10:00      1
                                 2820 26 Oct 2014 11:00      1
                                 2821 26 Oct 2014 12:00      1


5、输入相隔的快照之间的Snap Id开始号和结束号

Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 2809

Enter value for end_snap: 2821
End   Snapshot Id specified: 2821



Specify the Report Name
~~~~~~~~~~~~~~~~~~~~~~~
The default report file name is awrrpt_1_2809_2821.html.  To use this name,
press <return> to continue, otherwise enter an alternative.

6、输入生成报告的名字:

Enter value for report_name: 20190407awr.html

    2. 打开awr报告点击

   当发现大量当sql状态io很高,即可以考虑是因为临时表空间不足导致当情况

 

   3. 查询临时表空间的使用情况和增加

【注意】这里提供的增加只是处理的一种方式(生产环境验证过的),网上提到重启数据库也能解决,在生产环境没有验证过。这里附上介绍的博客,可以自行研究

http://blog.itpub.net/12798004/viewspace-1754407/

 

-----查询

select TABLESPACE_NAME, BYTES_USED/1024/1024 used_MB,BYTES_FREE/1024/1024 free_MB
from V$TEMP_SPACE_HEADER;

   

 ----增加(其中的TEMPFILE文件位置在不知道的情况请咨询dba或者查询dba_dictionary)

alter tablespace temp
add
TEMPFILE 'D:\APP\ADMINISTRATOR\ORADATA\ORCL\TEMP02.DBF'
size 1024m
autoextend on
next 1024m maxsize 20480m;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值