Need to know the date and time a particular sql command was fired through an interactive session

1480 pts.
Tags:
iSeries SQL
SQL
SQL commands
Is it possible to find the date and time a particular sql command was entered. Iam able to view the commands entered in an sql session but not able to find the date and time the commands where fired.
1

Answer Wiki

Thanks. We'll let you know when a new response is added.

I know you are asking about iSeries and DB2 database, but in Oracle you include the sysdate function in the SQL:

<pre>SELECT SYSDATE, <COLUMN…>, FROM <TABLE>;</pre>

Sure there is an equivelant function in DB2.

————————————–
If you’ve journalled the file and if the sql command changed the file then look to the file. I don’t know if the 400 keeps the date & time with SQL commands.
Phil

==================================================

As with almost all audit or log functions, if you haven’t turned it on, you can’t retrieve information from it. In this case, if you have the database monitor running, you can retrieve statements from it along with timestamps. Use STRDBMON to start the monitor. You can monitor only specific jobs or all jobs. For basic logging, you probably only need *SUMMARY records. Request *DETAIL when you want more finely grained data. You can start monitors for specific jobs even if an *ALL jobs monitor is already running.

Tom

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • carlosdl
    The Oracle's SYSDATE function returns the current date/time, so unless you can review the sql statements issued and their results, the sysdate function wouldn't help at all.
    84,580 pointsBadges:
    report
  • JohnsonMumbai
    The commands are run on i series. Also the files on which the SQL commands were run are not journaled.
    1,480 pointsBadges:
    report
  • Meandyou
    I do not think there is a way to determine this after the fact without looking at the DB2 logs. Perhaps a DB2 monitor would help? I know on z/OS that might be the answer. If you need to know this info, the you need to AUDIT the tables. and to answer the questions about DB2's equivalent of Oracle's SYSDATE, you are looking for CURRENT TIMESTAMP.
    5,220 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: