Need to know the date and time a particular sql command was fired through an interactive session
380 pts.
0
Q:
Need to know the date and time a particular sql command was fired through an interactive session
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.
ASKED: Sep 7 2009  10:39 AM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
8025 pts.
0
A:
 RATE THIS ANSWER
-2
Click to Vote:
  •   0
  •  -2
  • AddThis Social Bookmark Button
I know you are asking about iSeries and DB2 database, but in Oracle you include the sysdate function in the SQL:

SELECT SYSDATE, <COLUMN...>, FROM <TABLE>;


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
Last Answered: Oct 11 2009  5:08 AM GMT by TomLiotta   8025 pts.
Latest Contributors: Philpl1jb   24610 pts., Elementj   45 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Carlosdl   29855 pts.  |   Sep 7 2009  10:00PM GMT

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.

 

JohnsonMumbai   380 pts.  |   Sep 8 2009  5:02AM GMT

The commands are run on i series. Also the files on which the SQL commands were run are not journaled.

 

Meandyou   1840 pts.  |   Sep 9 2009  3:06PM GMT

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.

 
0