Results 1 to 6 of 6
  1. #1
    Join Date
    May 2002
    Posts
    55

    Unanswered: snapshot for sql?

    what to know how can I get the current running SQL statement with the knowed information of application agentid.

    I consider us " get snapshot for application agentid xxx", but could not get SQL statement.

    Hansen

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Re: snapshot for sql?

    The SQL Statement is provided for dynamic SQL Statements only. Static SQL Statements are not included for performance reasons.

    Have a look at the Statement Type, Statement , Most Recent Operation etc and if they give an indication of Dynamic SQL then you will get the dynamic SQL Text in the snapshot.

    If you want to know the Static SQL running at the snashot time, use the Section Number, Appl Creator and Pakage name elements and query the system catalog :

    SELECT SEQNO, TEXT
    FROM SYSCAT.STATEMENTS
    WHERE PKGNAME = 'package_name' AND
    PKGSCHEMA = 'creator' AND
    SECTNO = section_number
    ORDER BY SEQNO

    This statement will cause lock contentions in the database. So be careful with using this statement.

    HTH

    Cheers

    Sathyaram



    Originally posted by guyang2000
    what to know how can I get the current running SQL statement with the knowed information of application agentid.

    I consider us " get snapshot for application agentid xxx", but could not get SQL statement.

    Hansen

  3. #3
    Join Date
    Apr 2002
    Location
    TX
    Posts
    13
    Hi Hansen,

    Execute this command and it gives you all.

    $ db2 get snapshot for all on database name


    It gives all the information about current running SQL's.Hope this may help you.

    Hari

  4. #4
    Join Date
    May 2002
    Posts
    55
    Thanks sathyaram_s and hari gosangi.

    I will try both way to find the SQL current running.
    Also there is $db2 get snapshot for dynamic sql on dbname
    can be used, but not current running I guess.

    cheers,

    Hansen

  5. #5
    Join Date
    Apr 2002
    Location
    TX
    Posts
    13
    Hi Hansen,

    You have to take Two Snapshots for getting the current SQL running.
    First take the Sansphot before running the SQL and Secondly you have to take a snapshot while the SQL ruuning( ie, time at which the SQL running). Then you can see or compare and will get the current SQL running.

    Hope this may help for your question.

    Thanks,

    Hari Gosangi.

  6. #6
    Join Date
    May 2002
    Posts
    55
    An other way, we can setup event monitor and capture the SQL statment during program or query running.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •