http://blog.itpub.net/29154652/viewspace-774532/
使用oradebug增进scn,网上案例很多,这里自己测试了下,发布上来。
首先来看下命令: POKE To poke memory locations use ORADEBUG POKE address length value where address and value can be decimal or hexadecimal and length is in bytes For Example ORADEBUG POKE 0x20005F0C 4 0x46495845 ORADEBUG POKE 0x20005F10 4 0x44205349 ORADEBUG POKE 0x20005F14 2 0x5A45 WARNING Do not use the POKE command on a production system 查看数据库当前的SCN: oracle@GDB_01:~/run> sqlplus / as sysdba SQL*Plus: Release 11.2.0.2.0 Production on Thu Oct 17 12:19:54 2013 Copyright (c) 1982, 2010, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> select current_scn from v$database; CURRENT_SCN ----------- 2625512 SQL> select to_char(2625512,'xxxxxxx') from dual; TO_CHAR(2625512,'XXXXXXX') -------------------------------------------------------------------------------- 280fe8 使用oradebug查看kcsgscn_ SQL> oradebug setmypid Statement processed. SQL> oradebug dumpvar sga kcsgscn_ kcslf kcsgscn_ [060019360, 060019390) = 00280FFC 00000000 00000000 00000000 00089F7B 00000000 00000000 00000000 00000000 00000000 60019040 00000000 跟V$DATABASE.CURRENT_SCN相近。 此外,我们使用的Linux平台,属于Little Endian,所以其SCN base在前,SCN wrap在后,这点需要注意。 假设假设我们要修改成1G大小: SQL> select 1*1024*1024*1024 from dual; 1*1024*1024*1024 ---------------- 1073741824 SQL> select to_char(1073741824,'xxxxxxxxx') from dual; TO_CHAR(1073741824,'XXXXXXXXX') -------------------------------------------------------------------------------- 40000000 SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down. SQL> startup mount ORACLE instance started. Total System Global Area 4175568896 bytes Fixed Size 2233088 bytes Variable Size 1560284416 bytes Database Buffers 2566914048 bytes Redo Buffers 46137344 bytes Database mounted. SQL> oradebug setmypid Statement processed. SQL> oradebug dumpvar sga kcsgscn_ kcslf kcsgscn_ [060019360, 060019390) = 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 60019040 00000000 在mount状态下,不能看到scn的信息。 我们在这里修改scn为1G。 SQL> oradebug poke 0x060019360 4 0x40000000 BEFORE: [060019360, 060019364) = 00000000 AFTER: [060019360, 060019364) = 40000000 SQL> oradebug dumpvar sga kcsgscn_ kcslf kcsgscn_ [060019360, 060019390) = 40000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 60019040 00000000 SQL> alter database open; Database altered. SQL> select current_scn from v$database; CURRENT_SCN ----------- 1073742107 SQL> select current_scn/1024/1024/1024 from v$database; CURRENT_SCN/1024/1024/1024 -------------------------- 1.00000027 修改成功。 备注:此命令危险,生产环境勿乱操作,可能后果很严重。 延伸阅读: http://www.dbsnake.net/how_to_dirty_adjust_scn.html oradebug:http://blog.chinaunix.net/attachment/attach/22/94/87/7322948773d50faeda7c405c55399f07a0acf48ecc.pdf