How to set autotrace to explain plan ONLY
Hi,
I would like to see explain plan for a long running statement.
Now if I do following:
set autotrace on explain
UPDATE ......-- my statement
I get the plan, but the rows are updated also :-(
Is there a way to tell ORACLE, please show me the explain plan but dio not execute the statement?
Thanks
ONLY FOR queries you can use
set autotrace traceonly explain
And actually query isn't executed. For other DML you cannot use that.
The other way can be explaining the query and then selecting the plan_table output:
SQL> explain plan for update t set code = 3;
Explained.
SQL> SELECT * FROM table(DBMS_XPLAN.DISPLAY);
PLAN_TABLE_OUTPUT
Plan hash value: 931696821
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | UPDATE STATEMENT | | 3 | 9 | 3 (0)| 00:00:01 |
| 1 | UPDATE | T | | | | |
| 2 | TABLE ACCESS FULL| T | 3 | 9 | 3 (0)| 00:00:01 |
Note
PLAN_TABLE_OUTPUT
- dynamic sampling used for this statement
13 rows selected.
SQL> see http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_xplan.htm
Gints Plivna
http://www.gplivna.eu
Similar Messages
-
How to provide tuning solution from explain plan only
Dear all,
If I do not have any kind of access to the database and only have explain plan with me,how I can provideperformance or query tuning solutions from that??
Regards
Anirban958657,
If I do not have any kind of access to the database and only have explain plan with me,how I can provide performance or query tuning solutions from that??
This is contradictory as you said you don't have access but you have explain plan. You wont get any explain plan until you connect to the database and run "Explain plan for" statement for the query. How do you get the "explain plan"? If it is provided by someone to you, you might request to get the "Execution Plan" for the query.
Keep in mind that "explain plan" and "execution plan " - these two are not same.
Explain plan is not enough for predicting elapsed/response time of a query as Explain plan is static Whereas Execution plan is dynamic and talks about query in execution.
Oracle provides following things for a query to diagnose its performance :
1. Static - Explain plan - Not enough
2. Dynamic: Execution plan - Run time Plan
3. awr/ statspack execution plan --Run time from the past - this is again dynamic execution plan of query runs in the past
Tuning recommendation is possible by comparing run time of the same query in the past and today's run time and based on further analysis.
Tuning Recommendation is not possible if you have only Explain plan. -
Explain plan only in spool file
Hi there,
I am trying to spool only my explain plan to a file, at the moment i can only return all the results and then explain plan to the file. This is a bit of a problem as i am running some rather long queries and some of them return over 80MB of data. this is what i have so far:
set termout off
timing start
set autotrace on
set heading off
spool h:\test1.lst
select unique1 from table1;
timing stop
spool off
set autotrace off
set termout on
any help on this would be great.
Thanks!Or for a handy way to preview the expected plan without executing the query, try www.williamrobertson.net/code/xplan.sql
SQL> SELECT COUNT(*) FROM dept d
2 WHERE EXISTS
3 ( SELECT NULL FROM emp e
4 WHERE e.deptno = d.deptno )
5
SQL> -- Note we did not execute anything...
SQL> @xplan
Plan hash value: 4196393176
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 6 | 4 (25)| 00:00:01 |
| 1 | SORT AGGREGATE | | 1 | 6 | | |
| 2 | NESTED LOOPS | | 3 | 18 | 4 (25)| 00:00:01 |
| 3 | SORT UNIQUE | | 14 | 42 | 3 (0)| 00:00:01 |
| 4 | TABLE ACCESS FULL| EMP | 14 | 42 | 3 (0)| 00:00:01 |
|* 5 | INDEX UNIQUE SCAN | PK_DEPT | 1 | 3 | 0 (0)| 00:00:01 |
Predicate Information (identified by operation id):
5 - access("E"."DEPTNO"="D"."DEPTNO")
SQL> -- And the query is still there:
SQL> l
1 SELECT COUNT(*) FROM dept d
2 WHERE EXISTS
3 ( SELECT NULL FROM emp e
4* WHERE e.deptno = d.deptno ) -
How to export results of explain plan?
A colleague tells me that in an older version of SQLDeveloper (1.2.1, perhaps?), he was able to export the results of the explain plan operation (I don't know what export forms were available). In the current version (1.5.1), it generates a tree component with information I can look at, but there's no way to write out these results in any form. Am I missing something?
HOW TO TRANSPORT A SQL TUNING SET [ID 456019.1]
Modified 08-SEP-2008 Type HOWTO Status PUBLISHED
In this Document
Goal
Solution
Applies to:
Oracle Server - Enterprise Edition - Version: 10.2.0.1 to 11.1.0.6
Information in this document applies to any platform.
10.2.X,11.1.X
Goal
The Purpose of This Note is to Show the Steps needed to Transport a Sql Tuning Set from
One Database server to another Database Server.
Solution
The Sql Tuning Set name is small_sh_sts_4.It is on 10.2.0.2.0 Database server.
It has 4 sqls .
select sql_id, substr(sql_text,1, 15) text
from dba_sqlset_statements
where sqlset_name = 'small_sh_sts_4'
order by sql_id;
SQL_ID TEXT
4qdz7j26mdwzb SELECT /*+ my_q
6y289t15dqj9r SELECT /*+ my_q
ckm14c67njf0q SELECT /*+ my_q
g37muqb81wjau SELECT /*+ my_q
1) Create the Staging Table ON THE SOURCE SYSTEM ( IN this case 10.2.0.2.0 ) .
execute DBMS_SQLTUNE.CREATE_STGTAB_SQLSET(table_name =>'TEST');
PL/SQL procedure successfully completed.
SQL> select count(*) from test;
COUNT(*)
0
2) Popluate the table TEST using DBMS_SQLTUNE.PACK_STGTAB_SQLSET THE SOURCE SYSTEM (IN this case 10.2.0.2.0 )
execute DBMS_SQLTUNE.PACK_STGTAB_SQLSET(sqlset_name => 'small_sh_sts_4',staging_table_name => 'TEST');
PL/SQL procedure successfully completed.
select count(*) from test;
SQL> select count(*) from test;
COUNT(*)
4
3) Export the table table test on THE SOURCE SYSTEM ( IN this case 10.2.0.2.0 )
and move the table to the Destination Server
and Import it . The staging table TEST can also be moved using
the mechanism of choice such as datapump or database link.
While exporting the table you will see something like
About to export specified tables via Conventional Path ...
Table(T) or Partition(T:P) to be exported: (RETURN to quit) > TEST
. . exporting table TEST 4 rows exported
. . exporting table TEST_CBINDS 0 rows exported
. . exporting table TEST_CPLANS 34 rows exported
Import on the Destination system ( IN this CASE it was 11.1.0.6.0 )
While Importing the table you will see something like
. importing SH's objects into SH
. importing SH's objects into SH
. . importing table "TEST" 4 rows imported
. . importing table "TEST_CBINDS" 0 rows imported
. . importing table "TEST_CPLANS" 34 rows imported
Import terminated successfully without warnings.
SQL> select count(*) from test;
COUNT(*)
4
Verify the contents of DBA_SQLSET or USER_SQLSET on the Destination system
Select NAME,CREATED,STATEMENT_COUNT FROM DBA_SQLSET;
4) Unpack the table using DBMS_SQLTUNE.UNPACK_STGTAB_SQLSET on the Destination system ( IN this CASE it was 11.1.0.6.0 )
execute DBMS_SQLTUNE.UNPACK_STGTAB_SQLSET( sqlset_name => '%',-
replace => TRUE,-
staging_table_name => 'TEST');
Select NAME,OWNER,CREATED,STATEMENT_COUNT FROM DBA_SQLSET;
NAME CREATED STATEMENT_COUNT
small_sh_sts_4 24-AUG-07 4
Related
Products
•Oracle Database Products > Oracle Database > Oracle Database > Oracle Server - Enterprise Edition -
How to set User-field in Plan order
Hi
could you tell me please how to set a user-filed in plan order. when I run MRP planing, I can write some data in this filed.
thanks
henryHi,
Actually these user defind fields are used/assigned in the routing.
Initially u have to define your own user defind profile through OPEC transaction.
Assign this profile in the routing.
So when ur executing Mfg activities, suppose if ur using some high materials like silver...etc.
Then after executing the particular operation some amount of silver chips or silver scrap will generated .
To keep chip/scrap qty operation and date which user defind is used.
Once u have assigned this profile to routing, then it will be automatically copied in the planned order/production order.when ur confirming the order then u have to enter the all related data.
Regards
Vijay -
How can i paste the explain plan from toad..
Hello all
I tried taking a snap of the explain plan from toad but in this forum the paste option is disabled...please help964145 wrote:
I tried taking a snap of the explain plan from toad but in this forum the paste option is disabled...please helpI don't know, but it is a waste of time since explain plans from Toad are not useful.
Please read the forum FAQ on providing information for a tuning request, it describes how to generate an explain plan that can be shared.
{message:id=9360003}
This is an example.
SQL> explain plan for
2 select * from dual;
Explained.
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
Plan hash value: 3543395131
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 2 | 2 (0)| 00:00:01 |
| 1 | TABLE ACCESS FULL| DUAL | 1 | 2 | 2 (0)| 00:00:01 |
-------------------------------------------------------------------------- -
How to set role which can issue only one command
I am thinking about setting role, which will be allowed to issue olny one command. I have created role test. Which has the following entries in the following files:
/etc/user_attr
test::::profiles=OneCommand;type=role
/etc/security/exec_attr
OneCommand:solaris:cmd:::/tmp/data.sh:euid=0
After this I sill could issue all comands, not only test command /tmp/data.sh.
When I issued comand profiles on test role I received the following:
bash-3.00$ profiles test
OneCommand
Basic Solaris User
All
So I commented line in the /etc/policy.conf to read:
#PROFS_GRANTED=Basic Solaris User
After that, when I try to issue /tmp/data.sh command as a test role I receive the following error:
$ /tmp/data.sh
pfexec: Exec format error
Does anybody know how to set up the role which can issue only one command ? Maybe there is a way to do this in the way which wil not affect another roles (ie, not to touch /etc/policy.conf).
Best regardsRadekW wrote:
I am thinking about setting role, which will be allowed to issue olny one command. I have created role test. Which has the following entries in the following files:They will need the ability to run at least a profile shell otherwise all bets are off. So now you're down to two commands. :-)
bash-3.00$ profiles test
OneCommand
Basic Solaris User
AllFirst you need to define what already exists by default. (policy.conf)
Then you get to change those defaults or create a new default list just for test.
Then you get to add a role or profile for test that allows the execution of a profile shell and one command.
Then you should test all of the user accounts to ensure that something didn't break. This step might be a little overkill.
alan -
How to set the font size on only one object!
I wonder how i could programmatically set the font size on only one object?
Igor StojčevićHello,
You can use the builtin SRW.SET_FONT_SIZE
http://www.oracle.com/webapps/online-help/reports/10.1.2/topics/htmlhelp_rwbuild_hs/rwrefex/plsql/builtins/srw/srw_set_font_size.htm
in the Format trigger
http://www.oracle.com/webapps/online-help/reports/10.1.2/topics/htmlhelp_rwbuild_hs/rwrefex/plsql/triggers/tr_format_trigger.htm
Regards -
Saving/exporting autotrace and explain plan
Is it at all possible to export or save the explain plan and/or autotrace information from Oracle SQL Developer to text?
You must first click Explain icon or Autotrace Icon to generate them before you can check under the tab.
-
How to set one layout to display only?
Hello, Expers,
I want to display only one layout. The scenario is: when the user input some data in a layout and click on one 'input finish' function button which means that the user has finished input data in that layout, then the system will set that layout to display only. I don't want to use the variable with comparion column because that will also cause all the layout to display only. What I want to do is just set only one layout to display only. Anyone know how to do?Dear guqing,
please take a look at
http://help.sap.com/saphelp_nw70/helpdata/en/45/9d0fbe42c40063e10000000a11466f/frameset.htm
http://help.sap.com/saphelp_nw70/helpdata/en/43/174720c5dd3db4e10000000a422035/frameset.htm
You can use the command SET_INPUT_MODE or SET_DATA_ENTRY_MODE
Regards
Matthias Nutt
SAP Consulting Switzerland -
How to get the complete explain plan stored in a particular OUTLINE
Hi,
How do I get the complete text of the explain plan stored in a particular outline? I have the name of the outline.
I can't run the query which has this outline as it is on production.I want to know which tables/views will have the explain plan text?
Thanks,
Sach
Edited by: user631085 on Mar 29, 2009 11:27 PM
Edited by: user631085 on Mar 29, 2009 11:29 PM
Edited by: user631085 on Mar 29, 2009 11:29 PMYou can access the _OUTLINES views.
Pelase refer the following and look for 'Viewing Outline Data':
http://youngcow.net/doc/oracle10g/server.102/b14211/outlines.htm -
How to switch to graphical explain plan
When I view an explain plan it is presented in a textualy. I would like to switch it to graphical but can not figure out how to. Anyone know how to make the switch?
Thanks,
BillGraphical representation is possible as long as you are using the SVG plugin.
I had installed the plugin but did not realize is was not working until I saw our primary dba's screen yesterday with the graphics.
I started looking around and realized that the SVG plugin was disabled in my browser by default. I enabled the plugin and now everything works.
Bill -
Autotrace and explain plan just show a green dot
When I click on the AUTOTRACE and the EXPLAIN PLAN tabs in SQL Developer all I get is a green dot. I do have PLUSTRCE roll defined to my signon. I am running SQL DEVELOPER 1.5.1 on Windows XP Professional Patch 3.
You must first click Explain icon or Autotrace Icon to generate them before you can check under the tab.
-
How does SQL Developer run EXPLAIN PLAN?
Hello,
I noticed that SQL Developer can do an EXPLAIN PLAN even though I don't have a PLAN_TABLE available for the user that I use to connect in SQL Developer.
I was always wondering whether there was a way to do an EXPLAIN PLAN without a PLAN_TABLE, apparently this seems to be possible.
ThomasIf I try an explain plan when I do not have a plan table available, I get the message "A PLAN_TABLE is required to access the explain plan, but it does not exist. Do you want to create a PLAN_TABLE?". Unfortunately, as that user does not have create table privs, if I say Yes I get the following error "ORA-01031: insufficient privileges".
Given this, if you are doing an explain plan, you either have access to a plan table or you have create table privs and SQL Developer has created the plan table for you. -
How to set up the inspection plan for the material in super BOM
Hello,
how to get the accurate inspection plan of the IQC for the material which was class item in a super BOM?
I've gotten the characteristic value from the sales order, and get the PO after MPR. The problem is how to specify the target value and the range of inspection characteristic in inspection plan, because the value is temporary?
Thanks!
LinHello,
I think you need to create MIC which linked with the configuration characteristic, and specify "inspection by configuration" for the inspection type.
then the configuration value in the sales order can be transfered to the inspection lot when production released or goods receipts if you use inspection type 03 or 04. that means the value range for the MIC will be determined dynamically for each sales order.
Regards, Winnie
Maybe you are looking for
-
Reset PMU after removing battery
Is there a line missing in the instructions at http://docs.info.apple.com/article.html?artnum=14449 for resetting the Power Management Unit for the iBook G4 among others? They do not mention removing the battery and power cord. The instructions for s
-
SAP Sourcing 7.0 upgrade
Hi, We are planning to upgrade SAP E-Sourcing 5.1 to SAP Sourcing 7.0 Kindly let me know if any one you have completed the upgrade process and pls share your experience and challenges you faced during the upgrade. Came to know that SAP Sourcing 9.0 o
-
Mac hangs at white screen with spinning with loading wheel while shutting down.
I've had a problem with my computer recently that really bugs me, because I been needing to install os x updates, but when i try to shut my computer down, it hangs at a white screen with the grey loading wheel forever until I forcibly shut it down. T
-
Reg:list of stock tranporting order(STO) deliveries whose GR is open
Hi All, please respond , i search this question in forums,this question was repeated but unanswerd, my requirement is. get the list of deliveries for STO and whose GR is open is there any standard bapi to get like this... if there is no bapi for this
-
Bonus has to be calc 4m nominal basic post in GL as liability for employer
Hi Experts, I a have scenario like Bonus is annual that has to be paid from nominal basic, it must be calculated every month from nominal basic Ex: if employee worked 10 days in January that month nominal bonus has to calculated credited in particula