详解Oracle升高或降低参数Compatible

今天在看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. Any changes since, are lost.

Consequently, the ALTER DATABASE RESET COMPATIBILITY command is now obsolete.

从10g开始COMPATIBLE 不能由高降低,难道9I可以?将compatiable从9.2.0.5改为9.2.0.1?我测试后果然可以。

以前我一直以为COMPATIBLE 在所有版本(包括patch set)都不能修改为更小的值,以为每次修改compatiable都会去修改所有的datafile header.

先看10g得,改低compatible后,数据库在mount的时候提是错误,参数设置与控制文件不一致。

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
ORA-00202: control file: '/oracle/DDS/data03/lewu/data/cntrl_lewu_1.dbf'

测试将compatiable从9.2.0.5修改为9.2.0.0.0,数据库重起成功。看日志.

Starting ORACLE instance (normal)
Starting up ORACLE RDBMS Version: 9.2.0.5.0.
System parameters with non-default values:
compatible = 9.2.0.5

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.
System parameters with non-default values:

compatible = 9.2.0.0

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"

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开始不行了。

转贴: http://yumianfeilong.com/html/2008/09/25/229.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Oracle执行计划是查询优化器生成的一种表示查询执行的步骤和顺序的计划。执行计划参数是指影响查询优化器生成执行计划的参数设置。以下是一些常见的Oracle执行计划参数详解: 1. OPTIMIZER_MODE:这个参数用于指定查询优化器的模式。常见的取值有"RULE"和"CBO"。"RULE"模式使用基于规则的优化器,而"CBO"模式使用成本基于的优化器。在大多数情况下,建议使用"CBO"模式。 2. OPTIMIZER_INDEX_COST_ADJ:这个参数用于调整索引扫描的成本估算。如果设置为较高的值,查询优化器更倾向于使用索引扫描。如果设置为较低的值,查询优化器更倾向于使用全表扫描。 3. OPTIMIZER_INDEX_CACHING:这个参数用于指定查询优化器对索引块的缓存命中率的估算值。较高的值表示更高的缓存命中率,较低的值表示较低的缓存命中率。 4. OPTIMIZER_DYNAMIC_SAMPLING:这个参数用于指定查询优化器对数据分布进行动态采样的级别。较高的值表示更频繁地进行动态采样,以获取更准确的统计信息。 5. OPTIMIZER_FEATURES_ENABLE:这个参数用于启用或禁用不同版本的查询优化器特性。它可以影响查询优化器的行为和生成的执行计划。 这些是一些常见的Oracle执行计划参数,它们可以通过ALTER SESSION语句或在参数文件中进行设置。请注意,对于每个特定的查询,查询优化器可能会根据表的统计信息和查询条件自动选择合适的执行计划,而不需要手动调整这些参数

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值