What to do when your query is too slow? Why it is slow. What is the real cause of your problem?
If the reason why is not known, suggesting to rewrite the query, or hinting the query, suggesting parallellization et cetera is not very productive. Once in a while you may get lucky. But even then you have to realize that if your problem seems "solved", but you don't know why, nothing guarantees you that the problem won't come back tomorrow. So the first step should always be to investigate the root cause.
The tools at your disposal are, among more:
- dbms_profiler
- explain plan
- SQL*Trace / tkprof
- AWR
- SQLT report
dbms_profiler:
Use dbms_profiler if you want to know where time is being spent in PL/SQL code. Statspack is a must if you are a dba and want to know what is going on in your entire database. For a single query or a small process, explain plan and SQL*Trace and tkprof are your tools.
Click here to read more about dbms_profiler and its issues...
Explain Plan:
The EXPLAIN PLAN statement displays execution plans chosen by the Oracle optimizer for SELECT, UPDATE, INSERT, and DELETE statements. A statement's execution plan is the sequence of operations Oracle performs to run the statement.
in SQL*Plus you have to type:
explain plan for <your query>;
select * from table(dbms_xplan.display);
When you get error messages or a message complaining about an old version of plan_table, make sure you run the script utlxplan.sql.
The output you get here basically shows you what the cost based optimizer expects. It gives you an idea on why the cost based optimizer chooses an access path.
Click here to read more about explain plan...
SQL*Trace/tkprof:
For this you have to type in SQL*Plus:
- alter session set sql_trace true;
- <run your query>;
- disconnect (this step is important, because it ensures all cursors get closed, and "row source operation" is generated)
- identify your trace file in the server directory as specified in the parameter user_dump_dest
- on your operating system: tkprof <trace file> q_out.txt sys=no sort=prsela exeela fchela
The file a.txt will now give you valuable information on what has actually happened. No predictions but the truth.
By comparing the output from explain plan with the output from tkprof, you are able to identify the possible problem areas.
Click here to read more about SQL*Trace and tkprof...
Analyze AWR report:
As you have Generated AWR Report in Oracle, Next task is to Analyze AWR Report in Oracle. By Reading AWR Report you can easily solve issues like Slow database, high wait events, Slow query and many more. Though It's a lengthy report but Analyzing or Reading relevant part of AWR Report can help to troubleshoot issues in easy and fast manner.
AWR stands for Automatically workload repository, Though there could be many types of database performance issues, but when whole database is slow, then there are two possibilities.
Click here to read more about how to analyze AWR reports...
Note: You can follow so many blogs and other oracle documents also.
SQLT Report:
SQLT, also known as SQLTXPLAIN is a tool provided by Oracle Server Technologies Center of Expertise that can be used to diagnose why a particular SQL statement is performing poorly. It is not like AWR or Statspack which provide a system-wide view of performance. SQLT is very focused and works on one SQL statement at a time. SQLT inputs one SQL statement and outputs a set of diagnostics files. These files can be used to diagnose SQL statements performing poorly. In this blog, I will give an overview of SQLT and how to get started with it.
Click here to read more about sqlt reports...
If the reason why is not known, suggesting to rewrite the query, or hinting the query, suggesting parallellization et cetera is not very productive. Once in a while you may get lucky. But even then you have to realize that if your problem seems "solved", but you don't know why, nothing guarantees you that the problem won't come back tomorrow. So the first step should always be to investigate the root cause.
The tools at your disposal are, among more:
- dbms_profiler
- explain plan
- SQL*Trace / tkprof
- AWR
- SQLT report
dbms_profiler:
Use dbms_profiler if you want to know where time is being spent in PL/SQL code. Statspack is a must if you are a dba and want to know what is going on in your entire database. For a single query or a small process, explain plan and SQL*Trace and tkprof are your tools.
Click here to read more about dbms_profiler and its issues...
Explain Plan:
The EXPLAIN PLAN statement displays execution plans chosen by the Oracle optimizer for SELECT, UPDATE, INSERT, and DELETE statements. A statement's execution plan is the sequence of operations Oracle performs to run the statement.
in SQL*Plus you have to type:
explain plan for <your query>;
select * from table(dbms_xplan.display);
When you get error messages or a message complaining about an old version of plan_table, make sure you run the script utlxplan.sql.
The output you get here basically shows you what the cost based optimizer expects. It gives you an idea on why the cost based optimizer chooses an access path.
Click here to read more about explain plan...
SQL*Trace/tkprof:
For this you have to type in SQL*Plus:
- alter session set sql_trace true;
- <run your query>;
- disconnect (this step is important, because it ensures all cursors get closed, and "row source operation" is generated)
- identify your trace file in the server directory as specified in the parameter user_dump_dest
- on your operating system: tkprof <trace file> q_out.txt sys=no sort=prsela exeela fchela
The file a.txt will now give you valuable information on what has actually happened. No predictions but the truth.
By comparing the output from explain plan with the output from tkprof, you are able to identify the possible problem areas.
Click here to read more about SQL*Trace and tkprof...
Analyze AWR report:
As you have Generated AWR Report in Oracle, Next task is to Analyze AWR Report in Oracle. By Reading AWR Report you can easily solve issues like Slow database, high wait events, Slow query and many more. Though It's a lengthy report but Analyzing or Reading relevant part of AWR Report can help to troubleshoot issues in easy and fast manner.
AWR stands for Automatically workload repository, Though there could be many types of database performance issues, but when whole database is slow, then there are two possibilities.
Click here to read more about how to analyze AWR reports...
Note: You can follow so many blogs and other oracle documents also.
SQLT Report:
SQLT, also known as SQLTXPLAIN is a tool provided by Oracle Server Technologies Center of Expertise that can be used to diagnose why a particular SQL statement is performing poorly. It is not like AWR or Statspack which provide a system-wide view of performance. SQLT is very focused and works on one SQL statement at a time. SQLT inputs one SQL statement and outputs a set of diagnostics files. These files can be used to diagnose SQL statements performing poorly. In this blog, I will give an overview of SQLT and how to get started with it.
Click here to read more about sqlt reports...
Thanks for sharing this Oracle Database blog. It is really helpful, Continue sharing more like this.
ReplyDeleteOracle Training in Chennai | Oracle course in Chennai | Oracle DBA Training in Chennai
I have to voice my passion for your kindness giving support to those people that should have guidance on this important matter.
ReplyDeletefire and safety course in chennai
I enjoy what you guys are usually up too. This sort of clever work and coverage! Keep up the wonderful works guys I’ve added you guys to my blog roll.\
ReplyDeletefire and safety course in chennai
Good to read thanks for the author.
ReplyDeletebest java training institute in chennai
java j2ee training in chennai
This comment has been removed by a blog administrator.
ReplyDeleteHey, would you mind if I share your blog with my twitter group? There’s a lot of folks that I think would enjoy your content. Please let me know. Thank you.
ReplyDeleteJava Training in Chennai | J2EE Training in Chennai | Advanced Java Training in Chennai | Core Java Training in Chennai | Java Training institute in Chennai
The information's are helpful to enhance the careers...Good Works!!! keep it up
ReplyDeleteJava training in chennai | Java training in annanagar | Java training in omr | Java training in porur | Java training in tambaram | Java training in velachery
I like this one...more helpful information provided here.I am quite sure I will learn much new stuff right here! Good luck for the next!
ReplyDeleteOracle Training | Online Course | Certification in chennai | Oracle Training | Online Course | Certification in bangalore | Oracle Training | Online Course | Certification in hyderabad | Oracle Training | Online Course | Certification in pune | Oracle Training | Online Course | Certification in coimbatore
Nice blog Post ! This post contains very informative and knowledgeable. oracle training in chennai
ReplyDeleteWow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your blog.
ReplyDeleteJava Training in Chennai
Java Training in Velachery
Java Training inTambaram
Java Training in Porur
Java Training in Omr
Java Training in Annanagar
This blog is very helpful for us...I got some important information from this blog..
ReplyDeleteDigital Marketing Training in Chennai
Digital Marketing Training in Velachery
Digital Marketing Training in Tambaram
Digital Marketing Training in Porur
Digital Marketing Training in Omr
Digital MarketingTraining in Annanagar
very well explained .I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up.
ReplyDeleteSoftware Testing Training in Chennai
Software Testing Training in Velachery
Software Testing Training in Tambaram
Software Testing Training in Porur
Software Testing Training in Omr
Software Testing Training in Annanagar
What a great article!. Your posts is really helpful for me. Thanks for your wonderful post. I am very happy to read your post
ReplyDeleteJava Training in Chennai
Java Course in Chennai
Deep Learning Projects assist final year students with improving your applied Deep Learning skills rapidly while allowing you to investigate an intriguing point. Furthermore, you can include Deep Learning projects for final year into your portfolio, making it simpler to get a vocation, discover cool profession openings,
ReplyDeleteOracle DBA Training in Bangalore
This comment has been removed by a blog administrator.
ReplyDelete
ReplyDeleteThis blog is really awesome. I learned lots of informations in your blog. Keep posting like this...
German Classes in Bangalore
German Language Course in Bangalore
German Language Course in Hyderabad
German Language Course in Delhi
German Language Classes in Pune
This comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteGreat post. keep sharing such a worthy information.
ReplyDeleteSalesforce Training in Chennai
very informative blogs posting thanks you so much sharing me information.
ReplyDeleteGerman Language Course In Chandigarh
This comment has been removed by a blog administrator.
ReplyDeleteThis post is so interactive and informative.keep update more information...
ReplyDeleteccna Training in Tambaram
ccna course in Chennai
very informative blogs posting thanks you so much sharing me information.
ReplyDeleteif you are looking for zirconia crowns in india. then you can visit dental direkt india, which is best zirconia provider in india
Thank you so much for such a well-written article. It’s full of insightful information
ReplyDeleteBest Zirconia Brands In India
Thank you so much for such a well-written article. It’s full of insightful information
ReplyDeleteif you are looking for best zirconia crowns in india. then you can visit dental direkt india, which is best zirconia provider in india
Nice blog! Thanks for sharing this valuable information
ReplyDeleteGreatest Challenges of Selenium
Challenges of Selenium
I really appreciate the kind of topics you post here, a great information that is actually helpful for us and you can also visit our link for best zirconia crowns in india
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by the author.
ReplyDeletevery well explained.thanks for sharing such a informative post.
ReplyDeleteSQL course in Pune
great, valuable post , i have learned many intresting thing about sql from your blog, thanks . keep posting and checking out my blog if your intresting in python course in satara
ReplyDelete