Vmware上安装Solaris10+Oracle10gRAC+ASM

来源:互联网 发布:工程设计优化方法手段 编辑:程序博客网 时间:2024/05/18 20:07

作者 阿九【转载时请务必以超链接形式标明文章原始出处和作者信息】 




在Vmware上安装Solaris10+Oracle10gRAC+ASM

 

作者:杨九荣

QQ:47538I607        邮箱:daisycutter-y@163.com



一、安装环境介绍:

CPU : Genuine Intel 2140

ROM: 2G

虚拟机:Vmwareserver 1.0.8

 

1.1、虚拟系统文件存储目录规划:

SolarisRAC

  -- Node_1

  -- Node_2

  -- ShareDisk

1.2、网络规划:

节点

接口

类型

IP地址

子网掩码

rac1

rac1

公共

192.168.1.133

255.255.0.0

rac1

rac1-vip

虚拟

192.168.1.32

255.255.0.0

rac1

rac1-priv

专用

10.10.10.31

255.255.0.0

rac2

rac2

公共

192.168.1.134

255.255.0.0

rac2

rac2-vip

虚拟

192.168.1.34

255.255.0.0

rac2

rac2-priv

专用

10.10.10.32

255.255.0.0

 

1.3、存储规划:

文件

大小

存储类型

Solaris10

6GB

Solaris2

Oracle Cluster

2GB

Solaris2

Oracle Database

4GB

ASM

Oracle CRS ocr

100MB

RAW

Oracle CRS voting

20MB

RAW

 

 

二、配置Vmware虚拟机并安装系统。

 

2.1、在Vmware上使用Ctrl+N呼出新建虚拟机界面

 

2.2、选择Custom 模式。

选择Custom模式可以自己定制虚拟机的选项,如果选择Typical模式则某些虚拟机选项将使用默认配置,不可更改。

 

2.3、指定系统类型,选择SUN Solaris。

此处最好根据你所安装的系统类型来选择同样或相识的虚拟机类型,因为VMware会根据你所选择的系统类型来虚拟相应的硬件。

 

2.4.、指定虚拟系统文件存储目录。

输入前面规划好的目录。这里的显示名称和目录可以随便写,不过为了便于区分,应预先规划。

 

 

 

 

2.5、指定虚拟系统内存大小。

此处应注意,由于这里指定了700MB的内存,但Oracle在Solaris10上安装要求最少922MB,因此在安装Oracle的时候会提示内存不足警告。

 

2.6第一个网络接口选择桥连接模式。

 

 

 

 

 

2.7、指定虚拟磁盘大小。

这里注意取消Allocate选项。如果选中,则直接在宿主机硬盘上分配20G的虚拟文件。这太浪费空间。取消后,可以根据实际使用确定文件大小,最大可到20G。

 

2.8、输入虚拟系统文件名。

 

2.9、按Ctrl+D呼出虚拟机设置界面,单击Add添加相应硬件。

2.10、选择硬盘

2.11、单击下一步。

2.12、选择硬盘控制器。

2.13、指定虚拟盘大小。这里选中Alloate选项。

2.14、单击Browse指定开头规划好的目录及名字。

 

2.15、单击Advanced指定虚拟盘接口,选中Independent选项。

2.16、共享存储配置

最终配置好的虚拟机。在虚拟机配置文件中加入如下类容::

disk.locking="FALSE"

scsi1.SharedBus="Virtual"

 

2.17、单击开始命令开始安装。选中第一项。

 

2.18.、指定安装界面模式。

 

2.19、指定键盘类型

 

2.20、选择安装界面语言。

 

 

2.21、指定虚拟机是否联网。

 

 

2.22、配置两个网卡地址及主机名。

 

 

 

2.23、指定pcn0为主网络接口

 

 

2.24、不指定pcn0使用DHCP配置

 

 

2.25、输入开头规划好的主机名。

 

 

2.26、输入规划好的IP地址

 

 

2.27、指定子网掩码

 

2.28、不启用Ipv6配置pcn0

 

 

2.29、指定公共接口的路由器。

 

 

2.30、同样方式配置pcn1接口

 

 

2.31、不指定路由器

 

 

2.32、不指定DNS服务器。

 

 

2.33、不指定默认域名。

 

2.34、指定时区,选择亚洲。

 

2.35、选择中国。

 

 

2.36、指定root用户密码

 

 

2.37、选择图形界面语言。

 

2.38、指定默认图形界面语言。

 

2.39、选择文件系统

 

2.40、选择系统安装包。

 

2.41、选择硬盘。

 

2.42、使用自动分区。

 

2.43、修改默认分区。

 

2.44、修改为如下图。

 

 

 

 

 

 

三、为Oracle10g RAC 配置Solaris10服务器

 

安装Vmware虚拟机工具。单击VM菜单,选择Install Vmware Tools

 

-bash-3.00# cp/cdrom/vmwaretools/vmware-solaris-tools.tar.gz /Desktop/

-bash-3.00#

-bash-3.00# cd /Desktop/

-bash-3.00# gunzip vmware-solaris-tools.tar.gz

-bash-3.00# tar xvf vmware-solaris-tools.tar

-bash-3.00# cd vmware-tools-distrib/

-bash-3.00# ./vmware-install.pl

-bash-3.00# mv /etc/hostname.pcn0 /etc/hostname.vmxnet0

-bash-3.00# mv /etc/hostname.pcn1/etc/hostname.vmxnet1

-bash-3.00# reboot

updating /platform/i86pc/boot_archive

 

 

 

 

 

3.1.、查看所需系统包

-bash-3.00#pkginfo -i SUNWarc SUNWbtool SUNWhea SUNWlibm SUNWlibms SUNWsprot \

>  SUNWsprox SUNWtoo SUNWi1of SUNWi1cs SUNWi15csSUNWxwfnt

 

如没有,可在Solaris10安装光盘中找到

 

进入安装光盘:

-bash-3.00#cd /cdrom/sol_10_1009_x86/Solaris_10/Product/

 

安装没有的包:

-bash-3.00#pkgadd -d ./ SUNWi1cs

-bash-3.00#pkgadd -d ./ SUNWi15cs

 

3.2、配置系统内核参数

将如下内容添加到 /etc/system 文件中,注意,在最后一行空一行再写入,否则重启报错

-bash-3.00#vi /etc/system

 

set noexec_user_stack=1
set semsys:seminfo_semmni=100
set semsys:seminfo_semmns=1024
set semsys:seminfo_semmsl=256
set semsys:seminfo_semvmx=32767
set shmsys:shminfo_shmmax=4294967295
set shmsys:shminfo_shmmin=1
set shmsys:shminfo_shmmni=100
set shmsys:shminfo_shmseg=10

 

3.3、设置UDP参数

 

检查当前UDP参数命令:

# ndd /dev/udp udp_xmit_hiwat
# ndd /dev/udp udp_recv_hiwat

设置当前UDP参数命令

# ndd -set /dev/udp udp_xmit_hiwat 65536
# ndd -set /dev/udp udp_recv_hiwat 65536

 

配置文件,使重启后UDP不失效

# vi /etc/init.d/nddudp
ndd -set /dev/udp udp_xmit_hiwat 65536
ndd -set /dev/udp udp_recv_hiwat 65536
/etc/init.d目录下添加一个初始化脚本,将要修改的参数添加进去,然后在/etc目录下的rc1.drc2.drcS.d目录下添加上面文件的链接。这个链接需要以S70S71开头:
# ln -s -f /etc/init.d/nddudp /etc/rc1.d/S70nddudp
# ln -s -f /etc/init.d/nddudp /etc/rc2.d/S70nddudp
# ln -s -f /etc/init.d/nddudp /etc/rcS.d/S70nddudp

 

3.4、解析系统主机名,根据前面规划的网络配置,

-bash-3.00#vi /etc/hosts

"/etc/hosts" 7 行,112 字符

#

#Internet host table

#

::1     localhost

127.0.0.1       localhost

192.168.1.133   rac1 rac1.myhosts.com   loghost

192.168.1.33    rac1-vip rac1-vip.myhosts.com

10.10.10.31     rac1-priv

192.168.1.134   rac2 rac2.myhosts.com

192.168.1.34    rac2-viprac2-vip.myhosts.com

10.10.10.32     rac2-priv

 

3.5、建立Oracle用户和相应的用户组

-bash-3.00#groupadd -g 201 oinstall

-bash-3.00#groupadd -g 202 dba

-bash-3.00#useradd -u 201 -g oinstall -G dba -s /bin/bash -d /export/home/oracle oracle

-bash-3.00#passwd oracle

新口令:

请重新输入新口令:

passwd:oracle的口令已成功更改

-bash-3.00#

 

3.6、创建Oracle用户主目录并授权

-bash-3.00#mkdir -p /export/home/oracle

-bash-3.00#chown -RL oracle:oinstall /export/home/oracle

 

3.7、配置Oracle用户等效性

-bash-3.00#vi /etc/hosts.equiv

"/etc/hosts.equiv"[新文件]

rac1oracle

rac2oracle

rac1.myhosts.comoracle

rac2.myhosts.comoracle

rac1-privoracle

rac2-privoracle

rac1-viporacle

rac2-viporacle

rac1-vip.myhosts.comoracle

rac2-vip.myhosts.comoracle

 

 

3.8、连接Oracle用户需要使用的系统命令

-bash-3.00#mkdir -p /usr/local/bin

-bash-3.00#ln -s /usr/bin/ssh /usr/local/bin

-bash-3.00#ln -s /usr/bin/scp /usr/local/bin

 

3.9、添加默认域名:

-bash-3.00#vi /etc/defaultdomain

"/etc/defaultdomain"[新文件]

myhosts.com

 

注意:重启以后如果网卡不起作用,使用命令查看被系统认识的网卡名

# dladm show-link

如果和更改的网卡名不一致,则将/etc/hostname.* 文件改为相应的网卡名

例如:

-bash-3.00#dladm show-link

pcn0            类型:传统      mtu: 1500       设备:pcn0

pcn1            类型:传统      mtu: 1500       设备:pcn1

 

则将刚修改的/etc/hostname.vmxnet0 /etc/hostname.vmxnet1修改为原网卡名

/etc/hostname.pcn0/etc/hostname.pcn1 然后重启

 

3.10、以Oracle用户登录,配置用户环境

-bash-3.00$vi ~/.profile

"/export/home/oracle/.profile"8 行,314 字符

umask 022

 

exportORACLE_SID=dbnode1

exportORACLE_BASE=/export/home/oracle/product

exportORACLE_HOME=$ORACLE_BASE/db_1

exportORA_CRS_HOME=$ORACLE_BASE/crs_1

exportLD_LIBRARY_PATH=$ORACLE_HOME/lib

exportPATH=$ORA_CRS_HOME/bin:$ORACLE_HOME/bin:$PATH:$HOME/bin

exportNLS_LANG='SIMPLIFIED CHINESE_CHINA.'ZHS16GBK

 

unsetUSERNAME

 

 

以下部分为个人设置可以不加

#ALIAS

alias tns='cd $ORACLE_HOME/network/admin'

alias vbp='vi /home/oracle/.bash_profile'

alias cbp='cat /home/oracle/.bash_profile'

alias bp='. ~/.bash_profile'

alias db='cd $ORACLE_HOME'

alias sq='$ORACLE_HOME/bin/sqlplus /nolog'

alias sqs="sqlplus sys/sysadmin@asm as sysdba"

alias sqy="$ORACLE_HOME/bin/sqlplus sys/sysadmin@yjr_rhel_en assysdba"

alias lss='lsnrctl start'

alias lst='lsnrctl stop'

 

 

3.11、关闭系统。

以root用户执行

-bash-3.00#shutdown

 

 

 

四、配置第二个Solaris10服务器

由于本文是使用VM来模拟环境安装Oracle10g RAC,所以这里直接将节点一的虚拟机文件复制到节点二的文件夹中,并在作一些修改。如果是真实双机做测试,则在节点二上重复上面的步骤。

 

4.1、修改虚拟机配置

将节点二文件夹中的Solaris 10 RAC Node_1.vmdk改为Solaris 10 RAC Node_2.vmdk

打开节点二文件夹中的虚拟机配置文件Solaris 10.vmx,将

scsi0:0.fileName= "Solaris 10 RAC Node_1.vmdk"

displayName= "Solaris 10 RAC Node_1"

改为

scsi0:0.fileName= "Solaris 10 RAC Node_2.vmdk"

displayName= "Solaris 10 RAC Node_2"

 

在VMwawre中按Ctrl+O呼出打开虚拟机界面,选择节点二中Solaris 10.vmx,打开第二个虚拟机,单击运行,选择create

 

4.2、在启动的系统中作如下更改:

(1)、修改主机名和解析主机名,和节点一的文件内容相反。

-bash-3.00#vi /etc/hosts

"/etc/hosts"11 行,292 字符

#

#Internet host table

#

::1     localhost

127.0.0.1       localhost

192.168.1.134   rac2 rac2.myhosts.com   loghost

192.168.1.34    rac2-viprac2-vip.myhosts.com

10.10.10.32     rac2-priv

192.168.1.133   rac1 rac1.myhosts.com

192.168.1.33    rac1-vip rac1-vip.myhosts.com

10.10.10.31     rac1-priv

 

(2)、修改网卡IP地址

-bash-3.00#vi /etc/hostname.vmxnet0

"/etc/hostname.vmxnet0"1行,5个字符

rac2

-bash-3.00#vi /etc/hostname.vmxnet1

"/etc/hostname.vmxnet0"1行,10个字符

rac2-priv

 

(3)、修改节点名

-bash-3.00#vi /etc/nodename

"/etc/nodename"1行,5个字符

rac2

 

(4)、修改Oracle用户的ORACLE_SID变量为

exportORACLE_SID=dbnode2

 

 

五、双节点设置

5.1、双机时间同步

拷贝/etc/inet/目录下的ntp.server文件为ntp.conf

-bash-3.00#cp /etc/inet/ntp.server /etc/inet/ntp.conf

 

修改/etc/inet/ntp.conf文件

-bash-3.00#vi /etc/inet/ntp.conf

将原文件如下行

# table above.

server 127.127.XType.0

fudge 127.127.XType.0stratum 0

 

broadcast 224.0.1.1 ttl 4

 

enable auth monitor

driftfile /var/ntp/ntp.drift

statsdir /var/ntp/ntpstats/

filegen peerstats file peerstats type dayenable

filegen loopstats file loopstats type dayenable

filegen clockstats file clockstats type dayenable

 

keys /etc/inet/ntp.keys

trustedkey 0

requestkey 0

controlkey 0

修改为:

# table above.

# restrict default nomodify notrap

tinker panic 0

restrict 127.0.0.1

server 127.127.1.0  prefer

fudge 127.127.1.0 stratum0

#broadcast 192.168.0.255ttl 4

#enable auth monitor

driftfile /var/ntp/ntp.drift

statsdir /var/ntp/ntpstats/

filegen peerstats file peerstats type dayenable

filegen loopstats file loopstats type dayenable

filegen clockstats file clockstats type dayenable

 

#keys /etc/inet/ntp.keys

#trustedkey 0

#requestkey 0

#controlkey 0

 

启用和重启ntp服务

#svcadm enable ntp

#svcadm restart ntp

查询ntp服务

-bash-3.00# ntpq  -p

    remote           refid      st t when poll reach   delay  offset    disp

==============================================================================

 LOCAL(0)       .LCL.            0 l   15  64    1     0.00   0.000 15885.0

 

等五分钟再执行一次

-bash-3.00#ntpq  -p

     remote           refid      st t when poll reach   delay  offset    disp

==============================================================================

*LOCAL(0)        .LCL.            0 l   35  64   37     0.00   0.000  885.01

无论服务器端还是客户端的ntp -q显示结果,reach值代表是否与服务器端有连接,这个数值一直增大,则基本可以判定连接正常,同时,disp值也会逐渐变小。

 

客户机上同上在/etc/inet/目录下,拷贝 ntp.server文件为 ntp.conf并编辑

将原文:

# table above.

server 127.127.XType.0

fudge 127.127.XType.0stratum 0

 

broadcast 224.0.1.1 ttl 4

 

enable auth monitor

driftfile /var/ntp/ntp.drift

statsdir /var/ntp/ntpstats/

filegen peerstats file peerstats type dayenable

filegen loopstats file loopstats type dayenable

filegen clockstats file clockstats type dayenable

 

keys /etc/inet/ntp.keys

trustedkey 0

requestkey 0

controlkey 0

修改为:

# table above.

peer 192.168.1.133 (为时间同步主机IP)

server 192.168.1.133

fudge 192.168.1.133stratum 0

 

#broadcast 224.0.1.1 ttl4

 

#enable auth monitor

driftfile /var/ntp/ntp.drift

statsdir /var/ntp/ntpstats/

filegen peerstats file peerstats type dayenable

filegen loopstats file loopstats type dayenable

filegen clockstats file clockstats type dayenable

 

#keys /etc/inet/ntp.keys

#trustedkey 0

#requestkey 0

#controlkey 0

 

启用和重启ntp服务

#svcadm enable ntp

#svcadm restart ntp

 

-bash-3.00# ntpdate 143.168.1.133

12 May 22:24:42 ntpdate[837]: the NTPsocket is in use, exiting

 

查询客户机ntp服务

-bash-3.00# ntpq -p

    remote           refid      st t when poll reach   delay  offset    disp

==============================================================================

 rac1            0.0.0.0         16 u  52   64    0    0.00    0.000 16000.0

 

等5分钟再执行一次,客户机上可能要等久一点。

 

-bash-3.00#ntpq -p

     remote           refid      st t when poll reach   delay  offset    disp

==============================================================================

 rac1           .LCL.            1 u   36  64    1     0.85 490.594 15875.0

 

-bash-3.00#ntpq -p

     remote           refid      st t when poll reach   delay  offset    disp

==============================================================================

 rac1           .LCL.            1 u   32  64    3     0.85 492.374 7875.90

 

5.2、配置Oracle用户SSH等效

以Oracle用户在两个节点上执行如下操作

rac1:

-bash-3.00$mkdir ~/.ssh

-bash-3.00$chmod 755 ~/.ssh

-bash-3.00$ssh-keygen -t rsa

产生公共/私有rsa 密钥对。

输入要存储密钥的文件(/export/home/oracle/.ssh/id_rsa):

请输入口令(空白表示没有口令): 

再次输入同一 passphrase:

您的标识已经存储在 /export/home/oracle/.ssh/id_rsa 中。

您的公共密钥已经存储在/export/home/oracle/.ssh/id_rsa.pub 中。

密钥指纹为:

89:9b:7d:82:37:54:5b:51:12:70:de:19:09:19:ad:24oracle@rac1

-bash-3.00$ ssh-keygen -t dsa

产生公共/私有dsa 密钥对。

输入要存储密钥的文件(/export/home/oracle/.ssh/id_dsa):

请输入口令(空白表示没有口令): 

再次输入同一 passphrase:

您的标识已经存储在 /export/home/oracle/.ssh/id_dsa 中。

您的公共密钥已经存储在/export/home/oracle/.ssh/id_dsa.pub 中。

密钥指纹为:

ed:fc:92:a6:0e:86:2c:78:0a:ea:17:9c:6a:88:05:1eoracle@rac1

-bash-3.00$cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

-bash-3.00$cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys

 

rac2

-bash-3.00$mkdir ~/.ssh

-bash-3.00$ chmod 755 ~/.ssh

-bash-3.00$ssh-keygen -t rsa

产生公共/私有rsa 密钥对。

输入要存储密钥的文件(/export/home/oracle/.ssh/id_rsa):

请输入口令(空白表示没有口令): 

再次输入同一 passphrase:

您的标识已经存储在 /export/home/oracle/.ssh/id_rsa 中。

您的公共密钥已经存储在/export/home/oracle/.ssh/id_rsa.pub 中。

密钥指纹为:

89:9b:7d:82:37:54:5b:51:12:70:de:19:09:19:ad:24oracle@rac1

-bash-3.00$ ssh-keygen -t dsa

产生公共/私有dsa 密钥对。

输入要存储密钥的文件(/export/home/oracle/.ssh/id_dsa):

请输入口令(空白表示没有口令): 

再次输入同一 passphrase:

您的标识已经存储在 /export/home/oracle/.ssh/id_dsa 中。

您的公共密钥已经存储在/export/home/oracle/.ssh/id_dsa.pub 中。

密钥指纹为:

ed:fc:92:a6:0e:86:2c:78:0a:ea:17:9c:6a:88:05:1eoracle@rac1

-bash-3.00$cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

-bash-3.00$cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys

 

rac1

-bash-3.00$ssh rac1 cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys

主机 'rac1 (143.168.1.133)' 的真实性无法建立.

 RSA 密钥指纹是43:9a:06:6c:0f:9f:c1:f7:2e:d4:d6:20:32:39:c4:4f。

是否确实要继续连接 (yes/no)? yes

警告:已向已知主机的列表中永久添加 "rac1,143.168.1.133"(RSA)。

-bash-3.00$ssh rac2 cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys

主机 'rac2 (143.168.1.134)' 的真实性无法建立.

 RSA 密钥指纹是43:9a:06:6c:0f:9f:c1:f7:2e:d4:d6:20:32:39:c4:4f。

是否确实要继续连接 (yes/no)? yes

警告:已向已知主机的列表中永久添加 "rac2,143.168.1.134"(RSA)。

口令:

-bash-3.00$scp ~/.ssh/authorized_keys rac2:~/.ssh/authorized_keys

口令:

authorized_keys      100%|*********************************************************************************|  1865      00:00

-bash-3.00$scp ~/.ssh/authorized_keys rac1:~/.ssh/authorized_keys

authorized_keys      100%|*********************************************************************************|  1865      00:00 

 

rac2

-bash-3.00$ssh rac1 cat ~/.ssh/id_dsa.pub >>~/.ssh/authorized_keys

主机 'rac1 (143.168.1.133)' 的真实性无法建立.

 RSA 密钥指纹是43:9a:06:6c:0f:9f:c1:f7:2e:d4:d6:20:32:39:c4:4f。

是否确实要继续连接 (yes/no)? yes

警告:已向已知主机的列表中永久添加 "rac1,143.168.1.133"(RSA)。

-bash-3.00$ssh rac2 cat ~/.ssh/id_dsa.pub >>~/.ssh/authorized_keys

主机 'rac2 (143.168.1.134)' 的真实性无法建立.

 RSA 密钥指纹是43:9a:06:6c:0f:9f:c1:f7:2e:d4:d6:20:32:39:c4:4f。

是否确实要继续连接 (yes/no)? yes

警告:已向已知主机的列表中永久添加 "rac2,143.168.1.134"(RSA)。

-bash-3.00$scp ~/.ssh/authorized_keys rac2:~/.ssh/authorized_keys

authorized_keys      100% |*********************************************************************************|  3067      00:00   

-bash-3.00$scp ~/.ssh/authorized_keys rac1:~/.ssh/authorized_keys

authorized_keys      100%|*********************************************************************************|  3067       00:00  

 

 

在两节点上执行,以验证SSH配置是否正确

ssh rac1date

sshrac1.myhosts.com date

ssh rac2date

sshrac2.myhosts.com date

sshrac1-priv date

sshrac2-priv date

如果均不要求输入口令,则SSH等效配置正确

 

5.3、配置CRS存储

以root用户在rac1上执行

-bash-3.00#format

Searchingfor disks...done

 

 

AVAILABLE DISK SELECTIONS:

      0. c0d0 <DEFAULT cyl 2607 alt 2 hd 255 sec 63>

         /pci@0,0/pci-ide@7,1/ide@0/cmdk@0,0

      1. c2t1d0 <DEFAULT cyl 253 alt 2 hd 64 sec 32>

         /pci@0,0/pci1000,30@11/sd@1,0

      2. c2t2d0 <DEFAULT cyl 253 alt 2 hd 64 sec 32>

         /pci@0,0/pci1000,30@11/sd@2,0

      3. c2t3d0 <DEFAULT cyl 2045 alt 2 hd 128 sec 32>

         /pci@0,0/pci1000,30@11/sd@3,0

Specify disk (enter its number): 1

selecting c2t1d0

[disk formatted]

 

 

FORMAT MENU:

       disk       - select a disk

       type       - select (define) adisk type

       partition  - select (define) apartition table

       current    - describe the currentdisk

       format     - format and analyzethe disk

       fdisk      - run the fdisk program

       repair     - repair a defectivesector

       label      - write label to thedisk

       analyze    - surface analysis

       defect     - defect listmanagement

       backup     - search for backuplabels

       verify     - read and displaylabels

        save      - save new disk/partition definitions

       inquiry    - show vendor, productand revision

       volname    - set 8-charactervolume name

       !<cmd>     - execute<cmd>, then return

       quit

format> fdisk

No fdisk table exists. The defaultpartition for the disk is:

 

  a100% "SOLARIS System" partition

 

Type "y" to accept the defaultpartition,  otherwise type "n"to edit the

 partition table.

y

format> p

 

 

PARTITION MENU:

       0      - change `0' partition

       1      - change `1' partition

       2      - change `2' partition

       3      - change `3' partition

       4      - change `4' partition

       5      - change `5' partition

       6      - change `6' partition

       7      - change `7' partition

       select - select a predefined table

       modify - modify a predefined partition table

       name   - name the current table

       print  - display the current table

       label  - write partition map andlabel to the disk

       !<cmd> - execute <cmd>, then return

       quit

partition> p

Current partition table (original):

Total disk cylinders available: 252 + 2(reserved cylinders)

 

Part     Tag    Flag     Cylinders       Size            Blocks

  0unassigned    wm       0              0         (0/0/0)       0

  1unassigned    wm       0              0         (0/0/0)        0

 2     backup    wu      0 - 251      252.00MB    (252/0/0) 516096

  3unassigned    wm       0              0         (0/0/0)        0

  4unassigned    wm       0             0         (0/0/0)        0

  5unassigned    wm       0              0         (0/0/0)        0

  6unassigned    wm       0              0         (0/0/0)        0

  7unassigned    wm       0              0         (0/0/0)        0

 8       boot    wu      0 -   0        1.00MB    (1/0/0)    2048

  9unassigned    wm       0              0         (0/0/0)        0

 

partition> 1

Part     Tag    Flag     Cylinders       Size            Blocks

  1unassigned    wm       0              0         (0/0/0)       0

 

Enter partition id tag[unassigned]:

Enter partition permission flags[wm]:

Enter new starting cyl[0]: 10

Enter partition size[0b, 0c, 10e, 0.00mb,0.00gb]: 160mb

partition> label

Ready to label disk, continue? y

 

partition> p

Current partition table (unnamed):

Total disk cylinders available: 252 + 2(reserved cylinders)

 

Part     Tag    Flag     Cylinders       Size            Blocks

  0unassigned    wm       0              0         (0/0/0)        0

  1unassigned    wm      10 - 169      160.00MB    (160/0/0) 327680

 2     backup    wu      0 - 251      252.00MB    (252/0/0) 516096

  3unassigned    wm       0              0         (0/0/0)        0

  4unassigned    wm       0              0         (0/0/0)        0

  5unassigned    wm       0              0         (0/0/0)        0

  6unassigned    wm       0              0         (0/0/0)        0

  7unassigned    wm       0              0         (0/0/0)        0

 8       boot    wu      0 -   0        1.00MB    (1/0/0)    2048

  9unassigned    wm       0              0         (0/0/0)        0

 

partition> q

 

 

FORMAT MENU:

       disk       - select a disk

       type       - select (define) adisk type

       partition  - select (define) apartition table

       current    - describe the currentdisk

       format     - format and analyzethe disk

       fdisk      - run the fdisk program

       repair     - repair a defectivesector

       label      - write label to thedisk

       analyze    - surface analysis

       defect     - defect listmanagement

       backup     - search for backuplabels

       verify     - read and displaylabels

       save       - save newdisk/partition definitions

       inquiry    - show vendor, productand revision

       volname    - set 8-charactervolume name

       !<cmd>     - execute<cmd>, then return

       quit

format> disk 2

selecting c2t2d0

[disk formatted]

format> fdisk

No fdisk table exists. The defaultpartition for the disk is:

 

  a100% "SOLARIS System" partition

 

Type "y" to accept the defaultpartition,  otherwise type "n"to edit the

 partition table.

y

format> p

 

 

PARTITION MENU:

       0      - change `0' partition

       1      - change `1' partition

       2      - change `2' partition

       3      - change `3' partition

       4      - change `4' partition

       5      - change `5' partition

       6      - change `6' partition

       7      - change `7' partition

       select - select a predefined table

       modify - modify a predefined partition table

       name   - name the current table

       print  - display the current table

       label  - write partition map andlabel to the disk

       !<cmd> - execute <cmd>, then return

       quit

partition> 1

Part     Tag    Flag     Cylinders      Size            Blocks

  1unassigned    wm       0              0         (0/0/0)        0

 

Enter partition id tag[unassigned]:

Enter partition permission flags[wm]:

Enter new starting cyl[0]: 10

Enter partition size[0b, 0c, 10e, 0.00mb,0.00gb]: 160mb

partition> label

Ready to label disk, continue? y

 

partition> p

Current partition table (unnamed):

Total disk cylinders available: 252 + 2(reserved cylinders)

 

Part     Tag    Flag     Cylinders       Size            Blocks

  0unassigned    wm       0              0         (0/0/0)        0

  1unassigned    wm      10 - 169      160.00MB    (160/0/0) 327680

 2     backup    wu      0 - 251      252.00MB    (252/0/0) 516096

  3unassigned    wm       0              0         (0/0/0)        0

  4unassigned    wm       0              0         (0/0/0)        0

  5unassigned    wm       0              0         (0/0/0)        0

  6unassigned    wm       0              0         (0/0/0)        0

  7unassigned    wm       0              0         (0/0/0)        0

 8       boot    wu      0 -   0        1.00MB    (1/0/0)    2048

  9unassigned    wm       0              0         (0/0/0)        0

 

partition>

partition> q

 

 

FORMAT MENU:

       disk       - select a disk

       type       - select (define) a disk type

       partition  - select (define) apartition table

       current    - describe the currentdisk

       format     - format and analyzethe disk

       fdisk      - run the fdisk program

       repair     - repair a defectivesector

       label      - write label to thedisk

       analyze    - surface analysis

       defect     - defect listmanagement

       backup     - search for backuplabels

       verify     - read and displaylabels

       save       - save newdisk/partition definitions

       inquiry    - show vendor, productand revision

       volname    - set 8-charactervolume name

       !<cmd>     - execute<cmd>, then return

       quit

format> disk 3

selecting c2t3d0

[disk formatted]

format> fdisk

No fdisk table exists. The defaultpartition for the disk is:

 

  a100% "SOLARIS System" partition

 

Type "y" to accept the defaultpartition,  otherwise type "n"to edit the

 partition table.

y

format> p

 

 

PARTITION MENU:

       0      - change `0' partition

       1      - change `1' partition

       2      - change `2' partition

       3      - change `3' partition

       4      - change `4' partition

       5      - change `5' partition

       6      - change `6' partition

       7      - change `7' partition

       select - select a predefined table

       modify - modify a predefined partition table

       name   - name the current table

       print  - display the current table

       label  - write partition map andlabel to the disk

       !<cmd> - execute <cmd>, then return

       quit

partition> p

Current partition table (original):

Total disk cylinders available: 2044 + 2(reserved cylinders)

 

Part     Tag    Flag     Cylinders        Size            Blocks

  0unassigned    wm       0               0         (0/0/0)          0

  1unassigned    wm       0               0         (0/0/0)          0

 2     backup    wu      0 - 2043        3.99GB    (2044/0/0) 8372224

  3unassigned    wm       0               0         (0/0/0)          0

  4unassigned    wm       0               0         (0/0/0)          0

  5unassigned    wm       0               0         (0/0/0)          0

  6unassigned    wm       0               0         (0/0/0)          0

  7unassigned    wm       0               0         (0/0/0)          0

 8       boot    wu      0 -    0        2.00MB    (1/0/0)       4096

  9unassigned    wm       0               0         (0/0/0)          0

 

partition> 1

Part     Tag    Flag     Cylinders        Size           Blocks

  1unassigned    wm       0               0         (0/0/0)          0

 

Enter partition id tag[unassigned]:

Enter partition permission flags[wm]:

Enter new starting cyl[0]: 10

Enter partition size[0b, 0c, 10e, 0.00mb,0.00gb]: 3584mb

partition> label

Ready to label disk, continue? y

 

partition> p

Current partition table (unnamed):

Total disk cylinders available: 2044 + 2(reserved cylinders)

 

Part     Tag    Flag     Cylinders        Size            Blocks

  0unassigned    wm       0               0         (0/0/0)          0

  1unassigned    wm      10 - 1801        3.50GB    (1792/0/0) 7340032

 2     backup    wu      0 - 2043        3.99GB    (2044/0/0) 8372224

  3unassigned    wm       0               0         (0/0/0)          0

  4unassigned    wm       0               0         (0/0/0)          0

  5unassigned    wm       0               0         (0/0/0)          0

  6unassigned    wm       0               0         (0/0/0)          0

  7unassigned    wm       0              0         (0/0/0)          0

 8       boot    wu      0 -    0        2.00MB    (1/0/0)       4096

  9unassigned    wm       0               0         (0/0/0)          0

 

partition> q

 

 

FORMAT MENU:

       disk       - select a disk

       type       - select (define) a disk type

       partition  - select (define) apartition table

       current    - describe the currentdisk

       format     - format and analyzethe disk

       fdisk      - run the fdisk program

       repair     - repair a defectivesector

       label      - write label to thedisk

       analyze    - surface analysis

       defect     - defect listmanagement

       backup     - search for backuplabels

       verify     - read and displaylabels

       save       - save newdisk/partition definitions

       inquiry    - show vendor, productand revision

       volname    - set 8-charactervolume name

       !<cmd>     - execute<cmd>, then return

       quit

format> q

 

 

5.4、用DD命令初始化RAW

-bash-3.00# dd if=/dev/zero of=/dev/rdsk/c2t1d0s1bs=167772160 count=1

1+0 记录进入

1+0 记录调出

-bash-3.00# dd if=/dev/zero of=/dev/rdsk/c2t2d0s1bs=167772160 count=1

1+0 记录进入

1+0 记录调出

 

 

-bash-3.00# chown -RL oracle:oinstall/dev/rdsk/c2t1d0s1

-bash-3.00# chown -RL oracle:oinstall/dev/rdsk/c2t2d0s1

-bash-3.00# chown -RL oracle:oinstall/dev/rdsk/c2t3d0s1

-bash-3.00# chmod 777 /dev/rdsk/c2t1d0s1

-bash-3.00# chmod 777 /dev/rdsk/c2t2d0s1

-bash-3.00# chmod 777 /dev/rdsk/c2t3d0s1

 

 

在两个节点上以root用户执行

-bash-3.00# mkdir -p /export/home/oracle/CRS

-bash-3.00# chown -RL oracle:oinstall/export/home/oracle/CRS

-bash-3.00# chmod 777/export/home/oracle/CRS

-bash-3.00# ln -s /dev/rdsk/c2t1d0s1/export/home/oracle/CRS/ocr

-bash-3.00# ln -s /dev/rdsk/c2t2d0s1/export/home/oracle/CRS/voting

 

 

六、安装Oracle Cluster 软件

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

RAC1:

-bash-3.00#/export/home/oracle/product/oraInventory/orainstRoot.sh

更改权限/export/home/oracle/product/oraInventory到 770.

更改组名/export/home/oracle/product/oraInventory到 oinstall.

脚本的执行已完成

 

RAC2:

-bash-3.00#/export/home/oracle/product/oraInventory/orainstRoot.sh

更改权限/export/home/oracle/product/oraInventory到 770.

更改组名/export/home/oracle/product/oraInventory到 oinstall.

脚本的执行已完成

 

RAC1:

-bash-3.00#/export/home/oracle/product/crs_1/root.sh

 

注意:在脚本执行的时候,查看$ORA_CRS_HOME/log/rac1/alertrac1.log日志,如果出现如下错误:

-bash-3.00# catalertrac1.log

2010-05-27 22:44:53.695

[client(2905)]CRS-1006:TheOCR location /export/home/oracle/CRS/ocr is inaccessible. Details in/export/home/oracle/product/crs_1/log/rac1/client/ocrconfig_2905.log.

2010-05-27 22:44:53.770

[client(2905)]CRS-1006:TheOCR location /export/home/oracle/CRS/ocr is inaccessible. Details in/export/home/oracle/product/crs_1/log/rac1/client/ocrconfig_2905.log.

2010-05-27 22:44:53.774

[client(2905)]CRS-1006:TheOCR location /export/home/oracle/CRS/ocr is inaccessible. Details in/export/home/oracle/product/crs_1/log/rac1/client/ocrconfig_2905.log.

2010-05-27 22:44:54.073

[client(2905)]CRS-1001:TheOCR was formatted using version 2.

 

立即中断执行中的脚本,并执行$ORA_CRS_HOME/install/rootdelete.sh脚本

然后删除宿主机共享网磁盘目录下的。OCR.vmdk.RESLCKVOTE.vmdk.RESLCK文件。

删除后,重新执行/export/home/oracle/product/crs_1/root.sh脚本。问题可解决。

 

RAC1:

-bash-3.00#/export/home/oracle/product/crs_1/root.sh

WARNING: directory'/export/home/oracle/product' is not owned by root

WARNING: directory '/export/home/oracle' isnot owned by root

Checking to see if Oracle CRS stack isalready configured

 

Setting the permissions on OCR backupdirectory

Setting up NS directories

Oracle Cluster Registry configurationupgraded successfully

WARNING: directory'/export/home/oracle/product' is not owned by root

WARNING: directory '/export/home/oracle' isnot owned by root

clscfg: EXISTING configuration version 3detected.

clscfg: version 3 is 10G Release 2.

Successfully accumulated necessary OCRkeys.

Using ports: CSS=49895 CRS=49896 EVMC=49898and EVMR=49897.

node <nodenumber>: <nodename><private interconnect name> <hostname>

node 1: rac1 rac1-priv rac1

node 2: rac2 rac2-priv rac2

clscfg: Arguments check out successfully.

 

NO KEYS WERE WRITTEN. Supply -forceparameter to override.

-force is destructive and will destroy anyprevious cluster

configuration.

Oracle Cluster Registry for cluster hasalready been initialized

Startup will be queued to init within 30seconds.

Adding daemons to inittab

Expecting the CRS daemons to be up within600 seconds.

CSS is active on these nodes.

       rac1

CSS is inactive on these nodes.

       rac2

Local node checking complete.

Run root.sh on remaining nodes to start CRSdaemons.

 

 

RAC2:

-bash-3.00#/export/home/oracle/product/crs_1/root.sh

WARNING: directory'/export/home/oracle/product' is not owned by root

WARNING: directory '/export/home/oracle' isnot owned by root

Checking to see if Oracle CRS stack isalready configured

 

Setting the permissions on OCR backupdirectory

Setting up NS directories

Oracle Cluster Registry configurationupgraded successfully

WARNING: directory'/export/home/oracle/product' is not owned by root

WARNING: directory '/export/home/oracle' isnot owned by root

clscfg: EXISTING configuration version 3detected.

clscfg: version 3 is 10G Release 2.

Successfully accumulated necessary OCRkeys.

Using ports: CSS=49895 CRS=49896 EVMC=49898and EVMR=49897.

node <nodenumber>: <nodename><private interconnect name> <hostname>

node 1: rac1 rac1-priv rac1

node 2: rac2 rac2-priv rac2

clscfg: Arguments check out successfully.

 

NO KEYS WERE WRITTEN. Supply -forceparameter to override.

-force is destructive and will destroy anyprevious cluster

configuration.

Oracle Cluster Registry for cluster hasalready been initialized

Startup will be queued to init within 30seconds.

Adding daemons to inittab

Expecting the CRS daemons to be up within600 seconds.

CSS is active on these nodes.

       rac1

       rac2

CSS is active on all nodes.

Waiting for the Oracle CRSD and EVMD tostart

Waiting for the Oracle CRSD and EVMD tostart

Waiting for the Oracle CRSD and EVMD tostart

Oracle CRS stack installed and runningunder init(1M)

Running vipca(silent) for configuringnodeapps

 

在 (2) 节点上创建 VIP 应用程序资源...

在 (2) 节点上创建 GSD 应用程序资源...

在 (2) 节点上创建 ONS 应用程序资源...

启动 (2) 节点上的 VIP 应用程序资源 ...

启动 (2) 节点上的 GSD 应用程序资源...

启动 (2) 节点上的 ONS 应用程序资源...

 

 

Done.

-bash-3.00#

 

 

 

 

在任意节点执行:

-bash-3.00$ crs_stat -t

Name           Type           Target    State    Host        

------------------------------------------------------------

ora.rac1.gsd   application    ONLINE   ONLINE    rac1       

ora.rac1.ons   application    ONLINE   ONLINE    rac1       

ora.rac1.vip   application    ONLINE   ONLINE    rac1       

ora.rac2.gsd   application    ONLINE   ONLINE    rac2       

ora.rac2.ons   application    ONLINE   ONLINE    rac2       

ora.rac2.vip   application    ONLINE   ONLINE    rac2

 

 

 

七、安装Oracle Database 软件

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Rac1:

-bash-3.00#/export/home/oracle/product/db_1/root.sh

Running Oracle 10g root.sh script...

 

The following environment variables are setas:

   ORACLE_OWNER= oracle

   ORACLE_HOME= /export/home/oracle/product/db_1

 

Enter the full pathname of the local bindirectory: [/usr/local/bin]:

  Copying dbhome to /usr/local/bin ...

  Copying oraenv to /usr/local/bin ...

  Copying coraenv to /usr/local/bin ...

 

 

Creating /var/opt/oracle/oratab file...

Entries will be added to the/var/opt/oracle/oratab file as needed by

Database Configuration Assistant when adatabase is created

Finished running generic part of root.shscript.

Now product-specific root actions will beperformed.

 

-bash-3.00#

 

 

Rac2:

-bash-3.00#/export/home/oracle/product/db_1/root.sh

Running Oracle 10g root.sh script...

 

The following environment variables are setas:

   ORACLE_OWNER= oracle

   ORACLE_HOME= /export/home/oracle/product/db_1

 

Enter the full pathname of the local bindirectory: [/usr/local/bin]:

  Copying dbhome to /usr/local/bin ...

  Copying oraenv to /usr/local/bin ...

  Copying coraenv to /usr/local/bin ...

 

 

Creating /var/opt/oracle/oratab file...

Entries will be added to the/var/opt/oracle/oratab file as needed by

Database Configuration Assistant when adatabase is created

Finished running generic part of root.shscript.

Now product-specific root actions will beperformed.

 

-bash-3.00#

 

 

 

 

八、配置监听

 

-bash-3.00# netca

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

-bash-3.00$ crs_stat -t

Name           Type           Target    State    Host       

------------------------------------------------------------

ora....C1.lsnr application    ONLINE   ONLINE    rac1       

ora.rac1.gsd   application    ONLINE   ONLINE    rac1       

ora.rac1.ons   application    ONLINE   ONLINE    rac1        

ora.rac1.vip   application    ONLINE   ONLINE    rac1       

ora....C2.lsnr application    ONLINE   ONLINE    rac2       

ora.rac2.gsd   application    ONLINE   ONLINE    rac2       

ora.rac2.ons   application    ONLINE   ONLINE    rac2        

ora.rac2.vip   application    ONLINE   ONLINE    rac2 

 

 

九、安装配置数据库

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

-bash-3.00$ crs_stat -t

名称           类型           目标      状态      主机       

------------------------------------------------------------

ora.dbnode.db  application   ONLINE    ONLINE    rac1       

ora....e1.inst application    ONLINE   ONLINE    rac1       

ora....e2.inst application    ONLINE   ONLINE    rac2       

ora....SM1.asm application    ONLINE   ONLINE    rac1       

ora....C1.lsnr application    ONLINE   ONLINE    rac1       

ora.rac1.gsd   application    ONLINE   ONLINE    rac1       

ora.rac1.ons   application    ONLINE   ONLINE    rac1       

ora.rac1.vip   application    ONLINE   ONLINE    rac1       

ora....SM2.asm application    ONLINE   ONLINE    rac2       

ora....C2.lsnr application    ONLINE   ONLINE    rac2       

ora.rac2.gsd   application    ONLINE   ONLINE    rac2       

ora.rac2.ons   application    ONLINE   ONLINE    rac2       

ora.rac2.vip   application    ONLINE   ONLINE    rac2       

-bash-3.00$

 

-bash-3.00$ sqlplus /nolog

 

SQL*Plus: Release 10.2.0.2.0- Production on 星期六 5月 29 21:03:45 2010

 

Copyright (c) 1982, 2005, Oracle.  All Rights Reserved.

 

SQL> conn /as sysdba

已连接。

SQL> select name,dbid,open_mode fromv$database;

 

NAME            DBID OPEN_MODE

--------- ---------- ----------

DBNODE   3134013982 READ WRITE

SQL>

 

    EMPNO ENAME      JOB              MGR HIREDATE              SAL       COMM    DEPTNO

---------- ---------- --------- ------------------------ ---------- ---------- ----------

     7369 SMITH      CLERK           7902 17-12月-80            800                    20

     7499 ALLEN      SALESMAN        7698 20-2月 -81           1600        300         30

     7521 WARD       SALESMAN        7698 22-2月 -81           1250        500         30

     7566 JONES      MANAGER         7839 02-4月 -81           2975                    20

     7654 MARTIN     SALESMAN        7698 28-9月 -81           1250       1400         30

     7698 BLAKE      MANAGER         7839 01-5月 -81           2850                    30

     7782 CLARK      MANAGER         7839 09-6月 -81           2450                    10

     7788 SCOTT      ANALYST         7566 19-4月 -87           3000                    20

     7839 KING       PRESIDENT            17-11月-81           5000                    10

     7844 TURNER     SALESMAN        7698 08-9月 -81           1500          0         30

     7876 ADAMS      CLERK           7788 23-5月 -87           1100                    20

 

    EMPNO ENAME      JOB              MGR HIREDATE              SAL       COMM    DEPTNO

---------- ---------- --------- ------------------------ ---------- ---------- ----------

     7900 JAMES      CLERK           7698 03-12月-81            950                    30

     7902 FORD       ANALYST         7566 03-12月-81           3000                    20

     7934 MILLER     CLERK           7782 23-1月 -82           1300                    10

 

已选择14行。

 

SQL> show parameter name;

 

NAME                                 TYPE        VALUE

----------------------------------------------- ------------------------------

db_file_name_convert                 string

db_name                              string      dbnode

db_unique_name                       string      dbnode

global_names                         boolean     FALSE

instance_name                        string      dbnode1

lock_name_space                      string

log_file_name_convert                string

service_names                        string      dbnode

 

 

SQL> show parameter name

 

NAME                                 TYPE        VALUE

----------------------------------------------- ------------------------------

db_file_name_convert                 string

db_name                              string      dbnode

db_unique_name                       string      dbnode

global_names                         boolean     FALSE

instance_name                        string      dbnode2

lock_name_space                      string

log_file_name_convert                string

service_names                        string      dbnode