COMMAND_TYPE Values December 10, 2009
Posted by mwidlake in internals.Tags: data dictionary, documentation, SQL
trackback
Follow-up post on finding most of the COMMAND_TYPES in the data dictionary is here and thanks to Christian Antognini who’s comment led me in that direction.
Spoiler – See end for getting a full list of COMMAND_TYPE values.
If you are in the habit of looking at V$SQLAREA and V$SQL to see what is going on in the database {for those of use who occasionally step out of the “GUI DBA Tool” environment} you will see a lot of stuff in there. I tend to look for the most demanding SQL so I am not interested in PL/SQL, I just want to see the SQL executed via it.
To do this, you can ignore those entires in V$SQL/V$SQLAREA with a “COMMAND_TYPE=47” filter.
This COMMAND_TYPE is useful. 3=SELECT, the most common thing you probablly see and look at, 6=UPDATE, 7=DELETE. 50=EXPLAIN.
If you google/bing/whatever COMMAND_TYPE you get many hits that list of some of the commands, all looking very similar. But very partial lists.
So I decided to amalgamate these partial lists, verrify what COMMAND_TYPE links to what commands in the databases I have access to and publish this fuller, verified list. I quickly found some commands do not stay in the SGA after issuing, so I could not confirm them {“drop index” being one}.
I got this far:
-- mdw 10/12/09 -- check for cmd types not seen before, as lists on web are not complete -- * = I have verified col sql_txt form a60 select command_type,sql_id,substr(sql_text,1,60) sql_txt from gv$sqlarea where command_type not in ( 1 -- create table * ,2 -- INSERT * ,3 -- SELECT * ,6 -- UPDATE * ,7 -- DELETE * ,9 -- create index * ,11 -- ALTER INDEX * ,26 -- LOCK table * ,42 -- ALTER_SESSION (NOT ddl) --two postings suggest 42 is alter session ,44 -- COMMIT ,45 -- rollback ,46 -- savepoint ,47 -- PL/SQL BLOCK' or begin/declare * ,48 -- set transaction * ,50 -- explain * ,62 -- analyze table * ,90 -- set constraints * ,170 -- call * ,189 -- merge * ) and rownum < 20 /
Please feel free to add to it.
Or save yourself the bother and check out the list provided in the Oracle documentation. Not under the descriptions for V$SQL or V$SQLAREA, which would have been the obvious place Mr Larry Ellison thank you, but under V$SESSION. . Further, the fact that in the V$SESSION table the column is called just COMMAND and not COMMAND_TYPE does not assist in locating this information (don’t google COMMAND and ORACLE, you get many millions of hits…). Just click the below.
This is the full table of values and meanings.
(This is the listing for 10.2 and 11.1 is very similar).
But it does not include 189 – MERGE, so that is one up for practical testing than just reading the manual 🙂
Back to the day job…
for those of use who occasionally step out of the “GUI DBA Tool” environment
Do people still do that?!?!
JOKE!
We all know you have sold your soul to the Picture Pixies Mr Burns. It’s so sad to see the loss of such a stalwart of the Command Line….
🙂
Average download of Smenu, my 110% +1 script tool has an average download of 5 per day and this trend is sustained since several months. This surprised me as I though to be the only user on earth. Seasoned DBA don’t care about smenu, they have all their own scripts and habits and new dba are supposed to be Gui oriented, so who could be interested in these Korn shell stuff? The assumption that newbies are GUI-doomed is not entirely true.
I’ve got a load of SQL scripts on my web site but I have no idea if anyone has ever downloaded any of them (the web site is in dire need of some love and attention, it even has one of those awful “under construction” messages on it!).
Maybe you have a couple of scripts Bernard that do things that most of us have just never got around to writing?
Okey a challange : Let’s me try to surprise you with the most improbable. Some months ago while investigating an unsual load on a Linux box, the unix sysadmin told us he could not go back more than 2 weeks with ‘sar’ history. Since Oracle takes also system stats I quickly enriched smenu with and Oracle sar.
the example below gives the sar stats for the last 10 snaps, it is stored into shortcut sts and called with param ‘-sar’
( replace workd Superior_TO and Inferior_to with mathematic signs, system eat them)
Lol the fixed format worked but the system truncated the output : I give up :p
Haha!! Don’t you just love technology.
I might pull it all into a proper posting for you later Bernard (but I still have some Partition postings to get around too!)
Thanks for your fine efforts.
How is it that your blog is so narrow. Looking at J.Lewiss on this same site ‘wordpress’ and it has a much larger display. I checked on both Firefow and IE and it is the same problem.
It’s the layout template I chose when I started. It limits the width of the main pane. I did not realise how much of a problem it would be until I had done a few postings. I keep thinking of changing the template but then I would probably have to review what I have posted so far to make sure it still looked OK.
Another option is to swap from free to paid-for hosting and get access to more options.
[…] posting was actually a comment by (and is the work of) Bernard Polarski on a recent post about command_types I did a week or two back. I’ve lifted it into a separate posting as (a) I thought it might be […]
[…] Martin Widlake-COMMAND_TYPE values […]
Hi,
To which Oracle Version does this query run for ? Because i got the following error when i just the above script in 10gR1 :
a.snap_id SUPERIOR_TO (( select max(snap_id) from WRH$_OSSTAT) – 10 -1 )
*
ERROR at line 51: ORA-00920: invalid relational operator
Thanks.
Your timing is perfect Raja – I moved Bernard’s excellent code to it’s own blog posting (22nd Dec) and fixed the need to replace various signs (, if they come out!) with text.
Extremely SORRY, Got it.
Problem Solved.
It is a very useful query for analysis purpose ( finding bottlenecks ).
But didnt have access to WRH$_OSSTAT, so will get back to you, after i view the output sometime…
Thanks.
Good luck with it Raja, let us know what you think
Hi Martin
For an almost full list (few are missing, e.g. MERGE and CREATE DISKGROUP) you can execute the following query:
SELECT * FROM audit_actions
Cheers,
Chris
Hi Christian,
Thanks for that – in one of those accidents of fate, I’ve just been looking at AUDIT_ACTIONS. An “Updtae Post” should turn up later today.
[…] for the command_type column in V$SQL? Martin Widlake offers a few pointers to get that info, in not one, but two […]
11.2 command values table: https://docs.oracle.com/cd/E18283_01/server.112/e17110/dynviews_3016.htm#g1432037
17 grants
43 álter user
197 PURGE RECYCLEBIN
198 purge dba_recyclebin