Chinaunix首页 | 论坛 | 博客
  • 博客访问: 6664387
  • 博文数量: 1005
  • 博客积分: 8199
  • 博客等级: 中将
  • 技术积分: 13071
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-25 20:19
个人简介

脚踏实地、勇往直前!

文章分类

全部博文(1005)

文章存档

2020年(2)

2019年(93)

2018年(208)

2017年(81)

2016年(49)

2015年(50)

2014年(170)

2013年(52)

2012年(177)

2011年(93)

2010年(30)

分类: Oracle

2014-04-21 16:32:39

环境:
OS:Linux As3(2.4.21-50.EL)
DB:9.2.0.4

现在oracle已经推出了12c,估计很多人都很少使用9i了,但是我们这里还是有使用9i的,今天在两个节点的rac上添加了第三个实例,大致步骤如下:

1.新节点上安装操作系统
 安装的操作系统版本跟其他的节点保持一致。

2.修改主机名和配置节点3上的ip地址

3.配置hosts

修改每个节点的/etc/hosts文件,确保文件内容一致
[root@node3 root]# more /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               localhost.localdomain localhost

#Public
192.168.50.24   node1        node1
192.168.50.25   node2        node2
192.168.50.148  node3        node3
#Private
172.16.10.1   node1-priv   node1-priv
172.16.10.2   node2-priv   node2-priv
172.16.10.3   node3-priv   node3-priv

4.添加共享磁盘
将之前分配好的共享磁盘添加到新节点中

5.配置裸设备
跟其他节点一致,可以将其他节点的该文件直接拷贝过来,同时执行raw命令配置裸设备
[root@node3 /]# more /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

raw /dev/raw/raw1  /dev/sdb5   # Cluster Manager Quorum
raw /dev/raw/raw2  /dev/sdb6   #share configuration file

raw /dev/raw/raw3  /dev/sdb7   #undotbs1
raw /dev/raw/raw4  /dev/sdb8   #undotbs2
raw /dev/raw/raw5  /dev/sdb9   #system
raw /dev/raw/raw6  /dev/sdb10  #spfile
raw /dev/raw/raw7  /dev/sdb11  #temp
raw /dev/raw/raw8  /dev/sdb12  #users
raw /dev/raw/raw9  /dev/sdb13  #control1
raw /dev/raw/raw10 /dev/sdb14  #control2
raw /dev/raw/raw11 /dev/sdb15  #redo1_1

raw /dev/raw/raw12 /dev/sdc14  #redo1_2
raw /dev/raw/raw13 /dev/sdc5   #redo2_1
raw /dev/raw/raw14 /dev/sdc6   #redo2_2
raw /dev/raw/raw15 /dev/sdc7   ##indx
raw /dev/raw/raw16 /dev/sdc8   ##tools
raw /dev/raw/raw17 /dev/sdc9   ##example
raw /dev/raw/raw18 /dev/sdc10   ##xdb
raw /dev/raw/raw19 /dev/sdc11   ##cwmlite
raw /dev/raw/raw20 /dev/sdc12   ##drsys
raw /dev/raw/raw21 /dev/sdc13  ##odm

chown oracle.dba /dev/raw/raw*
/sbin/modprobe hangcheck-timer hangcheck_tick=30 hangcheck_margin=180
touch /var/lock/subsys/local

6.配置看门狗
/sbin/modprobe hangcheck-timer hangcheck_tick=30 hangcheck_margin=180

7.添加oracle用户

创建用户和组
[root@rac1 ~]# groupadd dba
[root@rac1 ~]# useradd -g dba oracle
[root@rac1 ~]# passwd oracle


创建目录
[root@rac1 /]# mkdir -p /u01/app/oracle/product/9.2.0/db_1
[root@rac1 /]# chown -R oracle:dba /u01/

使用oracle登录
编辑.bash_profile添加如下环境变量
export PS1="`/bin/hostname -s`-> "
export EDITOR=vi
DBCA_RAW_CONFIG=/home/oracle/datafiles.conf; export DBCA_RAW_CONFIG
export ORACLE_SID=racdb1
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/9.2.0/db_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin:/bin:/sbin
export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"
umask 022

8.修改内核参数
1.在节点1和节点2上做同样的修改
vi /etc/sysctl.conf
在该文件末尾添加如下内容:
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.shmall = 2097152
kernel.sem = 250 32000 100 128
fs.file-max = 65536

在两个节点上修改该文件
vi /etc/security/limits.conf
添加如下内容
oracle soft nofile 65536
oracle hard nofile 65536
oracle soft nproc 16384
oracle hard nproc 16384

9.安装ocm
[root@rac1 soft]#cpio -idmv < ship_9204_linux_disk1.cpio
[root@rac1 soft]#cpio -idmv < ship_9204_linux_disk2.cpio
[root@rac1 soft]#cpio -idmv < ship_9204_linux_disk3.cpio

[root@node3 soft]# chown -R oracle:dba ./Disk1
[root@node3 soft]# chown -R oracle:dba ./Disk2
[root@node3 soft]# chown -R oracle:dba ./Disk3

运行./runInstaller安装ocm

修改cmcfg.ora确保该文件内容一样,添加了节点3
每个节点的该文件要一致
node1-> more cmcfg.ora
ClusterName=Oracle Cluster Manager, version 9i
MissCount=20
PrivateNodeNames=node1-priv node2-priv node3-priv
PublicNodeNames=node1 node2 node3
ServicePort=9998
CmDiskFile=/dev/raw/raw1
HostName=node1-priv

10.安装数据库软件
确保启动了ocm
./ocmstart.sh
执行./runInstaller选择安装数据库软件,在显示的节点中选择节点3,选择只安装数据库软件

11.启动gsd
node3-> gsdctl start

12.为新的节点添加undo和redo表空间对应的磁盘

undo表空间500m
两个redo日志,每个100m

raw /dev/raw/raw22 /dev/sdd1   #undotbs3
raw /dev/raw/raw23 /dev/sdd2   #redo3_1
raw /dev/raw/raw24 /dev/sdd3   #redo3_2

在节点1上执行如上的命令,同时将该命令添加到每个节点的/etc/rc.local文件中

13.在节点1导出spfile
node1-> sqlplus /nolog

SQL*Plus: Release 9.2.0.4.0 - Production on Mon Apr 21 09:35:09 2014

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

SQL> connect / as sysdba
Connected.
SQL> create pfile='/home/oracle/mypfile' from spfile;

将该文件传到新增的节点3下

node1-> scp mypfile

14.修改pfile的相应参数
racdb2.instance_name='racdb3'
racdb3.instance_number=3
racdb3.thread=3
racdb3.undo_tablespace='UNDOTBS3'
*.cluster_database_instances=3

15.为实例3创建undo表空间和redo日志组
该操作在其他的节点上执行,这里我在节点1上执行

创建undo表空间
CREATE UNDO TABLESPACE UNDOTBS3 DATAFILE
'/dev/raw/raw22' SIZE 100m AUTOEXTEND ON NEXT  5120K MAXSIZE 500m;

创建redo日志组
ALTER DATABASE ADD LOGFILE THREAD 3
GROUP 5 ('/dev/raw/raw23') SIZE 102400K,
GROUP 6 ('/dev/raw/raw24') SIZE 102400K;
ALTER DATABASE ENABLE PUBLIC THREAD 3;

alter database enable thread 3;

16.启动数据库
这里重新启动ocm是因为我机器重新启动了
node3-> ./ocmstart.sh
oracm &1 >/u01/app/oracle/product/9.2.0/db_1/oracm/log/cm.out &

node3-> gsdctl start
Successfully started GSD on local node

SQL> connect / as sysdba
Connected to an idle instance.
SQL> startup pfile=/home/oracle/mypfile
ORA-00119: invalid specification for system parameter local_listener
ORA-00132: syntax error or unresolved network name 'LISTENER_RACDB3'
ORA-01078: failure in processing system parameters

解决办法:
使用netca添加监听器,同时生成tnsnames.ora,添加如下内容:
LISTENER_RACDB3 =
  (ADDRESS = (PROTOCOL = TCP)(HOST = node3)(PORT = 1521))


node3-> sqlplus /nolog

SQL*Plus: Release 9.2.0.4.0 - Production on Mon Apr 21 15:13:19 2014

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

SQL> connect / as sysdba
Connected to an idle instance.
SQL> startup pfile=/home/oracle/mypfile
ORA-00444: background process "DIAG" failed while starting
ORA-07446: sdnfy: bad value '' for parameter .

 


SQL> connect / as sysdba
Connected to an idle instance.
SQL> startup pfile=/home/oracle/mypfile
ORACLE instance started.

Total System Global Area  487658896 bytes
Fixed Size                   451984 bytes
Variable Size             251658240 bytes
Database Buffers          234881024 bytes
Redo Buffers                 667648 bytes
ORA-01990: error opening password file
'/u01/app/oracle/product/9.2.0/db_1/dbs/orapw'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3


解决办法
node3-> orapwd file=/u01/app/oracle/product/9.2.0/db_1/dbs/orapwracdb3 password=oracle entries=10

 

SQL> connect / as sysdba
Connected to an idle instance.
SQL>
SQL>
SQL> startup pfile=/home/oracle/mypfile
ORACLE instance started.

Total System Global Area  487658896 bytes
Fixed Size                   451984 bytes
Variable Size             251658240 bytes
Database Buffers          234881024 bytes
Redo Buffers                 667648 bytes
Database mounted.
Database opened.

到这里,添加节点完成.

-- The End --

阅读(4228) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~