473,408 Members | 1,784 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

About Execution Plan

11
Hi all,

How to get Execution Plan for a SQL in SQL*Plus prompt?

Thanks,
Apr 18 '07 #1
6 3370
debasisdas
8,127 Expert 4TB
In the ...\oracle\product\10.2.0\db_1\RDBMS\ADMIN folder (or in other location depending on orcl version) u get a fie

UTLXPLAN.SQL


first run the script to create the plan table

then

SQL>SET AUTOTRACE ON

aftr that try with any qeury

it will show the execution plan of the query..


Hope it works fine for u
Apr 28 '07 #2
Ora
11
Thanks alot its working

In the ...\oracle\product\10.2.0\db_1\RDBMS\ADMIN folder (or in other location depending on orcl version) u get a fie

UTLXPLAN.SQL


first run the script to create the plan table

then

SQL>SET AUTOTRACE ON

aftr that try with any qeury

it will show the execution plan of the query..


Hope it works fine for u
May 11 '07 #3
debasisdas
8,127 Expert 4TB
You are always welcome.

Feel free to put your doubts/queries in the forum.

But first give a try from your side before posting in forum.

And if possible mention what/how u have tried to solve the problem .

Then it will be helpful for the Experts in the forum in understanding/solving your problem


Best of Luck..
May 11 '07 #4
In the ...\oracle\product\10.2.0\db_1\RDBMS\ADMIN folder (or in other location depending on orcl version) u get a fie

UTLXPLAN.SQL


first run the script to create the plan table

then

SQL>SET AUTOTRACE ON

aftr that try with any qeury

it will show the execution plan of the query..


Hope it works fine for u
Hi debasis,
Suppose I have a procedure which contains several select into statements. How can I see the explain plan for these individual select into statements when I execute the procedure? I don't seem to have proper rights to view the TRACE, but for individual sql statements, I find out the explain plan by seeing the plan_table, but for select statements executed inside a procedure, what should be my approach?
Jun 8 '07 #5
debasisdas
8,127 Expert 4TB
please follow these following steps.

1.start an user section.
2.connect to sys account.
3.run the following query
Expand|Select|Wrap|Line Numbers
  1. SELECT SID,SERIAL#,STATUS,NVL(USERNAME,'ORACLE')AS USERNAME,OSUSER,MACHINE,PROGRAM,ROUND(LAST_CALL_ET/60,2) LAST_CALL,TO_CHAR(LOGON_TIME,'DD-MON-YY HH24:MI') AS LOGON_TIME FROM sys.V_$SESSION 
  2.  
4.it returns SID AND SERIAL# of the first user.
5.then run this
Expand|Select|Wrap|Line Numbers
  1. exec dbms_system.set_sql_trace_in_session(sid,serial#,true);
  2.  
6.now run the package containing some select into statments.
7.then run this
Expand|Select|Wrap|Line Numbers
  1. exec dbms_system.set_sql_trace_in_session(sid,serial#,false);
  2.  
8.it creates a trace file(.trc) in UDUMP folder(location deponds on the version of oracle you are using.)
9.Then use the utility tool TKPROF to generate the report.
Jun 9 '07 #6
please follow these following steps.

1.start an user section.
2.connect to sys account.
3.run the following query
Expand|Select|Wrap|Line Numbers
  1. SELECT SID,SERIAL#,STATUS,NVL(USERNAME,'ORACLE')AS USERNAME,OSUSER,MACHINE,PROGRAM,ROUND(LAST_CALL_ET/60,2) LAST_CALL,TO_CHAR(LOGON_TIME,'DD-MON-YY HH24:MI') AS LOGON_TIME FROM sys.V_$SESSION 
  2.  
4.it returns SID AND SERIAL# of the first user.
5.then run this
Expand|Select|Wrap|Line Numbers
  1. exec dbms_system.set_sql_trace_in_session(sid,serial#,true);
  2.  
6.now run the package containing some select into statments.
7.then run this
Expand|Select|Wrap|Line Numbers
  1. exec dbms_system.set_sql_trace_in_session(sid,serial#,false);
  2.  
8.it creates a trace file(.trc) in UDUMP folder(location deponds on the version of oracle you are using.)
9.Then use the utility tool TKPROF to generate the report.

I don't have these privileges, actually. That's what I meant by saying "I don't seem to have proper rights to view the TRACE". Are there any other way-outs? For example, in Sybase you can do so, by pasting a pl/sql block and then running the explain plan for the whole block
Jun 11 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Vinny | last post by:
Can anyone help me with this strange problem please? I have a stored procedure, with a parameter defined as a uniqueidentifier. The procedure does a select with a number of joins, and filters...
3
by: Will Atkinson | last post by:
Hi All, I'm a relative newbie to SQL Server, so please forgive me if this is a daft question... When I set "Show Execution Plan" on in Query Analyzer, and execute a (fairly complex) sproc, I...
2
by: Marie | last post by:
Hi, I´m trying to perform Fourier Transforms on contiuously incoming images from a camera. I have sofar been using the Basic Interface for planning and execution for every image. Later I have...
2
by: Jenny Zhang | last post by:
Hi, I am running OSDL-DBT3 test against PostgreSQL. I found performance difference between the runs even though the data and queries are the same. I tried to study this problem by getting...
2
by: Jenny Zhang | last post by:
The osdl-dbt3 test starts with building and vacuuming the database. The execution plans were taken after the vacuuming. I did two tests with the same database parameters: 1. run two osdl-dbt3...
2
by: Ina Schmitz | last post by:
Hi NG, does IBM Universal Database 8.2 make any difference between actual and estimated execution plans like in SQL Server ("set showplan_all on" for estimated execution plan and "set statistics...
4
by: TheRealPawn | last post by:
I'm trying to get the execution plan for a single stored procedure from Profiler. Now, I've isolated the procedure but I get all execution plans. Any ideas on how to connect the SPIDs so that I...
7
by: Ronald S. Cook | last post by:
I've always been taught that stored procedures are better than writing SQL in client code for a number of reasons: - runs faster as is compiled and lives on the database server - is the more...
5
by: sqlgirl | last post by:
Hi, We are trying to solve a real puzzle. We have a stored procedure that exhibits *drastically* different execution times depending on how its executed. When run from QA, it can take as...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.