Oracle10g中current_scn的正确计算运行

数据库 Oracle
以下的文章主要描述的是Oracle10g中的current_scn的正确的计算运行的详细介绍。以下就是文章的详细内容介绍,望大家借鉴。

以下的文章主要向你解答Oracle10g中的current_scn是如何正确的计算运行,我们大家都知道Oracle10g在v$database 视图里引入了current_scn,其实这个SCN是来自底层表,代表当前的SCN。

在Oracle9i中我们可以通过dbms_flashback.get_system_change_number来获得系统的SCN。

但是注意current_scn还是有所不同的,我们看一下一个查询:

复制代码

  1. oracle@danaly ~]$ sqlplus '/ as sysdba'   
  2. SQL*Plus: Release 10.2.0.1.0 - Production on Thu Jun 21 10:15:08 2007  
  3. Copyright (c) 1982, 2005, Oracle. All rights reserved.  
  4. Connected to:  
  5. Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production  
  6. With the Partitioning, Oracle Label Security, OLAP and Data Mining Scoring Engine options  
  7. SQL> @scn  
  8. SQL> col current_scn for 99999999999999999  
  9. SQL> select current_scn from v$database;  
  10. CURRENT_SCN  
  11. 8910961765228  
  12. SQL> select dbms_flashback.get_system_change_number current_scn from dual;  
  13. CURRENT_SCN  
  14. 8910961765228  
  15. SQL> select dbms_flashback.get_system_change_number current_scn from dual;  
  16. CURRENT_SCN  
  17. 8910961765228  
  18. SQL> select current_scn from v$database;  
  19. CURRENT_SCN  
  20. 8910961765229  
  21. SQL> select dbms_flashback.get_system_change_number current_scn from dual;  
  22. CURRENT_SCN  
  23. 8910961765229  
  24. SQL> select dbms_flashback.get_system_change_number current_scn from dual;  
  25. CURRENT_SCN  
  26. 8910961765229  
  27. SQL> select current_scn from v$database;  
  28. CURRENT_SCN  
  29. 8910961765230  

 

我们看到current_scn的查询会直接导致SCN的增进,而其他方式并不会。也就是说在这里的current_scn就像是一个Sequence一样,查询会导致增进。这也很好理解,v$database只能通过增进当前的SCN才能保证获得的SCN是Current的。可是如果不查询呢?这个值肯定是不会增长的。以上的相关内容就是对Oracle10g的current_scn计算的介绍,望你能有所收获。

【编辑推荐】

  1. Oracle修改相关字段的几种常用方法
  2. Oracle字符集中的一些问题总结
  3. Oracle数据库提升效率,用3PAR
  4. Oracle加速计划与推出的新门户网站简介
  5. Oracle数据库的统计数据与其生成的具体方式
责任编辑:佚名 来源: 博客园
相关推荐

2010-05-06 10:41:24

Oracle10g

2010-04-26 10:32:55

Oracle 10g

2010-03-31 10:22:25

Oracle10g优化

2011-05-20 09:39:13

Oracle10g新特性

2011-05-13 14:47:05

oracle10g乱码问题

2011-05-20 13:50:30

oracle10g乱码

2010-03-31 09:56:46

Oracle10g

2010-04-19 15:04:28

升级Oracle10g

2010-03-31 09:38:26

Oracle10g x

2010-03-31 08:51:35

Oracle 10g

2010-03-31 18:01:06

Oracle10g安装

2011-08-01 12:50:18

LinuxOracle10GOracle11G

2010-04-20 13:37:04

2010-05-07 09:35:25

Oracle 10g

2010-04-28 10:45:24

Oracle10g

2010-05-05 15:58:34

Oracle 10g

2010-02-07 13:45:29

Ubuntu orac

2010-03-31 09:16:28

Oracle10g安装

2010-04-13 14:53:01

Oracle9i和Or

2010-05-06 11:15:49

Oracle10g
点赞
收藏

51CTO技术栈公众号