本文转载:http://space.itpub.net/4227/viewspace-591215
CLUSTER_DATABASE_INSTANCES参数
以前一直认为这个参数是设置数据库允许启动的实例数,今天才发现并非如此。
今天在测试添加RAC的节点时发现了这个问题,数据库启动的实例数,超过了CLUSTER_DATABASE_INSTANCES的设置:
bash-3.00$ sqlplus "/ as sysdba"
SQL*Plus: Release11.1.0.6.0 - Production on星期一4月20 17:27:10 2009
Copyright (c) 1982, 2007, Oracle. All rights reserved.
连接到:
Oracle Database11gEnterprise Edition Release11.1.0.6.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
SQL> set pages 100 lines 120
SQL> show parameter cluster_database
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cluster_database boolean TRUE
cluster_database_instances integer 1
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
test1
SQL> select instance_name, status from gv$instance;
INSTANCE_NAME STATUS
---------------- ------------
test1 OPEN
test2 OPEN
SQL> conn test/test@test2
已连接。
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
test2
RAC环境的两个实例同时在运行,但是CLUSTER_DATABASE_INSTANCES参数的设置为1。开始还以为碰到了bug,或者是11g做了某些改变。
查询了Oracle的文档,才发现原来的理解一直存在问题。认为CLUSTER_DATABASE_INSTANCES设置的是Oracle所允许运行的最大实例数,完全是想当然的,实际上Oracle通过这个初始化参数设置的值,在运行并行自动调整的情况下,来估算LARGE_POOL_SIZE参数的默认值。
Oracle添加节点这种操作,是不需要重启数据库的(当然从非RAC环境添加实例变为RAC环境是例外,因为要修改CLUSTER_DATABASE参数),因为CLUSTER_DATABASE_INSTANCES参数的调整完全可以先在SPFILE中修改,等以后有重启机会的时候再加载正确的参数设置。不过需要注意,如果在SPFILE中修改了CLUSTER_DATABASE_INSTANCES,那么随后任意一个实例需要重启的时候,所有的其他实例也比较重启,因为每个实例中这个值的设置必须是一致的:
SQL> conn / as sysdba
已连接。
SQL> shutdown immediate
数据库已经关闭。
已经卸载数据库。
ORACLE例程已经关闭。
SQL> startup
ORACLE例程已经启动。
Total System Global Area 776896512 bytes
Fixed Size 2098776 bytes
Variable Size 212523432 bytes
Database Buffers 557842432 bytes
Redo Buffers 4431872 bytes
数据库装载完毕。
数据库已经打开。
SQL> conn / as sysdba
已连接。
SQL> alter system set cluster_database_instances = 2 scope = spfile;
系统已更改。
SQL> shutdown immediate
数据库已经关闭。
已经卸载数据库。
ORACLE例程已经关闭。
SQL> startup
ORA-29707: inconsistent value 2 for initialization parameter cluster_database_instances with other instances
这时只有两种方法,一种是修改SPFILE中的参数设置,使得SPFILE的设置和其他运行的实例中设置一致,另一种方法就是关闭其他所有的实例,然后重启数据库。
SQL> exit
从Oracle Database11gEnterprise Edition Release11.1.0.6.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options断开
bash-3.00$ srvctl stop inst -d test -i test2
bash-3.00$ srvctl start db -d test
bash-3.00$ sqlplus "/ as sysdba"
SQL*Plus: Release11.1.0.6.0 - Production on星期一4月20 18:42:14 2009
Copyright (c) 1982, 2007, Oracle. All rights reserved.
连接到:
Oracle Database11gEnterprise Edition Release11.1.0.6.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
SQL> show parameter cluster_database
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cluster_database boolean TRUE
cluster_database_instances integer 2
SQL> select instance_name from gv$instance;
INSTANCE_NAME
----------------
test1
test2
转载于:https://blog.51cto.com/2814740/846942