compatible也能降
compatible也能由高变低,不过是在9i。
今天在看oracle 10g的文档,注意到Irreversible Compatibility这个说法。
Starting with Oracle Database 10g, the COMPATIBLE initialization parameter becomes irreversible; that is, it cannot be set to a value that is less than a previous value. Therefore, the compatibility of the database can go only forward and never backward.
For example, suppose that you set COMPATIBLE to 10.0.0 and start up the database, then shut down the database to restart with COMPATIBLE set to 9.2.0. During startup, you get an error indicating that the compatible setting cannot be reversed.
If you do advance the compatibility(的值) of your database with the COMPATIBLE initialization parameter, there is no way to start the database using a lower compatibility level setting,except by doing a point-in-time recovery to a time before compatibility was advanced. (so)Any changes since, are lost.Consequently, the ALTER DATABASE RESET COMPATIBILITY command is now obsolete.
注释:
看来,有时候还得看点老版本oracle文档上的东西,即新版本和老版本都有的知识点。我在11gR2上貌似没看到上面的解释。
对except by doing a point-in-time recovery to a time before compatibility was advanced.的解释:
你要使用这个参数来保持升级(oracle软件系统和数据库都升级了)前的功能,必须在升级数据文件时就指定你想要的compatiable参数值。否则开始设定一个比较高(的版本号)来升级(oracle软件系统和数据库都升级了,此时compatiable参数值也变为升级后的版本号值),升级后想让compatiable参数值revert到以前来避免使用(oracle软件系统)新功能是不可能的。除非你用以前低版本(数据文件)备份来做一次point-in-time的恢复。
好了,开始正文。
从10g开始COMPATIBLE 不能由高降低,难道9I可以?将compatiable从9.2.0.5改为9.2.0.1?我测试后果然可以。
以前我一直以为COMPATIBLE 在所有版本(包括patch set)都不能修改为更小的值,以为每次修改compatiable都会去修改所有的datafile header(格式上的compatiable(或是叫 version
,版本)这个变量位置里的值).
先看10g的,改低compatible后,数据库在mount的时候提示错误:参数设置与控制文件(格式上的compatiable(或是叫 version
,版本)这个变量位置里的值)不一致:
SQL> startup
ORACLE instance started.
Total System Global Area 272629760 bytes
Fixed Size 2035592 bytes
Variable Size 201330808 bytes
Database Buffers 62914560 bytes
Redo Buffers 6348800 bytes
ORA-00201: control file version 10.2.0.3.0 incompatible with ORACLE version 10.2.0.1.0(指的是参数compatiable里设置的值)
ORA-00202: control file: '/oracle/DDS/data03/lewu/data/cntrl_lewu_1.dbfctl'
测试将compatiable从9.2.0.5修改为9.2.0.0.0,数据库重起成功。//说明 9.2.0.0 到 9.2.0.5 block structure 没有变化
看告警日志【不用看,对理解compatible参数本身没有意义,列出下面内容只是证明数据库重起成功了】:
Starting ORACLE instance (normal)
Starting up ORACLE RDBMS Version: 9.2.0.5.0.
System parameters with non-default values:
compatible = 9.2.0.50
ARCH: STARTING ARCH PROCESSES
ARCH: STARTING ARCH PROCESSES COMPLETE
ALTER DATABASE MOUNT
Completed: ALTER DATABASE MOUNT
Wed Aug 27 20:53:23 2008
ALTER DATABASE OPEN
Completed: ALTER DATABASE OPEN
ALTER DATABASE CLOSE NORMAL
Completed: ALTER DATABASE CLOSE NORMAL
---------------------------------------------------------
Starting ORACLE instance (normal)
Starting up ORACLE RDBMS Version: 9.2.0.5.0. //oracle软件系统的版本号(version
)
System parameters with non-default values:
compatible = 9.2.0.0 //compatible的值
ARCH: STARTING ARCH PROCESSES
ARCH: STARTING ARCH PROCESSES COMPLETE
ALTER DATABASE MOUNT
Completed: ALTER DATABASE MOUNT
ALTER DATABASE OPEN
Completed: ALTER DATABASE OPEN
再看看能不能从9.2.0.5改为8.1.7.4,结果失败。数据库能够mount,但无法启动。看不来不能够跨大版本。
SQL> startup
ORACLE instance started.
Total System Global Area 689409008 bytes
Fixed Size 732144 bytes
Variable Size 352321536 bytes
Database Buffers 335544320 bytes
Redo Buffers 811008 bytes
Database mounted.
ORA-00402: database changes by release 9.2.0.0.0 cannot be used by release 8.1.7.0.0
ORA-00405: compatibility type "Locally Managed SYSTEM tablespace"
注释:
database changes指的是oracle软件系统的一些新特性功能或是数据库文件的新格式。这里database changes指的是"Locally Managed SYSTEM tablespace"新特性功能。
在Oracle8I的版本中,Oracle推出了一种全新的表空间管理方式:本地化管理的表空间。
oracle@:/export/home/oracle/products/9205/dbs > oerr ora 00402
00402, 00000, "database changes by release %s cannot be used by release %s"
// *Cause: Changes have been made to the database that require a newer
// software release or that violate the compatibility parameters.
// *Action: Use a version of the software that can understand the changes or
// relax the compatibility requirements in the init file.
现在可以纠正以前的一个误区了。从上述实验所得结论是:compatible在9i的时候能降能升,而10g开始不行了,只能升了。