先看Oracle 官方文档上的两段说明:
(1)Can I change the public hostname in my Oracle Database 10g Cluster using Oracle Clusterware?
Hostname changes are not supported in Oracle Clusterware (CRS), unless you want to perform a deletenode followed by a new addnode operation.
The hostname is used to store among other things the flag files and Oracle Clusterware stack will not start if hostname is changed.
(2)Does the hostname have to match the public name or can it be anything else?
When there is no vendor clusterware, only Oracle Clusterware, then the public node name must match the host name. When vendor clusterware is present, it determines the public node names, and the installer doesn't present an opportunity to change them. So, when you have a choice, always choose the hostname.
From: Metalink Note 220970.1 RAC Frequently Asked Questions:
根据官网上的这2段文字,我们可以看出2点:
(1). RAC 环境一旦安装好后, 主机名就不能修改,除非先删除节点,修改Hostname, 在添加节点。
(2). 主机名必须和public 名一致。这一点在安装文档中有特别强调。
在Oracle 的Metalink 上没有找到相关的修改方法,除了上面提到的删除节点在添加节点。 其实还有一种很简单的方法,就是重新运行CRS的配置文件(/u01/app/oracle/product/crs/install/rootconfig),重新格式化OCR和Voting disk,然后重新创建CRS的资源。
这些操作需要先关闭CRS。 所以在生产库上,一般不会去做这样的操作。 生产系统维护稳定第一。 但作为一个知识点,我们可以学习一下。
测试平台:Redhat 5.4 + Multipath + RAW + ASM + Oracle 10gR2
相关操作如下:
一. 停止CRS
使用$ORA_CRS_HOME/bin/crsctl stop crs 命令即可。
执行完该命令后, 所有的database,listeners,和其他注册在CRS里的resource都将停止。
二. 修改主机名
原来的主机名:
[root@rac1 bin]# hostname
rac1
[root@rac2 bin]# hostname
rac2
将主机名修改为racdb1 和 racdb2。
在节点1修改成如下:
[root@rac1 bin]# hostname racdb1
[root@rac1 bin]# hostname
racdb1
[root@rac1 bin]# cat /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=racdb1
GATEWAY=192.168.6.254
[root@rac1 bin]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost
# Public Network - (eth0)
192.168.6.223 racdb1
192.168.6.226 racdb2
# Private Interconnect - (eth1)
192.168.6.224 racdb1-priv
192.168.6.227 racdb2-priv
# Public Virtual IP (VIP) addresses - (eth0:1)
192.168.6.225 racdb1-vip
192.168.6.228 racdb2-vip
在节点2与节点1一样。
三. 修改 $ORA_CRS_HOME/install/rootconfig
当我们安装完Clusterware的时候,需要执行root.sh 脚本, 该脚本就会调用$ORA_CRS_HOME/install/rootconfig。 当我们修改了hostname时,也必须修改这个脚本。 然后重新执行一次。
[root@rac1 install]# cat rootconfig
#!/bin/sh
SILENT=false
ORA_CRS_HOME=/u01/app/oracle/product/crs
CRS_ORACLE_OWNER=oracle
CRS_DBA_GROUP=oinstall
CRS_VNDR_CLUSTER=false
CRS_OCR_LOCATIONS=/dev/raw/raw1,/dev/raw/raw2
CRS_CLUSTER_NAME=crs
CRS_HOST_NAME_LIST=rac1,1,rac2,2
CRS_NODE_NAME_LIST=rac1,1,rac2,2
CRS_PRIVATE_NAME_LIST=rac1-priv,1,rac2-priv,2
CRS_LANGUAGE_ID='AMERICAN_AMERICA.WE8ISO8859P1'
CRS_VOTING_DISKS=/dev/raw/raw3,/dev/raw/raw4,/dev/raw/raw5
CRS_NODELIST=rac1,rac2
CRS_NODEVIPS='rac1/rac1-vip/255.255.255.0/eth0,rac2/rac2-vip/255.255.255.0/eth0'
....
上面红色部分是我们需要修改的。我们可以手工的一个一个修改。 但是在vi 命令下, 我们意识统一替换掉: :%s/old_node/new_node/g。 如 :%s/rac1/racdb1/g,就可以将所有的rac1替换成racdb1. 这个要方便很多。
在两个节点都做了修改。 修改之后如下:
[root@rac1 install]# vi rootconfig
SILENT=false
ORA_CRS_HOME=/u01/app/oracle/product/crs
CRS_ORACLE_OWNER=oracle
CRS_DBA_GROUP=oinstall
CRS_VNDR_CLUSTER=false
CRS_OCR_LOCATIONS=/dev/raw/raw1,/dev/raw/raw2
CRS_CLUSTER_NAME=crs
CRS_HOST_NAME_LIST=racdb1,1,racdb2,2
CRS_NODE_NAME_LIST=racdb1,1,racdb2,2
CRS_PRIVATE_NAME_LIST=racdb1-priv,1,racdb2-priv,2
CRS_LANGUAGE_ID='AMERICAN_AMERICA.WE8ISO8859P1'
CRS_VOTING_DISKS=/dev/raw/raw3,/dev/raw/raw4,/dev/raw/raw5
CRS_NODELIST=racdb1,racdb2
CRS_NODEVIPS='racdb1/racdb1-vip/255.255.255.0/eth0,racdb2/racdb2-vip/255.255.255.0/eth0'
这里面,我们还可以改变OCR 和Voting disk 的位置, 及clustername。 改变红色的部分就可以了。
四. 清空OCR 和 Voting Disks
这里必须清空它们,不然执行脚本的时候不会格式他们。
[root@rac1 install]# dd if=/dev/zero of=/dev/raw/raw1 bs=1M count=200
dd: writing `/dev/raw/raw1': No space left on device
197+0 records in
196+0 records out
205567488 bytes (206 MB) copied, 11.2629 seconds, 18.3 MB/s
[root@rac1 install]# dd if=/dev/zero of=/dev/raw/raw2 bs=1M count=200
dd: writing `/dev/raw/raw2': No space left on device
197+0 records in
196+0 records out
205599744 bytes (206 MB) copied, 10.7725 seconds, 19.1 MB/s
[root@rac1 install]# dd if=/dev/zero of=/dev/raw/raw3 bs=1M count=200
dd: writing `/dev/raw/raw3': No space left on device
197+0 records in
196+0 records out
205599744 bytes (206 MB) copied, 9.5719 seconds, 21.5 MB/s
[root@rac1 install]# dd if=/dev/zero of=/dev/raw/raw4 bs=1M count=200
dd: writing `/dev/raw/raw4': No space left on device
197+0 records in
196+0 records out
205599744 bytes (206 MB) copied, 9.5757 seconds, 21.5 MB/s
[root@rac1 install]# dd if=/dev/zero of=/dev/raw/raw5 bs=1M count=200
dd: writing `/dev/raw/raw5': No space left on device
197+0 records in
196+0 records out
205599744 bytes (206 MB) copied, 9.34881 seconds, 22.0 MB/s
五. 删除配置信息
rootconfig 脚本会检查Clusterware 是否已经配置,如果已经配置,就不会执行,所以在执行rootconfig之前,我们要写删除这个配置信息。
在Linux 下,删除文件:/etc/oracle/ocr.loc
[root@rac1 install]# rm /etc/oracle/ocr.loc
rm: remove regular file `/etc/oracle/ocr.loc'? y
[root@rac2 bin]# rm /etc/oracle/ocr.loc
rm: remove regular file `/etc/oracle/ocr.loc'? y
Unix下位置不一样,HP-Unix 是:/var/opt/oracle/ocr.log
六. 验证用户等效性
修改主机名后, 用户等效性失效, 密钥在安装时已经写入了相关的文件, 我们这里只需要重新运行下ssh。 验证之后就可以了
在两个节点风别执行:
[oracle@racdb2 ~]$ ssh racdb1 date
[oracle@racdb2 ~]$ ssh racdb2 date
[oracle@racdb2 ~]$ ssh racdb2-priv date
[oracle@racdb2 ~]$ ssh racdb1-priv date
七. 运行 $ORA_CRS_HOME/install/rootconfig
用root 用户分别在2个节点执行。 一个节点一个节点的来。 不要同时执行。 在最后一个节点执行时,会配置VIPs。 这里有一个bug。这里注意一下。
在节点1上执行:
[root@rac1 install]# pwd
/u01/app/oracle/product/crs/install
[root@rac1 install]# ./rootconfig
Checking to see if Oracle CRS stack is already configured
Setting the permissions on OCR backup directory
Setting up NS directories
Oracle Cluster Registry configuration upgraded successfully
WARNING: directory '/u01/app/oracle/product' is not owned by root
WARNING: directory '/u01/app/oracle' is not owned by root
WARNING: directory '/u01/app' is not owned by root
WARNING: directory '/u01' is not owned by root
assigning default hostname racdb1 for node 1.
assigning default hostname racdb2 for node 2.
Successfully accumulated necessary OCR keys.
Using ports: CSS=49895 CRS=49896 EVMC=49898 and EVMR=49897.
node <nodenumber>: <nodename> <private interconnect name> <hostname>
node 1: racdb1 racdb1-priv racdb1
node 2: racdb2 racdb2-priv racdb2
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
Now formatting voting device: /dev/raw/raw3
Now formatting voting device: /dev/raw/raw4
Now formatting voting device: /dev/raw/raw5
Format of 3 voting devices complete.
Startup will be queued to init within 90 seconds.
Adding daemons to inittab
Expecting the CRS daemons to be up within 600 seconds.
CSS is active on these nodes.
racdb1
CSS is inactive on these nodes.
racdb2
Local node checking complete.
Run root.sh on remaining nodes to start CRS daemons.
You have new mail in /var/spool/mail/root
节点1执行完之后,在节点2执行:
[root@rac2 install]# pwd
/u01/app/oracle/product/crs/install
[root@rac2 install]# ./rootconfig
Checking to see if Oracle CRS stack is already configured
Setting the permissions on OCR backup directory
Setting up NS directories
Oracle Cluster Registry configuration upgraded successfully
WARNING: directory '/u01/app/oracle/product' is not owned by root
WARNING: directory '/u01/app/oracle' is not owned by root
WARNING: directory '/u01/app' is not owned by root
WARNING: directory '/u01' is not owned by root
clscfg: EXISTING configuration version 3 detected.
clscfg: version 3 is 10G Release 2.
assigning default hostname racdb1 for node 1.
assigning default hostname racdb2 for node 2.
Successfully accumulated necessary OCR keys.
Using ports: CSS=49895 CRS=49896 EVMC=49898 and EVMR=49897.
node <nodenumber>: <nodename> <private interconnect name> <hostname>
node 1: racdb1 racdb1-priv racdb1
node 2: racdb2 racdb2-priv racdb2
clscfg: Arguments check out successfully.
NO KEYS WERE WRITTEN. Supply -force parameter to override.
-force is destructive and will destroy any previous cluster
configuration.
Oracle Cluster Registry for cluster has already been initialized
Startup will be queued to init within 90 seconds.
Adding daemons to inittab
Expecting the CRS daemons to be up within 600 seconds.
CSS is active on these nodes.
racdb1
racdb2
CSS is active on all nodes.
Waiting for the Oracle CRSD and EVMD to start
Waiting for the Oracle CRSD and EVMD to start
Waiting for the Oracle CRSD and EVMD to start
Waiting for the Oracle CRSD and EVMD to start
Waiting for the Oracle CRSD and EVMD to start
Oracle CRS stack installed and running under init(1M)
Running vipca(silent) for configuring nodeapps
Error 0(Native: listNetInterfaces:[3])
[Error 0(Native: listNetInterfaces:[3])]
这个是老问题了。因为网络接口没有配置好。 我们配置一下接口,在Xmanager里,用root用户,手工运行vipca命令即可。
[root@rac1 bin]# ./oifcfg getif -- 没有返回接口信息
[root@rac1 bin]# ./oifcfg iflist
eth1 192.168.6.0
virbr0 192.168.122.0
eth0 192.168.6.0
[root@rac1 bin]# ./oifcfg setif -global eth0/192.168.6.0:public -- 注意IP 最后是0
[root@rac1 bin]# ./oifcfg setif -global eth1/192.168.6.0:cluster_interconnect
[root@rac1 bin]# ./oifcfg getif -- 验证配置
eth0 192.168.6.0 global public
eth1 192.168.6.0 global cluster_interconnect
[root@rac1 bin]#
配置玩后,随便在一个节点用root用户运行一下vipca命令就可以了。 这个是有窗口的。 需要X 支持。所有用X manager。 其他工具也可以。 能运行就可以了。 执行完后nodeapps的VIP,ONS,GSD就创建完成了。
八. 验证Clusterware
刚才执行玩vipca,检查一下:
[root@rac1 bin]# ./crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.racdb1.gsd application ONLINE ONLINE racdb1
ora.racdb1.ons application ONLINE ONLINE racdb1
ora.racdb1.vip application ONLINE ONLINE racdb1
ora.racdb2.gsd application ONLINE ONLINE racdb2
ora.racdb2.ons application ONLINE ONLINE racdb2
ora.racdb2.vip application ONLINE ONLINE racdb2
ok。这些玩意都是vipca 创建的。
九. 添加Listener Resource到CRS
(1)调用netca命令
在X manager 中运行netca命令。 来重建监听。 netca 会把监听的信息注册到OCR中。
[oracle@rac1 ~]$ mv $TNS_ADMIN/listener.ora /tmp/listener.ora.original
[oracle@rac2 ~]$ mv $TNS_ADMIN/listener.ora /tmp/listener.ora.original
在调用netca,在界面上配置。 都是下一步的操作。 操作完之后,查看一下监听状态。
[root@racdb1 bin]# ./crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....cl1.srv application OFFLINE OFFLINE
ora....B1.lsnr application ONLINE ONLINE racdb1
ora.racdb1.gsd application ONLINE ONLINE racdb1
ora.racdb1.ons application ONLINE ONLINE racdb1
ora.racdb1.vip application ONLINE ONLINE racdb1
ora....B2.lsnr application ONLINE ONLINE racdb2
ora.racdb2.gsd application ONLINE ONLINE racdb2
ora.racdb2.ons application ONLINE ONLINE racdb2
ora.racdb2.vip application ONLINE ONLINE racdb2
之前在OCR的重建中也是采用这种方法的:
Oracle RAC 重建 OCR 和 Voting disk
http://blog.csdn.net/tianlesoftware/archive/2010/12/02/6050606.aspx
(2)检查修改listener.ora 和 tnsnames.ora 文件
[root@rac1 admin]# cat listener.ora
LISTENER_RAC1 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = racdb1-vip)(PORT = 1521)(IP = FIRST))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.6.223)(PORT = 1521)(IP = FIRST))
)
)
SID_LIST_LISTENER_RAC1 =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
)
)
[root@rac1 admin]# cat tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/10.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
LISTENERS_ORCL =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = racdb1-vip)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = racdb2-vip)(PORT = 1521))
)
ORCL2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = racdb2-vip)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
(INSTANCE_NAME = orcl2)
)
)
ORCL1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = racdb1-vip)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
(INSTANCE_NAME = orcl1)
)
)
OLTP =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = racdb1-vip)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = racdb2-vip)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = oltp)
(FAILOVER_MODE =
(TYPE = SELECT)
(METHOD = BASIC)
(RETRIES = 180)
(DELAY = 5)
)
)
)
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = racdb1-vip)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = racdb2-vip)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
十. 添加其他资源到OCR
注意, 注册用的名字和要之前安装的一样。 区分大小写。 用Oracle 用户执行。
ASM
语法:srvctl add asm -n <node_name> -i <asm_instance_name> -o <oracle_home>
[oracle@racdb1 bin]$ srvctl add asm -n racdb1 -i ASM1 -o /u01/app/oracle/product/10.2.0/db_1
[oracle@racdb1 bin]$ srvctl add asm -n racdb2 -i ASM2 -o /u01/app/oracle/product/10.2.0/db_1
注意, 这里没有写+ASM1.
之前写的是+ASM1,但是报错, 把+号去掉就ok了:
[oracle@racdb1 bin]$ srvctl add asm -n racdb1 -i +ASM1 -o /u01/app/oracle/product/10.2.0/db_1
PRKS-1003 : Failed to register CRS resource for ASM instance "+ASM1" on node "racdb1", [CRS-0213: Could not register resource 'ora.racdb1.ASM1.asm'.]
------------------------------- 开始处理ASM 实例启动的问题 -----------------------
在这里遇到了一个非常棘手的问题。 研究了2天。 就是ASM 实例添加之后无法启动。 用srvctl 命令启动会报错。 但是进入用sqlplus 确能启动。 但是查看状态,确实unknown。 而且srvctl 也无法对ASM 进行管理。
在ASM 启动和关闭的时候有如下提示:
PRKS 1009: Failed to start asm interface
unrecoverable failure. Human intervention required
asm 实例的alert log 错误如下:
Starting background process ASMB
ASMB started with pid=17, OS id=14030
Fri Dec 3 11:01:50 2010
NOTE: ASMB process exiting due to lack of ASM file activity
Fri Dec 3 11:12:45 2010
Error: Cluster Synchronization Service is shutting down
Fri Dec 3 11:12:45 2010
Errors in file /u01/app/oracle/admin/+ASM/bdump/+asm1_lmon_13217.trc:
ORA-29746: Cluster Synchronization Service is being shut down.
LMON: terminating instance due to error 29746
Instance terminated by LMON, pid = 13217
[root@racdb1 bin]# ./crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....SM1.asm application ONLINE UNKNOWN racdb1
ora....B1.lsnr application ONLINE ONLINE racdb1
ora.racdb1.gsd application ONLINE ONLINE racdb1
ora.racdb1.ons application ONLINE ONLINE racdb1
ora.racdb1.vip application ONLINE ONLINE racdb1
ora....SM2.asm application ONLINE UNKNOWN racdb2
ora....B2.lsnr application ONLINE ONLINE racdb2
ora.racdb2.gsd application ONLINE ONLINE racdb2
ora.racdb2.ons application ONLINE ONLINE racdb2
ora.racdb2.vip application ONLINE ONLINE racdb2
后来发现RAC 有一个脚本,会测试ASM,它的结果就决定是否启动ASM。
现在来重现一下问题解决的过程:
先看一下ASM Resource 的信息:
[root@racdb1 bin]# ./crs_stat -p ora.racdb1.ASM1.asm
NAME=ora.racdb1.ASM1.asm
TYPE=application
ACTION_SCRIPT=/u01/app/oracle/product/10.2.0/db_1/bin/racgwrap
...
查看一下这个脚本:
[root@racdb1 bin]# tail -10 /u01/app/oracle/product/crs/bin/racgwrap
...
# Set _USR_ORA_DEBUG to enable more tracing
#_USR_ORA_DEBUG=1 && export _USR_ORA_DEBUG
$ORACLE_HOME/bin/racgmain "$@"
status=$?
exit $status
这里面又调用了另一个脚本racgmain, 这个脚本就是关键。
看一下这个脚本的用法:
[oracle@racdb1 bin]$ racgmain -h
Usage racgmain [resource name] start|stop|check
racgmain startorp|failsrvsa dbname instname [srvname]
racgmain cond_resname cond_state func [args...]
所以测试一下:
[oracle@racdb1 bin]$ racgmain ora.racdb1.ASM1.asm start
Could not create subdirectory /u01/app/oracle/product/10.2.0/db_1/log/racdb1/racg/racgmdb reason: Permission deniedracgmdb: Could not make directory /u01/app/oracle/product/10.2.0/db_1/log/racdb1/racg/racgmdb/s0clsrmdb: Could not change current directory2010-12-04 19:49:22
从这个提示结果,我们看到了原因,不能创建目录。 我们看一下这个目录:
[root@racdb1 log]# pwd
/u01/app/oracle/product/10.2.0/db_1/log
[root@racdb1 log]# ll
total 8
drwxr-xr-t 4 oracle oinstall 4096 Dec 1 09:04 rac1
drwxr-xr-t 3 root root 4096 Dec 3 08:32 racdb1
问题找到了。 太兴奋了。 修改之前主机名是rac1. 修改之后,主机名是racdb1. 在看一下2个目录的权限就知道了。 目录的权限不多。 修改一下目录的权限。
[root@racdb1 log]# chown -R oracle:oinstall racdb1
[root@racdb1 log]# ll
total 8
drwxr-xr-t 4 oracle oinstall 4096 Dec 1 09:04 rac1
drwxr-xr-t 3 oracle oinstall 4096 Dec 3 08:32 racdb1
在节点2上也修改一下权限。 在次启动ASM实例:
[root@racdb1 bin]# ./srvctl start asm -n racdb1 -i ASM1
[root@racdb1 bin]# ./srvctl start asm -n racdb2 -i ASM2
[root@racdb1 bin]# ./crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....SM1.asm application ONLINE ONLINE racdb1
ora....B1.lsnr application ONLINE ONLINE racdb1
ora.racdb1.gsd application ONLINE ONLINE racdb1
ora.racdb1.ons application ONLINE ONLINE racdb1
ora.racdb1.vip application ONLINE ONLINE racdb1
ora....SM2.asm application ONLINE ONLINE racdb2
ora....B2.lsnr application ONLINE ONLINE racdb2
ora.racdb2.gsd application ONLINE ONLINE racdb2
ora.racdb2.ons application ONLINE ONLINE racdb2
ora.racdb2.vip application ONLINE ONLINE racdb2
成功启动了。 有种想哭的冲动。搞了2天的时间,就为这个结果。
------------------------------- 结束处理ASM 实例启动的问题 -----------------------
DATABASE
语法:srvctl add database -d <db_unique_name> -o <oracle_home>
[oracle@racdb1 bin]$ srvctl add database -d orcl -o /u01/app/oracle/product/10.2.0/db_1
INSTANCE
语法:srvctl add instance -d <db_unique_name> -i <instance_name> -n <node_name>
[oracle@racdb1 bin]$ srvctl add instance -d orcl -i orcl1 -n racdb1
[oracle@racdb1 bin]$ srvctl add instance -d orcl -i orcl2 -n racdb2
SERVICE
语法:srvctl add service -d <db_unique_name> -s <service_name> -r <preferred_list> -P <TAF_policy>
-r preferred_list 是首先使用的实例的列表,还可是用-a 表示备用实例
TAF_policy可设置为NONE,BASIC,PRECONNECT
[oracle@racdb1 bin]$ srvctl add service -d orcl -s oltp -r orcl1,orcl2 -P BASIC
启动资源并查看结果:
[root@racdb1 bin]# ./srvctl start database -d orcl
[root@racdb1 bin]# ./srvctl start service -h
Usage: srvctl start service -d <name> [-s "<service_name_list>" [-i <inst_name>]] [-o <start_options>] [-c <connect_str> | -q]
-d <name> Unique name for the database
-s "<serv,...>" Comma separated service names
-i <inst> Instance name
-o <start_options> Options to startup command (e.g. open, mount, or nomount)
-c <connstr> Connect string (default: / as sysdba)
-q Query connect string from standard input
-h Print usage
[root@racdb1 bin]# ./srvctl start service -d orcl -s oltp
[root@racdb1 bin]# ./crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.orcl.db application ONLINE ONLINE racdb2
ora....oltp.cs application ONLINE ONLINE racdb1
ora....cl1.srv application ONLINE ONLINE racdb1
ora....cl2.srv application ONLINE ONLINE racdb2
ora....l1.inst application ONLINE ONLINE racdb1
ora....l2.inst application ONLINE ONLINE racdb2
ora....SM1.asm application ONLINE ONLINE racdb1
ora....B1.lsnr application ONLINE ONLINE racdb1
ora.racdb1.gsd application ONLINE ONLINE racdb1
ora.racdb1.ons application ONLINE ONLINE racdb1
ora.racdb1.vip application ONLINE ONLINE racdb1
ora....SM2.asm application ONLINE ONLINE racdb2
ora....B2.lsnr application ONLINE ONLINE racdb2
ora.racdb2.gsd application ONLINE ONLINE racdb2
ora.racdb2.ons application ONLINE ONLINE racdb2
ora.racdb2.vip application ONLINE ONLINE racdb2
全部成功启动。
最后再次强调:
在这里再次强调一下$ORACLE_HOME/bin/racgmain 脚本。它能帮助我们检测OCR里资源能否启动, 并且能给出原因。 这对我们排的错很有帮助。它不管能检查ASM。 还能检测其他资源。 只要资源里调用了racgwrap 这个脚本,我们就可以使用racgmain.
如:
[root@racdb1 bin]# ./crs_stat -p ora.racdb2.gsd
NAME=ora.racdb2.gsd
TYPE=application
ACTION_SCRIPT=/u01/app/oracle/product/crs/bin/racgwrap
[oracle@racdb1 bin]$ racgmain ora.racdb2.gsd start
[oracle@racdb1 bin]$
如果没有提示错误,我们就可以正常启动。 有错误,会提示出来。 这样能帮助我们排查错误。
小结:
实验成功完成了,从这个实验中收获的不仅仅是RAC 环境下主机名的修改, 还学习了一个脚本racgmain. 这个是实验之外的收获。
想起前天DBA群里朋友问我的问题,为什么能坚持下来。 当时我也不清楚,但现在也许清楚了。 假如2天的时间你一直被一个问题所困扰,然后问题突然被你解决了。 不知道你是什么心情。 我是很兴奋,有一种成就感。 这个也许就是一直鼓励我前进的动力。
可能某一天,当你也想做这个实验的时候,恰好看到了这篇文章。可能很顺利的完成了这个实验,但是却体会不到我做这个实验的过程,体会不到这种成就感。
------------------------------------------------------------------------------
Blog: http://blog.csdn.net/tianlesoftware
网上资源: http://tianlesoftware.download.csdn.net
相关视频:http://blog.csdn.net/tianlesoftware/archive/2009/11/27/4886500.aspx
DBA1 群:62697716(满); DBA2 群:62697977(满)
DBA3 群:62697850 DBA 超级群:63306533;
聊天 群:40132017
--加群需要在备注说明Oracle表空间和数据文件的关系,否则拒绝申请