前提
:
根据导出的线程和堆文件分析结果,
发现大量的不同业务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 |
---|
—-增加(其中的TEMPFILE文件位置在不知道的情况请咨询dba或者查询dba_dictionary)
alter tablespace temp |
---|