高分求助:根据sql语句查询scn
我找到当时执行的sql语句,想看下提交时的scn,各位老大们,有知道咋查的吗?
------解决方案--------------------
SQL> select count(*) from t;
COUNT(*)
----------
53753
SQL> select sql_text,LAST_ACTIVE_TIME from v$sql where sql_text like '%select count(*) from t%';
SQL_TEXT
-------------------------------------------------------------------------------
----------------------------------------------------------------
LAST_ACTIVE_TI
--------------
select sql_text,LAST_ACTIVE_TIME from v$sql where sql_text like '%select count(*) from t%'
01-9月 -11
select count(*) from t
01-9月 -11
SQL> select sql_text,to_char(LAST_ACTIVE_TIME,'yyyy-mm-dd hh24:mi:ss') from v$sql where sql_text like '%select count(*) from t%';
SQL_TEXT
-------------------------------------------------------------------------------
----------------------------------------------------------------
TO_CHAR(LAST_ACTIVE
-------------------
select sql_text,LAST_ACTIVE_TIME from v$sql where sql_text like '%select count(*) from t%'
2011-09-01 16:10:46
select count(*) from t
2011-09-01 16:09:58
select sql_text,to_char(LAST_ACTIVE_TIME,'yyyy-mm-dd hh24:mi:ss') from v$sql where sql_text like '%select count(*) from t%'
2011-09-01 16:11:31
SQL> select TIMESTAMP_TO_SCN(to_date('2011-09-01 16:11:31','yyyy-mm-dd hh24:mi:ss')) from dual;
TIMESTAMP_TO_SCN(TO_DATE('2011-09-0116:11:31','YYYY-MM-DDHH24:MI:SS'))
----------------------------------
1379145
------解决方案--------------------
select * from t1 as of scn :scn;
------解决方案--------------------
select * from test ;
select sql_text,LAST_ACTIVE_TIME from v$sql
where sql_text like '%select * from test%';
select timestamp_to_scn(to_date('2011/9/2 9:37:08','yyyy/mm/dd hh24:mi:ss')) scn from dual;