分类: Oracle
2011-02-22 16:46:08
主要介绍一下srvctl和crs命令
srvctl 命令
[oracle@rac1 ~]$ srvctl -h
Usage: srvctl [-V]
Usage: srvctl add database -d
Usage: srvctl add instance -d
Usage: srvctl add service -d
Usage: srvctl add service -d
Usage: srvctl add nodeapps -n
Usage: srvctl add asm -n
Usage: srvctl config database
Usage: srvctl config database -d
Usage: srvctl config service -d
Usage: srvctl config nodeapps -n
Usage: srvctl config asm -n
Usage: srvctl config listener -n
Usage: srvctl disable database -d
Usage: srvctl disable instance -d
Usage: srvctl disable service -d
Usage: srvctl disable asm -n
Usage: srvctl enable database -d
Usage: srvctl enable instance -d
Usage: srvctl enable service -d
Usage: srvctl enable asm -n
Usage: srvctl getenv database -d
Usage: srvctl getenv instance -d
Usage: srvctl getenv service -d
Usage: srvctl getenv nodeapps -n
Usage: srvctl modify database -d
Usage: srvctl modify instance -d
Usage: srvctl modify instance -d
Usage: srvctl modify service -d
Usage: srvctl modify service -d
Usage: srvctl modify service -d
Usage: srvctl modify asm -n
Usage: srvctl relocate service -d
Usage: srvctl remove database -d
Usage: srvctl remove instance -d
Usage: srvctl remove service -d
Usage: srvctl remove nodeapps -n "
Usage: srvctl remove asm -n
Usage: srvctl setenv database -d
Usage: srvctl setenv instance -d
Usage: srvctl setenv service -d
Usage: srvctl setenv nodeapps -n
Usage: srvctl start database -d
Usage: srvctl start instance -d
Usage: srvctl start service -d
Usage: srvctl start nodeapps -n
Usage: srvctl start asm -n
Usage: srvctl start listener -n
Usage: srvctl status database -d
Usage: srvctl status instance -d
Usage: srvctl status service -d
Usage: srvctl status nodeapps -n
Usage: srvctl status asm -n
Usage: srvctl stop database -d
Usage: srvctl stop instance -d
Usage: srvctl stop service -d
Usage: srvctl stop nodeapps -n
Usage: srvctl stop asm -n
Usage: srvctl stop listener -n
Usage: srvctl unsetenv database -d
Usage: srvctl unsetenv instance -d
Usage: srvctl unsetenv service -d
Usage: srvctl unsetenv nodeapps -n
从上我们可以看到 srvctl 这个命令工具很强大,可以操作 database, instance ,asm ,service , listener,nodeapps (gsd,vip ,ons)这些资源
1.通过srvctl命令来start/stop/check所有的实例
$srvctl start|stop|status database -d rac1
[oracle@rac1 ~]$ srvctl status database -d testrac
Instance testrac1 is running on node rac1
Instance testrac2 is running on node rac2
2.start/stop 指定的实例
$srvctl start |stop |status instance -d
[oracle@rac1 ~]$ srvctl status instance -d testrac -i testrac1
Instance testrac1 is running on node rac1
3.列出当前rac下所有的
$ srvctl config database -d
[oracle@rac1 ~]$ srvctl config database -d testrac
rac1 testrac1 /u01/product/database
rac2 testrac2 /u01/product/database
4.start/stop/check 所有的nodeapps,比如:VIP, GSD, listener, ONS:
$ srvctl start|stop|status nodeapps -n
[oracle@rac1 ~]$ srvctl status nodeapps -n rac1
VIP is running on node: rac1
GSD is running on node: rac1
Listener is running on node: rac1
ONS daemon is running on node: rac1
5.srvctl也可以start/stop ASM实例:
$ srvctl start|stop asm -n
[oracle@rac1 ~]$ srvctl start asm -n rac1
6.获取所有的环境信息
$ srvctl getenv database -d
7.设置全局环境变量:
$ srvctl setenv database -d
8.从OCR中删除已有的数据库:
$ srvctl remove database -d
9.向OCR中添加一个数据库:
$ srvctl add database -d
10.向OCR中添加一个数据库的实例:
$ srvctl add instance -d
11.向OCR中添加一个ASM实例:
$ srvctl add asm -n
12.添加一个service
$ srvctl add service -d
13.修改在其他节点上的service(修改的是配置,此时使用的实例不变)
$ srvctl modify service -d
14.relocate 某个节点的service到其他节点(当taf转到avail实例上后,又想转到pre的实例上,用relocate)
srvctl relocate service -d
crs 命令
1.查看状态的命令
Usage: crs_stat [resource_name [...]] [-v] [-l] [-q] [-c cluster_member]
crs_stat [resource_name [...]] -t [-v] [-q] [-c cluster_member]
crs_stat -p [resource_name [...]] [-q]
crs_stat [-a] application -g
crs_stat [-a] application -r [-c cluster_member]
crs_stat -f [resource_name [...]] [-q] [-c cluster_member]
crs_stat -ls [resource_name [...]] [-q]
$crs_stat -t 查看crs及所有的service的状态
[oracle@rac1 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
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
ora.testrac.db application ONLINE ONLINE rac1
ora....c1.inst application ONLINE ONLINE rac1
ora....c2.inst application ONLINE ONLINE rac2
2.crsctl check crs 检查CRS相关服务状态
[oracle@rac1 ~]$ crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy
3.启动和关闭命令
$ crs_start –all --启动所有的crs服务
$ crs_stop –all --停止所有的crs服务
$ crsctl start crs --启动crs服务
$ crsctl stop crs --停止crs服务
$ srvctl start nodeapps -n rac1(rac2) --启动某节点上所有的应用
$ srvctl stop nodeapps -n rac1(rac2) --停止某节点上所有的应用
$ srvctl start listener -n rac1(rac2) --启动某个节点的listener
$ srvctl stop listener -n rac1(rac2) --停止某个节点的listener
$ srvctl start instance –d db –i rac1(rac2) --启动某个instance
$ srvctl stop instance –d db –i rac1(rac2) --停止某个instance
$ srvctl start database –d db --启动数据库
$ srvctl stop database –d db --停止数据库
chinaunix网友2011-03-06 17:27:33
很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com