Liangjing Bin teacher's "harvest, more than SQL optimization" on how to shorten the SQL tuning time, gives three steps,

Liangjing Bin teacher's "harvest, more than SQL optimization" on how to shorten the SQL tuning time, gives three steps,

1. First, get a whole database of information to help tune

2. Run fast access to SQL stage information

3. quickly get behind the scenes information related SQL

 

In fact, we daily, these steps will use more or less, but often lack the sort of system, where to expect, where to do it, sometimes you need the guidance of methodology, Liang help us organize, and given a key generation script , very practical, which leads to another topic, as eygle once said, "hands-on demonstration capabilities, will make the experience of others as our knowledge and skills continue to grow," in addition, we can not just black box to use, to understand the mechanism behind, how a key generated? Where well written script, where to optimize, from which we can learn what the draw, which can fully "drained" knowledge of the script.

 

1. First, get a whole database of information to help tune

We must first know the operation of the entire database, AWR naturally think of, but not all performance issues can be exposed through AWR, AWR such as acquisition time, there is a fundamental problem SQL is not executed, therefore, did not find the problem, does not mean there is no problem .

 

Use spooldb.sql script (link: https: //github.com/liangjingbin99/shouhuo/blob/master/%E7%AC%AC01%E7%AB%A0/spooldb.sql), these documents can be obtained below,

(1) last hour of ADDM: addmrpt_1_576_578.txt

(2) the last hour of AWR: awrrpt_1_577_578.html

(3) last 7 days AWR: awrrpt_1_576_578_all.html

(4) the recent half-hour ASH: ashrpt_1_20190317212222_20190317215222.html

(5) database of all relevant information: spool_BISAL_1_19-03-17_21.52.html

 

The first few easy to understand, and finally a database of all relevant information, with the spool is generated, contains the following information, we can address their individual needs, add / modify / delete collection items concern, in addition, a number of divergent ideas these collection items, the corresponding SQL, we can integrate into their own monitoring platform, automate the collection, display, utilized to the full

"Version
recent start-up time, version, and whether the RAC
within 30 minutes of CPU or waiting longest
recent load cases (according to AWR snapshots)
logical reads up to
a maximum of physical reads
executed the highest number of
parsing the highest number of
the most disk sorts
submitted more than 10,000 the number of session
SQL 100 longer than the
query shared memory occupancy
table has a degree of parallelism with
the index in parallelism with
the failure index
fail subject
bitmap index and index functions, reverse key index
composite index of more than 4 columns of combination
index numbers of more than 5
which has never built a large table index.
when the combination of the index and a separate index table which exist cross.
which objects are built on a system table space.
check whether the statistics are collected
to check which has not collected or not collected
by the collection of statistical information temporary table
log switch frequency analyzing
the amount of the last 10 days of daily log switch
log group size
view recovery_file_dest usage
check sequence 20 is smaller than the case where
the table space usage for
the entire database how
object size TOP10
trash case (size and number)
to check who taking up table space undo
check who occupy the temp table space
Rollback was observed, whether temporary segment and a general segment is automatically extended
table size not exceeding 10GB partition built
up to the top 10 of the target partition
table partitions uneven
number less than or more than 100 columns of Table 2.
Table nologging attribute of
the table COMPRESSION attribute containing the
index attribute of containing COMPRESSION
trigger
the case where the foreign key unindexed lists
hot block (summary)
hot block (developing, unaggregated)
Appendix: session_cached_cursors the case that the parameter settings, if 100% of the Increasing this parameter value
Appendix: reference for all parameters of Oracle "


2. Run fast access to SQL stage information

For specific SQL tuning, implementation plans, is an important weapon, and often require a combination of run-time statistics to see together, will be more accurate.

PS Here are some ways to get the execution plan,

"The implementation of a plan to change the abnormal case - rumor query execution plan in several ways."

 

3. quickly get behind the scenes information related SQL

SQL get information, you may need to confirm the information, and this determines the associated SQL tables, indexes, and other ancillary issues.

 

In order to get the case 2 and 3 of a key, perform spoolsql.sql script (link: https: //github.com/liangjingbin99/shouhuo/blob/master/%E7%AC%AC02%E7%AB%A0/spoolsql.sql ), to retrieve SQL_ID input, output result obtained by the spool, as follows, is SQL_ID 7ng34ruy5awxq of the SQL, file name 7ng34ruy5awxq.html,

 

 

With these two scripts, a key generation database, SQL-related statistics, very convenient, of course, understand the principle of the script, allows us to be more targeted use of these scripts, and even the transformation of the script, which learn from, into their own of knowledge for personal growth, this is the most important.
----------------
Disclaimer: This article is CSDN blogger original article "bisal", and follow CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement. .
Original link: https: //blog.csdn.net/bisal/article/details/88685091

Guess you like

Origin www.cnblogs.com/yaoyangding/p/12052233.html