11:43:20 SYSTEM@sandbox> create table test as select * from dual;
Table created.
Elapsed: 00:00:00.04
11:43:26 SYSTEM@sandbox> set transaction read write name 'test';
Transaction set.
Elapsed: 00:00:00.00
11:43:35 SYSTEM@sandbox> insert into test values (1);
1 row created.
Elapsed: 00:00:00.00
11:43:42 SYSTEM@sandbox> select name, start_time from v$transaction;
NAME START_TIME
---------- --------------------
test 10/12/12 11:43:34
Elapsed: 00:00:00.01
11:43:47 SYSTEM@sandbox> commit;
Commit complete.
Elapsed: 00:00:00.01
11:44:00 SYSTEM@sandbox> select name, start_time from v$transaction;
no rows selected
Elapsed: 00:00:00.00
11:44:02 SYSTEM@sandbox>
或者,对于每个会话:
11:59:15 SYSTEM@Sandbox> set transaction name 'test_by_addr';
Transaction set.
Elapsed: 00:00:00.00
11:59:18 SYSTEM@Sandbox> insert into test values(1);
1 row created.
Elapsed: 00:00:00.00
11:59:21 SYSTEM@Sandbox> get xact
1 select s.sid
2 ,s.serial#
3 ,s.username
4 ,s.status
5 ,t.name
6 ,t.start_time
7* from v$transaction t join v$session s on t.addr = s.taddr
11:59:27 SYSTEM@Sandbox> /
SID SERIAL# USERNAME STATUS NAME START_TIME
---------- ---------- ------------------------------ -------- ---------- --------------------
39 1015 SYSTEM ACTIVE test_by_ad 10/12/12 11:59:17
dr
Elapsed: 00:00:00.01
11:59:30 SYSTEM@Sandbox> select SYS_CONTEXT('USERENV','SID') from dual;
SYS_CONTEXT('USERENV','SID')
----------------------------
39
Elapsed: 00:00:00.01