高分求助:根据sql语句查询scn

zhanghai921 2011-09-01 01:59:10
我找到当时执行的sql语句,想看下提交时的scn,各位老大们,有知道咋查的吗?
...全文
135 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
yjytiantang 2011-09-02
  • 打赏
  • 举报
回复
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;
gnahshining 2011-09-01
  • 打赏
  • 举报
回复
select * from t1 as of scn :scn;
wffffc 2011-09-01
  • 打赏
  • 举报
回复
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

3,491

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 高级技术相关讨论专区
社区管理员
  • 高级技术社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧