V$sqltext & v$sqlarea
I am trying to view the SQL that is being passed to my Oracle 10g server from my .NET app. In a previous post I was told to use the v$sqltext & v$sqlarea views. Using sqlplus from the command line, I am able to produce the 1 line that I believe is the statement I am after. The statement is truncated after 1 line and I am unable to see more. I did try playing with the set command & also tried to find a gui sqlplus so the statement would simply scroll when entered. Is there a gui sqlplus for Oracle 10g? Can anyone offer any advice on how to simply view update, insert & select statements? Any help is appreciated.
Perfect. Downloaded, installed, works wonderful. I can finally see my query. Any ideas why the parameters being passed from .NET are not the actual values being passed into the query?
UPDATE "WHSTSTICKETS" SET "CUSTOMER_ID" = :CUSTOMER_ID, "RECEIVED_BY" = :RECEIVED_BY, "CALL_DATETIME" = :CALL_DATETIME, "AREA_ID" = :AREA_ID, "CLASS_ID" = :CLASS_ID, "STATUS_ID" = :STATUS_ID, "RESOLVE_DUE_DATE" = :RESOLVE_DUE_DATE, "RESOLVE_DATETIME" = :RESOLVE_DATETIME, "RESOLVER_ID" = :RESOLVER_ID, "DETAILS" = :DETAILS, "PRIORITY" = :PRIORITY, "SUBJECT" = :SUBJECT, "EMAIL_CC" = :EMAIL_CC, "ROOT_CAUSE_ID" = :ROOT_CAUSE_ID, "REGION" = :REGION, "EMAIL_CC_1" = :EMAIL_CC_1, "EMAIL_CC_2" = :EMAIL_CC_2, "EMAIL_CC_3" = :EMAIL_CC_3, "EMAIL_CC_4" = :EMAIL_CC_4, "EMAIL_CC_5" = :EMAIL_CC_5, "EMAIL_CC_6" = :EMAIL_CC_6, "EST_HOURS" = :EST_HOURS, "PQR" = :PQR, "PROJECT_ID" = :PROJECT_ID WHERE "WHSTS_ID" = :original_WHSTS_ID
Similar Messages
-
Hi there,
I created a new user account and granted it dba.
I logged on to this account and I am trying to run select statments on V$SQLAREA, V$SQL, V$SQLTEXT, and V$SQL_PLAN, but I am getting
ORA-00942: table or view does not exist
00942. 00000 - "table or view does not exist"
However, I can get into these views with SYSTEM.
I loged into system and tried to grant
grant select on V$SQLTEXT to user_name;
SQL Error: ORA-01031: insufficient privileges
01031. 00000 - "insufficient privileges"
*Cause: An attempt was made to change the current username or password
without the appropriate privilege. This error also occurs if
attempting to install a database without the necessary operating
system privileges.
now, I know i'm not trying to change password nor attempting to instal new database.
I am runnning Oracle XE and the views are
OBJECT_NAME OBJECT_TYPE STATUS OWNER STATUS
V$SQL_PLAN SYNONYM VALID PUBLIC VALID
V$SQLAREA SYNONYM VALID PUBLIC VALID
V$SQLTEXT SYNONYM VALID PUBLIC VALID
V$SQL SYNONYM VALID PUBLIC VALID
Where is the problem?
Thanks in advance for any effortHi Jana,
Could you please tell the Oracle Version. I test it and it works. Look:
$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.3.0 - Production on Jue Jul 29 13:57:32 2010
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> select granted_role
2 from dba_role_privs
3 where grantee='TJ';
GRANTED_ROLE
CONNECT
RESOURCE
PLUSTRACE
SQL> conn tj/tj
Connected.
SQL> select * from v$sql;
select * from v$sql
ERROR at line 1:
ORA-00942: table or view does not exist
SQL> conn / as sysdba
Connected.
SQL> grant dba to tj;
Grant succeeded.
SQL> conn tj/tj
Connected.
SQL> select count(8) from v$sql;
COUNT(8)
1354
SQL> select count(8) from v$sqlarea;
COUNT(8)
1206
SQL> select count(8) from v$sql_plan;
COUNT(8)
7464
SQL> select count(8) from v$sqltext;
COUNT(8)
11425John -
V$sql, v$sqlarea and v$sqltext
Hello,
Any idea how to isolate PLSQL objects calls from SQL statement in following views?
v$sql,
v$sqlarea,
v$sqltext
For e.g. I ran following query but it would also include SELECT statements. Whereas I only need PLSQL Calls.
select * from v$sql where upper(sql_text) like 'BEGIN%.%'
Is there any better way?
Thank you in advance for reading this post.
RA select statement can include a pl/sql function call so you cannot exclude selects and search only the begin keyword.
You could join with DBA_OBJECTS, but is not very precise:
select *
from v$sql, dba_objects
where upper(sql_text) like '%'||object_name||'%'
and object_type in ('PACKAGE','PROCEDURE','FUNCTION');Max
http://oracleitalia.wordpress.com -
Relations between Views v$sqlarea,v$sqltext
Hi
What relations between the views v$sqlarea,v$sqltext , v$session
tia
using oracle 9.2.02Hello,
You'll find below a few links about these dynamics views.
v$sqlarea:
http://download.oracle.com/docs/cd/B10501_01/server.920/a96536/ch3204.htm#1126299
v$sqltext:
http://download.oracle.com/docs/cd/B10501_01/server.920/a96536/ch3205.htm#1126509
v$session:
http://download.oracle.com/docs/cd/B10501_01/server.920/a96536/ch3171.htm#1122127
You can join v$sqlarea and v$sqltext with the columns ADDRESS and HASH_VALUE.
You can also use the columns SQL_ADDRESS and SQL_HASH_VALUE to join with v$session.
Hope this help.
Best regards,
Jean-Valentin -
V$SQL V$SQLAREA V$SQLTEXT
hi,
Can any one please confirm
Oracle DOC says that
V$SQL contains the details regarding the SQL statements that are already executed and for long running queries details are updated every five seconds -------------> this means that this view contains only past executed sql statements
V$SQLAREA contains the details regarding the SQL statements that are ready to be executed -------------> this means that these statements will execute
V$SQLTEXT contains the details regarding the SQL statements that are currently being executed right?
can any one please confirm.
thanks855370 wrote:
hi,
Can any one please confirm
Oracle DOC says that
V$SQL contains the details regarding the SQL statements that are already executed and for long running queries details are updated every five seconds -------------> this means that this view contains only past executed sql statements
V$SQLAREA contains the details regarding the SQL statements that are ready to be executed -------------> this means that these statements will execute
V$SQLTEXT contains the details regarding the SQL statements that are currently being executed right?
can any one please confirm.
thanksYou might take a close look at the Oracle documentation again:
http://download.oracle.com/docs/cd/E14072_01/server.112/e10820/dynviews_3042.htm
http://download.oracle.com/docs/cd/E11882_01/server.112/e17110/dynviews_3064.htm
http://download.oracle.com/docs/cd/E14072_01/server.112/e10820/dynviews_3067.htm
A SQL statement may appear in all three views even if it was never executed (it just needs to be parsed).
Notice that CHILD_NUMBER and CHILD_ADDRESS appear in V$SQL but not V$SQLAREA - the description in the documentation explains why. The columns listed for V$SQLTEXT provide a clue what that view shows.
(Note that my answer is intentionally slightly vague just in case this is a question found on an exam of some sort.)
Charles Hooper
Co-author of "Expert Oracle Practices: Oracle Database Administration from the Oak Table"
http://hoopercharles.wordpress.com/
IT Manager/Oracle DBA
K&M Machine-Fabricating, Inc. -
How to Get Current running Sqltext in 10g
I'm using 10g and i'm using following query to get current running sql.
SELECT A.SID,B.HASH_VALUE, OSUSER, USERNAME, SQL_TEXT
FROM V$SESSION A, V$SQLTEXT B
WHERE B.HASH_VALUE = A.SQL_HASH_VALUE
AND USERNAME LIKE upper('%UOBA%')
ORDER BY B.HASH_VALUE, B.PIECE;
This does work for all user-triggered sqls,procedures etc.
But when i submit a Oracle Job the above qurey doesn't give any output.So,could please anybody help me in this regard.
Thanks in Advance.I have found a way to retrieve some SQL statements for a session started by DBMS_JOB using v$open_cursor: however in my test, you can only retrieve some SQL statements in v$sql_area but not all of them: query takes some time to execute and some committed statements are not (or nor more) in v$open_cursor:
select s.sid, s.serial#, s.username, sq.sql_text
from v$open_cursor oc, v$sqlarea sq, v$session s
where s.username = 'TEST'
and oc.saddr = s.saddr
-- only for session started by DBMS_JOB
and s.sql_hash_value = 0
and oc.address = sq.address
and oc.hash_value = sq.hash_value;Message was edited by:
Pierre Forstmann -
Join V$SQLAREA and V$Session
hi all,
which column i need to use to join V$session and V$sqlarea?
My main aim is to find top 5 queries with most disk_reads and generate a report containing relevant information.
Thanksi use to check active queries like this from both tables
select
substr(sid || ',' || serial#,0,15) sid,
USERNAME,
PROGRAM,
MACHINE,
OSUSER,
LOGON_TIME,
TERMINAL,
sql_text Query
from
v$sqltext,
v$session
where
address=sql_address
and hash_value=sql_hash_value
and status='ACTIVE'
order by LOGON_TIME,sid,piece -
Possible to find session/user who ran SQL in v$SQLAREA ?
Using this:
select * from v$sqlarea where sql_text like '%2412982%' and sql_text like '%prms%' and module != 'sqlplusw.exe';
I am able to locate a particular instance of a piece of SQL being executed and stored in the library cache.
However, I would really like to know who run it but I never "catch them".
Is there a way?
1* select * from v$sqlarea where sql_text like '%2412982%' and sql_text like '%prms%' and module != 'sqlplusw.exe'
SQL> /
SQL_TEXT
SHARABLE_MEM PERSISTENT_MEM RUNTIME_MEM SORTS VERSION_COUNT LOADED_VERSIONS OPEN_VERSIONS USERS_OPENING FETCHES EXECUTIONS USERS_EXECUTING LOADS FIRST_LOAD_TIME INVALIDATIONS
PARSE_CALLS DISK_READS BUFFER_GETS ROWS_PROCESSED COMMAND_TYPE OPTIMIZER_MODE PARSING_USER_ID PARSING_SCHEMA_ID KEPT_VERSIONS ADDRESS HASH_VALUE
MODULE MODULE_HASH ACTION ACTION_HASH SERIALIZABLE_ABORTS CPU_TIME ELAPSED_TIME I
CHILD_LATCH
select it.company, it.product, p.description, it.transaction_code, ifsapp.km_util_api.conv_to_date_fmt(it.company,to_date(it.transaction_date,'YYYY-MM-DD')) order_date, it.reference, it.wareh
ouse_id warehouse, it.transaction_quantity, it.inventory_unit_of_measure, it.location_aisle, it.location_row, it.location_tier, it.lot_identifier, it.user_profile, it.reference_2, it.referenc
e_3 from ifsapp.prms_inventory_transaction it, ifsapp.prms_product p where it.company=p.company (+) and it.product=p.product (+) and it.company=upper('OKM') and ((it.lot_identifier like upp
er('%2412982%')) or ('' is not null and it.lot_identifier like upper('%%')) or ('' is not null and it.lot_identifier like upper('%%')) or ('' is not null and it.lot_identifier like upper('%%')) or
('' is not null and it.lot_identifier like upper('%%'))) and (('' is null or rtrim(it.product)=upper('')) or (rtrim(it.product)=upper('')) or (rtrim(it.product)=upper('')) or (rtrim(it.product)=
8328 3616 17240 1 1 0 1 1 1 1 0 1 2006-09-28/08:47:09 0
1 134719 134846 0 3 CHOOSE 166 166 0 07000004A8D88FB0 1040757058
Repetitive Distribution.exe 0 0 0 34410000 58880847 N
3I think the SQL listed is wrong, as it only display the SQL created by Oracle whenever the user login, which is:
SELECT DECODE('A','A','1','2') FROM DUAL
And all subsequent SQL issued by the user during the session is not listed.
I am also in the midst of trying of get the user issuing the SQL :-).....MANY THANKS AHEAD.... -
Oracle 8i: full sql text in v$sqlarea
I work with oracle 8i.
is there a v$... that shows the execution plan for a query.
in thev$sqlarea there isn't the full_sqltext column, and I need to know what oracle is doing now.
Message was edited by:
user596611v$sqltext_with_newlines will produce multiple rows per statement.
You'll need an inline view
select t.hash_value, t.sorts, t.executions, t.buffer_gets, t.disk_reads, tn.sql_text
from v$sqlarea t,
(select hash_value,sql_text
from v$sqltext_with_newlines
order by hash_value, piece) tn
where sn.hash_value = t.hash_value
Sybrand Bakker
Senior Oracle DBA -
I've found this page
[http://www.billmagee.co.uk/oracle/sqltune/080_identify.html]
in which is said:
BUFFER_GETS Cumulative total of memory blocks read for this statement
so if I want to see how many blocks a query read per execution I must do ((disk_reads+buffer_gets)/executions) as suggested from the query on the same page.
select sql_text,
executions,
to_char((((disk_reads+buffer_gets)/executions) * 8192)/1048576,
'9,999,999,990.00') as total_gets_per_exec_mb,
to_char((( disk_reads /executions) * 8192)/1048576,
'9,999,999,990.00') as disk_reads_per_exec_mb,
to_char((( buffer_gets /executions) * 8192)/1048576,
'9,999,999,990.00') as buffer_gets_per_exec_mb,
parsing_user_id
from v$sqlarea
where executions > 0
order by 6 descThis is correct?
Buffer gets refers only to the block found in the buffer cache (not loaded from disk) or to the total amount of db block on which the query works (indipendetly if they are found immediately in the buffer cache or must be read from disk) ?
Hope you can help me.
Thanks
Adriano AristarcoYes, the index is appearing on the dba_indexes table, however its state is 'UNUSABLE'.
It looks impdp takes its state from origin metadata, puts into destination, and even is not trying to rebuild it.
Of course, after running ALTER INDEX REBUILD its status was changed to VALID.
So, what's the point impdp tells about its state? It can be hundreds of unusable indexes, why it's not just rebuilding it? -
Statements in v$SQLAREA
I see some sqls in v$sqlarea. But when I query v$session from the hash_Value of v$sqlarea, nothing comes up. Any particular reason why that would be so?
Thank you.
ROkay :) here you go
[1]SELECT * from v$version
BANNER
Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
PL/SQL Release 9.2.0.6.0 - Production
CORE 9.2.0.6.0 Production
TNS for HPUX: Version 9.2.0.6.0 - Production
NLSRTL Version 9.2.0.6.0 - Production
[2] Here is from v$SQLarea
SELECT *
FROM (SELECT Substr(a.sql_text,1,20) sql_text,
Trunc(a.disk_reads/Decode(a.executions,0,1,a.executions)) reads_per_execution,
a.buffer_gets,
a.disk_reads,
a.executions,
a.sorts,
a.address,hash_value,is_obsolete
FROM v$sqlarea a where a.sql_text like 'SELECT%'
order BY 2 DESC)
WHERE rownum <= 10
Results
SQL_TEXT READS_PER_EXECUTION SORTS ADDRESS HASH_VALUE
SELECT /*+ ORDERED U 174265 11 C00000022FFEE2E8 2024820696
SELECT /*+ 168019 3 C00000021BE3E7B0 3675638738
SELECT /*+ 166238 2 C0000002224D1628 4130578616
SELECT /*+ ORDERED U 165886 C000000245E5ADA0 1735771920
[3] Now query v$session with one of the value from #2
Select * from v$session where hash_value = 2024820696
No rows returned
Hope this helps
Thanks,
R -
Urgent:How to get the Sqltext for Oracle Sumbitted Jobs in 10g
Dear All,
Could you help me out in sorting the below problem.
I use to get the current running sql's with following below query in 9i.
SELECT A.SID,B.HASH_VALUE, OSUSER, USERNAME, SQL_TEXT
FROM V$SESSION A, V$SQLTEXT B
WHERE B.HASH_VALUE = A.SQL_HASH_VALUE
AND USERNAME LIKE upper('%SCHEMA%')
ORDER BY B.HASH_VALUE, B.PIECE;
This is will work in 10g also for user-triggered sqls,stored procedures etc.
But when oracle submits job i'm not able find which qurery is running.
Seems For oracle jobs in 10g for V$session contain column SQL_HASH_VALUE as Zero and hence i'm not able find the any sql's running.
Could you please any of you help me out how to get the Sqltext for Orcle submited Jobs in 10g.
Please revert asap as this is very urgent for me.
Thanks in Advance
Anil.Have you tried to query WF_ITEMS? -- http://etrm.oracle.com/pls/et1211d9/etrm_pnav.show_object?c_name=WF_ITEMS&c_owner=APPLSYS&c_type=TABLE
bde_wf_item.sql - Runtime Data of a Single Workflow Item [ID 187071.1]
Thanks,
Hussein -
Clarification in V$SQL and V$sqlarea
Hi Gurus, I have a clarification in V$SQL and V$sqlarea. Is it possible to get the entire set of SQL commands that are executed or run for particular session irrespective of the number of commands that are executed during the session. And can this result be got in a text file.
thanks in advance.Hello,
with execute dbms_system.set_sql_trace_in_session(session_id, serial_id, {True | False}) you can activate SQL tracing for a specific session. SQL Trace will generate a trace file in udump. With TKPROF you can format the output.
If you want to trace your session: ALTER SESSION SET SQL_TRACE = TRUE
regards,
juergen_klinsmann -
SQL_FULLTEXT Column of v$sqlarea
All,
What do I need to do so that the full text stored in sql_fulltext column of v$sqlarea is displayed.
At the moment, when I run the following sql:
select SQL_FULLTEXT from v$sqlarea
where sql_id='0n6x4f5kaaymb';
I get the output below:
SQL_FULLTEXT
SELECT INSTALLED_APP_ID, ORIGINATED_DATE, APPLICATION_ID, RECEIVED_DATE, EFFECTI
Thanks in advance
BaffySQL> select SQL_FULLTEXT from v$sqlarea
2 where sql_id='2j0qhrtccbz4u'
3 /
SQL_FULLTEXT
SELECT GA.VALUE FROM SYS.SCHEDULER$_GLOBAL_ATTRIBUTE GA, OBJ$ GO WHERE GA.OBJ# =
SQL> set long 999999999
SQL> select SQL_FULLTEXT from v$sqlarea
2 where sql_id='2j0qhrtccbz4u'
3 /
SQL_FULLTEXT
SELECT GA.VALUE FROM SYS.SCHEDULER$_GLOBAL_ATTRIBUTE GA, OBJ$ GO WHERE GA.OBJ# =
GO.OBJ# AND GO.NAME = 'LOG_HISTORY' -
V$sqlarea : 34769 rows
Hi expert,
I don't know if this is a problem. But how is possible that the v$sqlarea has 34179 records?
SQL> set timing on
SQL> select count(0) from v$sqlarea;
COUNT(0)
34769
Elapsed: 00:01:20.61i'm finding on oracle documentation and
"V$SQLAREA lists statistics on shared SQL area and contains one row per SQL string. It provides statistics on SQL statements that are in memory, parsed, and ready for execution."
http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/dynviews_2129.htm
then there are 34000 sql statment in memory?
where I can find some documentation on this view?
many thanks, as usual.
Cheers,
LainDepending on the nature of your application, the size of your SGA, and how well you or your developers use bind variables, the number of statements is perfectly fine or really horrible. Like so many things in Oracle, it depends.
One of our databases has several hundred concurrent users, but they are all using a single application that uses bind variables everywhere and has a fairly limited range of funtionality. It has about 10,000 rows in v$sqlarea. Another database supports a dozen or so concurrent users using many related but different applications most of which have never heard of a bind variable. It has about 60,000 rows, most of them being multiple copies of various sql statements differing only by the literal strings used as predicates.
John
Maybe you are looking for
-
Hp pavilion elite e9120y pc computer will not boot up. memory could not read
HP Pavilion Elite e9120y PC Vista Computer wil not boot two error messages 1. instruction at 0x74d605ef referenced memory at 0x00000114. The memory could not be read 2. Error 0x40011002000001012 if this issues continues. Please contact HP Support
-
Java mapping of application triggered an exception
Hi, We have ascenario where a vendor will be sending us a cXML file which has the second line as <!DOCTYPE cXML SYSTEM "http://xml.cxml.org/schemas/cXML/1.2.009/InvoiceDetail.dtd">. If I open it in XMLSpy, it is saying the file as invalid. XI is unab
-
How do I open movies made with older versions of iMovie?
I have newer iMac with iMovie 10.0.02 and would like to open movies created with an older version of iMovie. I was informed by the people at the Apple Store this could be done. Does anyone know how? In the end I would like to create high def copie
-
JBO-25005: Object name 1 for type Variable is invalid
Facing the error as below when clicking on messagedownload field on an OAF search page. below are the properties set ID : Attachment Item Style : messageDownload file MiIME type : text/HTML Data Type : BLOB ViewInstance : SerchReqVO1 ViewAttribute :
-
Evaluation Path for Position to Position Reporting Structure
Hello Everyone, We currently have a position to position reporting structure in place. WIth this being said, not every supervisor in our organization is the chief of a team. I am trying to create an evaluation path that will look at a position, the