Home >Database >Mysql Tutorial >ORA_ROWSCN伪列的用途

ORA_ROWSCN伪列的用途

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-07 17:24:501203browse

对于每一行数据,ora_rowscn返回每一行最近被修改的大概时间.这对于判断一行数据大概是在什么时间被修改的还是有用的.因oracle是通

ora_rowscn

对于每一行数据,ora_rowscn返回每一行最近被修改的大概时间.这对于判断一行数据大概是在什么时间被修改的还是有用的.因Oracle是通过事务提交对行所在数据块来进行scn的跟踪的所以说它不精确.可以通过在创建表时使用行级别的依赖跟踪来获得一个更加精确的scn.create table ... norowdependencies|rowdependencies

在对视图进行查询时不能使用ora_rowscn.但对于视图的基表是可以使用ora_rowscn.

也能在update或delete语句中的where子句中使用ora_rowscn

ora_rowscn不能用于回闪查询,但是可以用回闪版本查询来代替ora_rowscn.

ora_rowscn也不能用于外部表

获取行被修改的大根的scn

SQL> select ora_rowscn,t.test_id from test_jy t;

ORA_ROWSCN              TEST_ID

---------- ---------------------

625591                    3

通过scn来获取修改行记录大概的时间

SQL> select scn_to_timestamp(ora_rowscn),t.test_id from test_jy t;

SCN_TO_TIMESTAMP(ORA_ROWSCN)                                                                  TEST_ID

-------------------------------------------------------------------------------- ---------------------

20-12月-12 06.23.22.000000000 下午                                                                  3

也可以通过时间来获得scn

SQL> select timestamp_to_scn(scn_to_timestamp(ora_rowscn)),t.test_id from test_jy t;

TIMESTAMP_TO_SCN(SCN_TO_TIMEST              TEST_ID

------------------------------ ---------------------

625590                    3

linux

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn