简单描述一下,在Oracle 10203 for Solaris sparc的RAC双节点环境中,新增一个节点的过程。共享存储已经在第三个节点上配置完成,这里主要介绍操作系统上和Oracle上的配置。
这一篇添加一个新节点上的数据库实例。
首先确保数据库处于启动状态,如果数据库没有启动:
bash-2.03$ srvctl start inst -d testrac -i testrac1
bash-2.03$ srvctl start inst -d testrac -i testrac2
确保监听处于启动状态,如果没有启动,使用lsnrctl start启动监听:
bash-2.03$ lsnrctl start
LSNRCTL for Solaris: Version 10.2.0.3.0 - Production on 01-2月-2009 00:22:24
Copyright (c) 1991, 2006, Oracle. All rights reserved.
启动/data/oracle/product/10.2/database/bin/tnslsnr:请稍候...
TNSLSNR for Solaris: Version 10.2.0.3.0 - Production
系统参数文件为/data/oracle/product/10.2/database/network/admin/listener.ora
写入/data/oracle/product/10.2/database/network/log/listener.log的日志信息
监听: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.25.198.225)(PORT=1521)))
监听: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
正在连接到(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=172.25.198.225)(PORT=1521)))
LISTENER的STATUS
------------------------
别名 LISTENER
版本 TNSLSNR for Solaris: Version 10.2.0.3.0 - Production
启动日期 01-2月-2009 00:22:26
正常运行时间 0天0小时0分0秒
跟踪级别 off
安全性 ON: Local OS Authentication
SNMP OFF
监听程序参数文件 /data/oracle/product/10.2/database/network/admin/listener.ora
监听程序日志文件 /data/oracle/product/10.2/database/network/log/listener.log
监听端点概要...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.25.198.225)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
服务摘要..
服务"PLSExtProc"包含1个例程。
例程"PLSExtProc",状态UNKNOWN,包含此服务的1个处理程序...
服务"testrac"包含1个例程。
例程"testrac2",状态UNKNOWN,包含此服务的1个处理程序...
命令执行成功
对于新节点而言,可以首先通过NETCA来配置监听程序:
$ netca
Oracle Net Services Configuration:
首先选择Cluster Configuration,然后选择全表3个节点,选择Listener Configuration,选择ADD,输入监听名称。
在图形界面环境下运行DBCA添加实例报错,由于DBCA对于ASM的支持存在问题,只能选择手工添加实例:
首先建立UNDOTBS3表空间,以及THREAD3对应的REDO.LOG的方法:
SQL> select group#, thread#, sequence#, bytes/1024/1024
2 from v$log;
GROUP# THREAD# SEQUENCE# BYTES/1024/1024
---------- ---------- ---------- ---------------
1 1 1716 512
2 1 1717 512
3 2 839 512
4 2 840 512
SQL> select member from v$logfile;
MEMBER
---------------------------------------------------
+DISK/testrac/onlinelog/group_1.258.633485433
+DISK/testrac/onlinelog/group_2.260.633485441
+DISK/testrac/onlinelog/group_3.268.633485447
+DISK/testrac/onlinelog/group_4.270.633485455
下面手工添加THREAD 3对应的REDO.LOG:
SQL> alter database add logfile thread 3 group 5 '+DISK/testrac/onlinelog/redo5.log' size512m;
数据库已更改。
SQL> alter database add logfile thread 3 group 6 '+DISK/testrac/onlinelog/redo6.log' size512m;
数据库已更改。
SQL> select group#, thread#, sequence#, bytes/1024/1024
2 from v$log;
GROUP# THREAD# SEQUENCE# BYTES/1024/1024
---------- ---------- ---------- ---------------
1 1 1716 512
2 1 1717 512
3 2 839 512
4 2 840 512
5 3 0 512
6 3 0 512
已选择6行。
SQL> select member from v$logfile;
MEMBER
----------------------------------------------------------------
+DISK/testrac/onlinelog/group_1.258.633485433
+DISK/testrac/onlinelog/group_2.260.633485441
+DISK/testrac/onlinelog/group_3.268.633485447
+DISK/testrac/onlinelog/group_4.270.633485455
+DISK/testrac/onlinelog/redo5.log
+DISK/testrac/onlinelog/redo6.log
已选择6行。
接着添加UNDOTBS3表空间:
SQL> select file_name from dba_data_files
2 where tablespace_name like 'UNDOTBS_';
FILE_NAME
----------------------------------------------------------------------
+DISK/testrac/datafile/undotbs1.263.618591197
+DISK/testrac/datafile/undotbs2.266.618591249
SQL> create undo tablespace undotbs3
2 datafile '+DISK/testrac/datafile/undotbs3.dbf' size4096m;
表空间已创建。
检查数据库的SPFILE配置:
SQL> show parameter spfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string +DISK/testrac/spfiletestrac.ora
由于系统使用的是SPFILE,下面直接修改必要的初始化参数值:
SQL> alter system set cluster_database_instances = 3 scope = spfile;
系统已更改。
SQL> alter system set instance_number = 3 scope = spfile sid = 'testrac3';
系统已更改。
SQL> alter system set local_listener =
2 '(ADDRESS = (PROTOCOL = TCP)(HOST = 172.25.198.227)(PORT = 1521))'
3 scope = spfile sid = 'testrac3';
系统已更改。
SQL> alter system set thread = 3 scope = spfile sid = 'testrac3';
系统已更改。
SQL> alter system set undo_tablespace = 'UNDOTBS3' scope = spfile sid = 'testrac3';
系统已更改。
下面重启数据库的实例,使得数据库加载新的SPFILE:
bash-2.03$ srvctl stop db -d testrac
bash-2.03$ srvctl start inst -d testrac -i testrac1
bash-2.03$ srvctl start inst -d testrac -i testrac2
登陆实例1的节点,ENABLE THREAD 3:
SQL> alter database enable thread 3;
数据库已更改。
在新增节点上编辑PFILE文件,指向SPFILE文件:
bash-3.00$ cd $ORACLE_HOME
bash-3.00$ cd dbs
bash-3.00$ vi inittestrac3.ora
spfile='+DISK/testrac/spfiletestrac.ora'
生成密码文件:
bash-3.00$ orapwd file=orapwtestrac3 password=password
建立adump、bdump、udump和cdump目录:
bash-3.00$ cd $ORACLE_BASE/admin
bash-3.00$ ls -l
total 2
drwxr-xr-x 7 oracle oinstall 512 Jul 1 17:37 +ASM
bash-3.00$ mkdir testrac
bash-3.00$ cd testrac
bash-3.00$ mkdir bdump cdump adump udump
下面就可以登陆sqlplus并启动新实例了:
bash-3.00$ sqlplus "/ as sysdba"
SQL*Plus: Release 10.2.0.3.0 - Production on星期五4月3 15:06:35 2009
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
已连接到空闲例程。
SQL> startup
ORACLE例程已经启动。
Total System Global Area 2147483648 bytes
Fixed Size 2031480 bytes
Variable Size 503316616 bytes
Database Buffers 1627389952 bytes
Redo Buffers 14745600 bytes
数据库装载完毕。
数据库已经打开。
SQL> select inst_id, instance_number, instance_name
2 from gv$instance;
INST_ID INSTANCE_NUMBER INSTANCE_NAME
---------- --------------- ----------------
3 3 testrac3
2 2 testrac2
1 1 testrac1
SQL> select instance_name, status from v$instance;
INSTANCE_NAME STATUS
---------------- ------------
testrac3 OPEN
随后还需要将手工添加的实例信息加到srvctl工具中:
$ srvctl add instance -d testrac -i testrac3 -n racnode3
$ srvctl modify instance -d testrac -i testrac3 -s +ASM3
至此,新增实例的操作完成。
还需要修改三个节点上的tnsnames.ora文件,确保通过TESTRAC的访问在3个实例上根据负载均衡的机制进行连接。
TESTRAC =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = racnode1-vip)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = racnode2-vip)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = racnode3-vip)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = testrac)
(FAILOVER_MODE =
(TYPE = SELECT)
(METHOD = BASIC)
(RETRIES = 180)
(DELAY = 5)
)
)
)
比如配置TESTRAC服务名如上所示,下面连接数据库:
SQL> conn test/test@testrac
已连接。
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
testrac3
SQL> host
$ sqlplus test/test@testrac
SQL*Plus: Release 10.2.0.3.0 - Production on星期四4月9 14:56:34 2009
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
连接到:
Oracle Database10gEnterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
testrac1
SQL> host
$ sqlplus test/test@testrac
SQL*Plus: Release 10.2.0.3.0 - Production on星期四4月9 14:56:46 2009
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
连接到:
Oracle Database10gEnterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
testrac2
(以上内容摘于网络,如有侵权,请告之,将第一时间删除)
总机:(010)-88589926,88589826,88587026 QQ讨论群:243729577 182441349 邮箱:cuug_bj@cuug.com
通信地址:北京市海淀区紫竹院路98号北京化工大学科技园609室(CUUG)邮政编码:100089
中国UNIX用户协会 Copyright 2010 ALL Rights Reserved 北京神脑资讯技术有限公司
京ICP备11008061号 京公网安备110108006275号