Shaakunthala
Shaakunthala

Reputation: 207

How to find the timestamp of when last commit statement was issued?

I looked up this on the Internet and most discussions were about finding the time of last change made. In my case, I want to find the timestamp of when a COMMIT statement was issued for the last, by any user (schema).

Is there any particular way to query this?

Upvotes: 1

Views: 6340

Answers (1)

Mark J. Bobak
Mark J. Bobak

Reputation: 14395

If all you need to know, is whether the current SQL*Plus session has an open transaction, you can do that by selecting TADDR from V$SESSION.

Example:

SQL> create table testme(a number);

Table created.

SQL> select taddr from v$session where sid=(select sid from v$mystat where rownum=1);

TADDR
----------------


SQL> insert into testme values(1);

1 row created.

SQL> select taddr from v$session where sid=(select sid from v$mystat where rownum=1);

TADDR
----------------
0000007F50F86420

SQL> commit;

Commit complete.

SQL> select taddr from v$session where sid=(select sid from v$mystat where rownum=1);

TADDR
----------------


SQL> 

IF TADDR is null, then there is no current transaction.

Hope that helps.

Upvotes: 1

Related Questions