首页 » ORACLE » SCN fast increase by database link(scn增长因DB_LINK)

SCN fast increase by database link(scn增长因DB_LINK)

为了保证分布式查询的一致性,通过dblink查询时会同步SCN,有时会撞见ORA-600错误。

alert日志中伴随着warning Rejected the attempt to advance SCN over limit

host 1
#############
SQL> select current_scn from v$database;
CURRENT_SCN
———–
1.3003E+10

SQL> set numwidth 50
SQL> select current_scn from v$database;
CURRENT_SCN
————————————————–
13003322685

SQL> create user anbob identified by anbob;
User created.

SQL> grant connect,resource to anbob;
Grant succeeded.

SQL> select * from v$version;
BANNER
—————————————————————-
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 – 64bi
PL/SQL Release 10.2.0.1.0 – Production
CORE    10.2.0.1.0      Production
TNS for Linux: Version 10.2.0.1.0 – Production
NLSRTL Version 10.2.0.1.0 – Production

host2
###################
sys@NCME>select current_scn from v$database;
CURRENT_SCN
———–
1853188

sys@NCME>create database link dl_1913 connect to anbob identified by anbob using ’192.168.191.3:1521/devdb’;
Database link created.

sys@NCME>select sysdate from dual@dl_1913;
SYSDATE
——————-
2012-05-04 13:46:24

sys@NCME>select current_scn from v$database;
CURRENT_SCN
———–
1.3003E+10

sys@NCME>set numwidth 50
sys@NCME>select current_scn from v$database;

CURRENT_SCN
————————————————–
13003323708
sys@NCME>select 13003323708/1853188 from dual;

13003323708/1853188
——————-
7016.73209

查以检查当前数据库的scn是否健康执行scnhealthcheck.sql,参考mos ID 1393363.1

sys@NCME>@scnhealthcheck
————————————————————–
ScnHealthCheck
————————————————————–
Current Date: 2012/05/04 14:22:11
Current SCN:  13003325918
Version:      10.2.0.1.0
————————————————————–
Result: A – SCN Headroom is good
Apply the latest recommended patches
based on your maintenance schedule
AND set _external_scn_rejection_threshold_hours=24 after apply.
For further information review MOS document id 1393363.1

note:
通过dblink 查询以后host2 数据库scn增加了7016倍,为了实现分布式查询一致性,当查询sql时以,read 前的scn为准,在用dblink查询时会以较大的scn会标准进行同步,但是突然大比例的增加scn这种很可能因起bug。
AS OF SCN 的闪回查询语句指定的SCN是针对目标表所在数据库而言的, scn 是oracle 的ACID特性提供的内部时钟,只会向前走,只会再高并发时才会出现相同SCN的事务,scn 是从1988年1月1日起每秒增加16384,这也是oracle软限制,最大限制或硬性限制ORACLE支持281 trillion,足够很好的用上500年,500年后呢?借助月光宝盒?呵呵,如果超过了软限制,事务会挂起或ora-600错误。

Related Posts:

打赏

对不起,这篇文章暂时关闭评论。