Monday, September 28, 2015

How to see the DB Queries executed in Database

It is very common requirement to see what are all the queries are being executed in database,


Step 1 - Execute the below query, In below example, I want to see what are all the queries are being executed on EMPLOYEE table.

select to_char(LAST_ACTIVE_TIME,'dd-mon-yyyy hh24:mi:ss'),last_load_time,sql_id,sql_text
    from v$sql where upper(sql_text) like '%EMPLOYEE%' order by 1 desc;

Step 2 - Look for most recent 'Last_Load_Time' time in the search results

Step 3 - Get the corresponding result row associated 'sql_id' value from above step and supply to below query

                select sql_fulltext from v$sql where sql_id='&name';

Step4 - Supply the sql_id to below query to see the bind variables

                  select name, value_string from v$sql_bind_capture where sql_id = '&sql_id'

4 comments:

  1. There is a great blog about Oracle ADF and thanks for sharing about Oracle ADF information. We are providing online training classes OracleADFonlinetraining

    ReplyDelete
  2. For Database Developer jobs in USA. Please visit https://www.rootjobs.com . Rootjobs offering free job posting and resume search service

    ReplyDelete
  3. Thanks for sharing the useful information about the queries and good points were stated in the blog and for the further information about the oracle visit
    Oracle Fusion Financials Training

    ReplyDelete
  4. Water Hack Burns 2lb of Fat OVERNIGHT

    More than 160 thousand men and women are trying a simple and secret "liquid hack" to lose 2lbs each and every night while they sleep.

    It's easy and it works on everybody.

    This is how you can do it yourself:

    1) Get a glass and fill it up with water half full

    2) Proceed to follow this strange HACK

    and become 2lbs skinnier as soon as tomorrow!

    ReplyDelete