手动递增SCN号的几种方法:How to increase System Change Number by manual

 

 

手动递增SCN号的几种方法

 

除去下面几种,还有一种方法直接修改 实例的Global Lamport SCN,在SGA中由kcsgscn变量存储,对于一个实例来说这是唯一的源SCN,所有其他的SCN均由这个source scn所驱动。 这种递增方式是直接用oradebug 修改该Global Lamport SCN kcsgscn

 

 

SQL> oradebug setmypid
Statement processed.

 

SQL> select to_char(current_scn,’XXXXXXXXXXXX’) from v$database;

TO_CHAR(CURRE
————-
D3E1E

SQL>
SQL> oradebug DUMPvar SGA kcsgscn
kcslf kcsgscn_ [060012658, 060012688) = 000D3E1E 00000000 00000000 00000000 0000162D 00000000 00000000 00000000 00000000 00000000 60012338 00000000

 

ORADEBUG POKE 0x060012658 4 0xfffff

poke 命令的语法

<address> <length> <value>” allows you to modify a given region of memory (length of memory is limited to size of scalar C types)

 

SQL> select current_scn from v$database;

CURRENT_SCN
———–
1048583

 

SQL> select to_char(current_scn,’XXXXXXXXXXXX’) from v$database;

TO_CHAR(CURRE
————-
10000B

SQL> oradebug DUMPvar SGA kcsgscn
kcslf kcsgscn_ [060012658, 060012688) = 00100010 00000000 00000000 00000000 0000004E 00000000 00000000 00000000 00000000 00000000 60012338 00000000

 

 

 

 

 

How to jump SCN  by manual ,  this could be a problem:

1. We can bump up the SCN by using the procedure from Note: 386830.1

 

Bump the system SCN on the primary database to fix any metadata index corruptions for both
primary and physical standby databases. Set the following parameters in the init.ora and restart
the database in restricted mode to bump the system SCN of the primary database.
For Real Application Clusters, perform the steps on only one node of the cluster. 

Init.ora syntax:

*._allow_error_simulation = TRUE
*._smu_debug_mode = 268435456

If using an spfile, Oracle recommends creating a temporary init.ora using the CREATE PFILE SQL command.

SQL> create pfile='/tmp/initTMP.ora' from spfile='';

Then add the parameters to this temporary file.

To use the temporary init.ora file when starting the instance, include the 'PFILE' clause with the STARTUP SQL command i.e.

SQL> startup restrict pfile=

WARNING: These parameters should only be used for this fix and must be removed immediately afterwards in step 2.
If the above parameters are used through multiple database restarts, a complete database rebuild will be required.

To know the system SCN has been bumped, monitor the instance's alert.log for the following message:
advance SCN to wrap base xxxx

Where xxx represents the new wrap SCN.

 

 

 

 

2.EVENT: ADJUST_SCN – Quick Reference (Doc ID 30681.1)

 

 

 

WORKAROUND:
-----------
Searched in webiv (ora-1555, ora-604 see note:1063408.6 ) suggests workaround
is to adjust serial number using event

Will try : (30681.1)

alter session set events 'IMMEDIATE trace name ADJUST_SCN level 1';

ora-600 [2256][0][1073741824][1][293672646]

ERROR:
  ORA-600 [2256][a][b][c][d][e]

VERSIONS:
  versions 7.3.X, 8.0.X, 8.1.X

DESCRIPTION:
  This exception indicates that you attempted to ADJUST_SCN but the level
  supplied would be less that the current SCN.

ARGUMENTS:
  a.  Requested SCN WRAP
  b.  Requested SCN BASE
  c.  Current SCN WRAP
  d.  Current SCN BASE = [293672646]

*4 = 1174690584

will try level 2

ora-600 2256[0][2147483648][1][293672646]

level 3

ora-600 2256[0][3221225472][1][293672646]

Now, we increase the SCN on DST7 by using the ADJUST_SCN event -
(Note: do not use this event outside of your test environment)

set the following hidden parameter in init.ora on DST7 database and bounce
the database.
  _allow_error_simulation=true

Now, the SCN is increased by doing -
  alter system set events 'immediate trace name adjust_scn level ';

where  translates to (n*0x40000000) as the target SCN value. ie. n = 1
will set the SCN as 0x0000.40000000. For the testcase pick a value that is
larger than the current SCN on both databases by atleast 100000 SCNs (our
earlier SCN adjust threshold value).

 alter system set events 'immediate trace name adjust_scn level 2';
  select to_char(current_scn, 'xxxxxxxxxxxx') from v$database;

 

 

 

3.Note 552438.1 How To Adjust the SCN using parameter _MINIMUM_GIGA_SCN

 

 

 

 

Parameter: MINIMUM_GIGA_SCN
~~~~~~~~~~~~~~~~~~~~~~~~~~~

@Oracle8i:	HIDDEN
@Identifier:	kcmmsn
@Versions:	See <IVERS.MINIMUM_GIGA_SCN>

 Values:
 Related:

Description:	Minimum SCN to start with in 2^30 units
~~~~~~~~~~~~

Articles:	
       <Event:ADJUST_SCN>
     	Overview of Init.Ora Parameter Reference notes