Help! how to check the SQL run in Oracle?

Hi all,
I have a problem. the developer said the SQL written in Java code are not the one executed in Oracle DB. that mean the query is some how manipulated by some PL/SQL so the final query run in Oracle is different. So can someone teach me how to check the actual SQL run in Oracle?
Thanks a lot.
Regards,
Jason

Hi Michel Thanks. But it looks like the query stored in v$sqlarea is not the final executable SQL. for example, the code in application is "select column_A from default_table where column_A = ?" and this ? will be given some value in run time. the query stored in v$sqlarea will be like "select column_A from default_table where column_A = :1"... what is this :1?
Also if some PL/SQL procedure appends some condition to the SQL, is it possible to view the full query from database side?
ok, let me try trace and tkprof first.

Similar Messages

  • How to check the SQL error message to address the application issue

    Dears,
    The application runs SQLs against Oracle via oracle client(actually the app is IBM Cognos which shows report and the data is from oracle database). So, for a report which fails to run, I want to check the sql and the error message for this failed sql statement. Where is the message stored, client or server and How to get it?
    I know there is a view v$log used to check the sqls ran in database but here I mean the failed sqls....
    Thanks,
    Ricky Ru

    969543 wrote:
    The application only presents the application error message.. And it is not helpful for me to get the root cause..The application uses the Oracle Call Interface to communicate with the database server. OCI calls return a result code to the client. The client is expected to call OCIErrorGet() to get the full error text.
    If the client does not do this, or obfuscate the server error, or suppress the server error? Crappy client. The lack of the client to play its role as client, correctly within the documented client-server architecture, is solely the client's problem. Not the server.
    For DB2, I could use db2diag to check the log. why oracle can not do this? any thoughts?Because Oracle is not stupid? Why on sweet mother earth waste server resources to track client application errors, on behalf of clients? How does this make ANY sense!?
    Oracle server's handles 1000's of SQL executions per second. Just where is it to find sufficient space to log application errors (not database system errors) at that rate? How do you justify that overhead? Using the argument that the application is poorly designed or written? Come on!

  • Help--how to check the exact time?

    Pls help me:
    How to check the accurate down-time when the Sun machine (with solaris 8 sparc) abnomally shutdown (eg. power failure)?
    or
    Is there any way to detect the exact time when I shutdown the Sun machine ?
    thanks.

    check /var/adm/messages ; uptime ; last ..
    there are quite a few method u can use

  • [Help] How to check the object locks held by a specific thread?

    As the title I want to check locks held by a specific thread. How can I do this? In Java lock is acquired and release automatically by stating synchronized keyword. I have no idea on how to check the lock status and who owns whick lock.
    Regards,
    Skeeter

    Look for the method:
        public static native boolean holdsLock(java.lang.Object);Its in the java.lang.Thread class. It will check the lock status for an object for the calling thread.

  • How to check the load balancing in Oracle 11gR2 2 node RAC

    Dear All,
    Can any one please assist me how to check whether the incoming connections are evenly distributing across the nodes..?
    We have two nodes, when we check the sessions counts in both nodes, Most of the time we could see node -1 has more no of sessions than node-2..? So just wanted to know whether load balancing is happening or not ...? If not how to enable it and distribute the incoming connections evenly..?
    Oracle 11gR2 / RHEL5

    SQL> select inst_id,count(*) from gv$session where username is not null group by inst_id;
    INST_ID COUNT(*)
    1 43
    2 40
    Not sure how to check the users are connecting through scan or not ..? But below are scan setttings...
    SQL> !srvctl config scan_listener
    SCAN Listener LISTENER_SCAN1 exists. Port: TCP:1521
    SCAN Listener LISTENER_SCAN2 exists. Port: TCP:1521
    SCAN Listener LISTENER_SCAN3 exists. Port: TCP:1521
    SQL> !srvctl status scan_listener
    SCAN Listener LISTENER_SCAN1 is enabled
    SCAN listener LISTENER_SCAN1 is running on node za-rac-prd-02
    SCAN Listener LISTENER_SCAN2 is enabled
    SCAN listener LISTENER_SCAN2 is running on node za-rac-prd-01
    SCAN Listener LISTENER_SCAN3 is enabled
    SCAN listener LISTENER_SCAN3 is running on node za-rac-prd-01
    SQL> !srvctl config scan
    SCAN name: rac_prd.abc.local, Network: 1/10.100.130.0/255.255.255.192/eth6.64
    SCAN VIP name: scan1, IP: /rac_prd.abc.local/10.100.130.55
    SCAN VIP name: scan2, IP: /rac_prd.abc.local/10.100.130.54
    SCAN VIP name: scan3, IP: /rac_prd.abc.local/10.100.130.53
    SQL>

  • Help, How to view the error log of oracle Job

    Hi all,
    I created a job in my database, which clears the archivelog. After the job is executed, it occurs error.Such as :
    RMAN清理归档日志 1 问题 2010-3-19 下午03时11分00秒 GMT+08:00 PTDB 数据库实例 SYSTEM RMAN 脚本
    How to view the error log of oracle Job?
    Thank you.
    Eric Zhou

    Hello,
    Besides some views (with the scheduler) that you can get on the link below:
    http://download-west.oracle.com/docs/cd/B28359_01/server.111/b28310/scheduse002.htm#CHDGIDFD
    You may use the LOG parameter with RMAN so as to generate a logfile on the server.
    Also from EM DBConsole (starting with 10g) you may have the RMAN Backup Report.
    Hope this help.
    Best regards,
    Jean-Valentin

  • How to see the SQL running in back ground when we genarate a report.

    Hi All,
    I am new to Oracle Reports Builder toll and I would like to see the SQL query/script running in back ground when we run any perticular report using Reports Builder 10g.
    Please help me with this query, Thank You Very much for your help in Adv.
    Thanks,

    Hi,
    well the only option you can try is enabling trace from Builder (Program --> Tracing --> ALL) and then from the OS keep checking the trace file being created when the report is running. Something like the following will be recorded.
    example
    10:14:18 APP .. ( Repeating Frame R_G_EMPNO
    10:14:18 APP ... ( Group G_EMPNO Local Break: 0 Global Break: 0
    10:14:18 APP .... ( Query Q_1
    10:14:18 SQL EXECUTE QUERY : select * from emp where deptno=:x
    Bind Variable Value
    X 10
    10:14:18 APP .... ) Query Q_1
    10:14:18 APP ... ) Group G_EMPNO
    10:14:18 APP ... ( Text Field F_DEPTNO
    Hope this helps
    Roberto

  • Pls help   how to check the condition in java server faces.....???

    Hi All
    I have strucked with code pls help....
    How can i check the codition in java server faces.....?
    like in my Application when user provides the in put like some state name in the next page i have to display some url for that state .......if he provide some other state name it will be different url .....pls help me how can i do that,,,,,,???
    thanks in advance..

    There are certainly ways to do that. E.g. using the rendered attribute, using conditional statements in EL, using a specialized getter for that (lazily loaded if necessary), etcetera. But your functional requirement is unclear, so I can't go in detail with that.
    In the future, please try to write normal English sentences. Don't write like SMS talk and save the periods and commas. The more effort you put in your question, the more chance you will be taken for serious and the more effort others will post in their answers.
    Also, in the future, JSF related questions should be posted in the JSF forum.
    Edited by: BalusC on 12-aug-2008 7:47

  • How to check the sql:query is return null value

    I have use :
    <sql:query var="sql1" dataSource="${db}">
    select col_name from table_name
    where a=<c:out value="${row.test1}"/>
    and b='<c:out value="${row.test2}"/>'
    </sql:query>
    So, how can I check this statement return null value which is no record within this table?

    The Result should never be null but can be empty. You can check if the Result is empty using an if tag and checking the rowCount property:
        <sql:query var="books"
          sql="select * from PUBLIC.books where id = ?" >
          <sql:param value="${bookId}" />
        </sql:query>
         <c:if test="${books.rowCount > 0}">
         </c:if>http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSTL7.html#wp84217
    Look for query Tag Result Interface

  • How to check the date of an Oracle session

    hello
    How to check how long a session was opened?
    thx

    set lines 100 pages 999
    col ID          format a15
    col osuser     format a15
    col login_time     format a14
    select      username
    ,     osuser
    ,     sid || ',' || serial# "ID"
    ,     status
    ,     to_char(logon_time, 'hh24:mi dd/mm/yy') login_time
    ,     last_call_et
    from     v$session
    where     username is not null
    order     by login_time
    Regards,
    Andy Barry

  • How to check the Oracle Release?

    Hi,
    How to check the release version in Oracle AS ?
    And
    How to find what oracle AS release has happened in year (example 2005)?
    Best Regards

    There are a couple of ways I use to find the version:
    1. Open the Oracle Universal Installer on the machine where the OAS is installed, click on Installed Products. That should display the product and the version number.
    2. Set the oracle environment variables, then run the command below
    +$ORACLE_HOME/jdk/jre/bin/java -jar $ORACLE_HOME/j2ee/home/oc4j.jar -version+
    This should display the version of the OC4J which generally is the version of the OAS (unless you have applied any one-off patches)
    Have no idea about the second part of your question. Sorry.
    - Steve

  • How to get the SQL Signon that Agent Jobs "Run As" or "Executed as User"

    How to get the SQL Signon that Agent Jobs "Run As" or "Executed as User"?
    I have an install SQL scripts that creates a Linked Server. I want to put some security on the Linked Server and only grant the Agent Job Signon (the "Run As" or "Executed as User") access to the linked server. I need to retrieve the
    Agent Job Signon (something like "NT SERVICE\SQLAgent$FIDEV360BI02").
    I could query certain jobs and SUBSTRING the Message column - using some form of the query below, which would return "Executed as user: NT SERVICE\SQLAgent$SSDEVBI02. The step succeeded." But that is pretty imprecise.
    use msdb
    SELECT [JobName] = JOB.name,
    [Step] = HIST.step_id,
    [StepName] = HIST.step_name,
    [Message] = HIST.message,
    [Status] = CASE WHEN HIST.run_status = 0 THEN 'Failed'
    WHEN HIST.run_status = 1 THEN 'Succeeded'
    WHEN HIST.run_status = 2 THEN 'Retry'
    WHEN HIST.run_status = 3 THEN 'Canceled'
    END,
    [RunDate] = HIST.run_date,
    [RunTime] = HIST.run_time,
    [Duration] = HIST.run_duration,
    [Retries] = HIST.retries_attempted
    FROM sysjobs JOB
    INNER JOIN sysjobhistory HIST ON HIST.job_id = JOB.job_id
    -- CHANGE THIS
    -- WHERE JOB.name like '%GroupMaster%' or Job.name like '%etlv%'
    ORDER BY HIST.run_date, HIST.run_time

    by default all sql jobs are executed as sql server agent account, unless otherwise a proxy is setup.
    you can get the proxy information as Olaf mentioned, if the proxy_id is null for the step, it implies that the job step was executed as sql server service account and in such case it will be null
    so, if it is null, it ran as sql server agent account.
    so, one work around is get the sql server agent service account and if the proxy is null, that means it ran as sql server agent account, so, use isnull function. the disadvantage would be if the sql server agent account was switched, you might not get the
    accurate information as the new account will show up though the job really ran as old account, to get this information, you need to  get this from the logmessage column as you mentioned above.
     try this code...
    /*from sql 2008r2 sp1, you get the service accounts using tsql,otherwise you have to query the registry keys*/
    declare @sqlserveragentaccount varchar(2000)
    select @sqlserveragentaccount= service_account
    from sys.dm_server_services
    where servicename like '%sql%server%agent%'
    select message,isnull(name,@sqlserveragentaccount) as AccountName
    from sysjobhistory a inner join sysjobsteps b
    on a.step_id=b.step_id and a.job_id=b.job_id
    left outer join sysproxies c on c.proxy_id=b.proxy_id
    Hope it Helps!!

  • How to find the SQL Server Instances running across the given activer directory domain?

    How to find the SQL Server Instances running across the given activer directory domain?
    I have though of OSQL -L , Microsoft Assessment and Planning ( MAP ) tool and SQLPing3 (SQLSecurity) might help me.
    I would appreciate if there any other way of finding the SQL Servers / Instances running across the given active directory domain.
    Sivaprasad S
    http://sivasql.blogspot.com
    Please click the Mark as Answer button if a post solves your problem!

    Dear ,
    Very simple u find all instances through the customized sp which is get all details about inventory. Like i put the sp bellow. This is without any tool. 
    USE [master]
    GO
    /****** Object:  StoredProcedure [dbo].[DBStatus]    Script Date: 08-01-2015 19:46:11 By Damodar Patle Sr. DBA Mumbai India ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ALTER PROCEDURE [dbo].[DBStatus] 
    AS
    SELECT 
    SERVERPROPERTY('servername') AS ServerName,
    ConnectionProperty('local_net_address') AS 'local_net_address',
    ConnectionProperty('local_tcp_port') AS 'local_tcp_port',
    CONVERT(VARCHAR(25), @@VERSION) as  VERSIONSQL,
    SERVERPROPERTY('ErrorLogFileName') AS ErrorLogFilePath,
    database_id,
    CONVERT(VARCHAR(25), DB.name) AS DBName,
    CONVERT(VARCHAR(10), DATABASEPROPERTYEX(name, 'status')) AS [Status],
    CONVERT(VARCHAR(10), DATABASEPROPERTYEX(name, 'Recovery')) AS [Recovery_Model],
    create_date as DBCreate_Date, --physical_device_name,
     (SELECT COUNT(1) FROM sys.master_files WHERE DB_NAME(database_id) = DB.name AND type_desc = 'rows') AS DataFiles,
     (SELECT SUM((size*8)/1024) FROM sys.master_files WHERE DB_NAME(database_id) = DB.name AND type_desc = 'rows') AS [Data MB],
     (SELECT COUNT(1) FROM sys.master_files WHERE DB_NAME(database_id) = DB.name AND type_desc = 'log') AS LogFiles,
     (SELECT SUM((size*8)/1024) FROM sys.master_files WHERE DB_NAME(database_id) = DB.name AND type_desc = 'log') AS [Log MB],
     (SELECT physical_name FROM sys.master_files WHERE DB_NAME(database_id) = DB.name AND type_desc = 'rows') AS MDF_File_Location,
     (SELECT physical_name FROM sys.master_files WHERE DB_NAME(database_id) = DB.name AND type_desc = 'log') AS  LDF_File_Location,
       user_access_desc
       FROM sys.databases DB
       ORDER BY dbName, [Log MB] DESC, NAME

  • How to check the records that were inserted in a day?Please Help!

    HI All,
    How to check the records that were insterted in a day in a standard SAP table?
    For example : I want retrieve the records that were added in a day in WLK1 table.
    How do i do this?
    Urgent!! Please help!
    Thanks in advance!
    Sandeep Shenoy

    HI
        Changes to data within a table can be automatically logged. Such automatic logging of changes is called automatic table history. To turn on logging, tickmark the Log Data Changes check box on the Technical Settings screen
    IF THIS IS ALREADY DONE FOR A PARTICULAR TABLE, YOU CAN GET THE RECORD OF CHANGES THAT YOU MADE FOR THAT PARTICULAR TABLE AS EXPLAINED UNDER
    <a href="http://64.233.179.104/search?q=cache:pOdVy55jfAIJ:cma.zdnet.com/book/abap/ch06/ch06.htmHISTORYOFUPDATESINADAYINABAP&hl=en&gl=in&ct=clnk&cd=1">Automatic Table History and Change Documents</a>
    IF ITS HELPFUL PLEASE REWARD POINTS
    REGARDS
    ANOOP

  • HELP !!! How to check the size of an object in Photoshop ?

    Hello,
    I'm using Photoshop CS 3 to design a website. I used several shapes such as rectangle, line or ellipse of different size. Probably it is a stupid question but I don't know how to check the size of an existing rectangle. I tried free transform tool that selects my rectangle but doesn't show its size. Then I made a selection with rectangular marquee tool but I see nowhere the size of the selected area.
    If you know the name of such a tool please help me !
    Have a nice day !

    Web images are all pixels. View at 100% at pixel view. that is your exact size

Maybe you are looking for