环境:LINUX_x86
这里需要注意地方为:
1.我的系统为32bit的小端系统.
2.大小端的SCN_WRAP和SCN_BASE是相反的.在大端中,kcsgscn_的前4字节为SCN_BASE,5-8字节为SCN_WRAP.
3.在32bit系统中寻址只能是4字节,而64位系统可以8字节.
该测试为32bit 小端系统,环境如下:
[root@ludatou ~]# file /sbin/init /sbin/init: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped [root@ludatou ~]# su - ora10g [ora10g@ludatou ~]$ sqlplus '/as sysdba' SQL*Plus: Release 10.2.0.4.0 - Production on Thu Jul 24 01:58:10 2014 Copyright (c) 1982, 2007, Oracle. All Rights Reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> startup mount ORACLE instance started. Total System Global Area 318767104 bytes Fixed Size 1267260 bytes Variable Size 100665796 bytes Database Buffers 213909504 bytes Redo Buffers 2924544 bytes Database mounted.
检查当前scn情况并以oradebug的方式推进scn:
--当前scn SQL> select to_char(checkpoint_change#,'XXXXXXXXXXXXXXXX') from v$database; TO_CHAR(CHECKPOIN ----------------- A03E2F SQL> oradebug setmypid Statement processed. --获取内存scn对应 SQL> oradebug dumpvar sga kcsgscn_ kcslf kcsgscn_ [20009228, 20009248) = 00000000 00000000 00000000 00000000 00000000 00000000 00000000 20009034 --因为32bit系统所以采用4字节寻址,更改scn_wrap SQL> oradebug poke 0x20009228 4 0x01 BEFORE: [20009228, 2000922C) = 00000000 AFTER: [20009228, 2000922C) = 00000001 --更改scn_base SQL> oradebug poke 0x2000922C 4 0x01 BEFORE: [2000922C, 20009230) = 00000000 AFTER: [2000922C, 20009230) = 00000001 SQL> oradebug dumpvar sga kcsgscn_ kcslf kcsgscn_ [20009228, 20009248) = 00000001 00000001 00000000 00000000 00000000 00000000 00000000 20009034 SQL> oradebug poke 0x2000922C 4 0xA03E2F BEFORE: [2000922C, 20009230) = 00000001 AFTER: [2000922C, 20009230) = 00A03E2F SQL> oradebug dumpvar sga kcsgscn_ kcslf kcsgscn_ [20009228, 20009248) = 00000001 00A03E2F 00000000 00000000 00000000 00000000 00000000 20009034 --更改完成后打开数据 SQL> alter database open; Database altered. --可以发现scn已经推进了wrap+1位 SQL> select to_char(current_scn,'XXXXXXXXXXXXXXXX') from v$database; TO_CHAR(CURRENT_S ----------------- 100A04185