实验1:
session1在scott下执行了一条select语句select * from DBA_objects;
已经赋予scott dba的权限
session2在sys用户下
SQL> select sid,username,SQL_ID,sql_hash_value from v$session where username<>'SYS' and username is not null;
SID USERNAME SQL_ID SQL_HASH_VALUE
---------- ------------------------------ ------------- --------------
159 SCOTT 6avfua5g1gkh2 1578617346
SQL> select sql_fulltext from v$sqlarea where sql_id='6avfua5g1gkh2';
SQL_FULLTEXT
--------------------------------------------------------------------------------
select * from dba_objects
session1的操作完成之后,session2再次查询,sql_id为null
select sid,username,SQL_ID,sql_hash_value from v$session where username<>'SYS' and username is not null;
SID USERNAME SQL_ID SQL_HASH_VALUE
---------- ------------------------------ ------------- --------------
159 SCOTT 0
实验2
session1在scott下执行一条update语句update d set deptno=60 where deptno=20;但没有commit.
session2在sys用户下
SQL> select sid,username,SQL_ID,sql_hash_value from v$session where username<>'SYS' and username is not null;
SID USERNAME SQL_ID SQL_HASH_VALUE
---------- ------------------------------ ------------- --------------
159 SCOTT 1cvcw5h23uqu1 71129921
SQL> select sql_fulltext from v$sqlarea where sql_id='1cvcw5h23uqu1';
SQL_FULLTEXT
--------------------------------------------------------------------------------
update d set deptno=60 where deptno=20
session1执行commit;
session2再次查询
SQL> select sid,username,SQL_ID,sql_hash_value from v$session where username<>'SYS' and username is not null;
SID USERNAME SQL_ID SQL_HASH_VALUE
---------- ------------------------------ ------------- --------------
159 SCOTT 1cvcw5h23uqu1 71129921
commit不是标志事务的结束吗,也说明这个事务已经完成了,但这时sql_id并不为null,这是为什么呢?
|
|