Chinaunix首页 | 论坛 | 博客
  • 博客访问: 261309
  • 博文数量: 54
  • 博客积分: 2668
  • 博客等级: 少校
  • 技术积分: 560
  • 用 户 组: 普通用户
  • 注册时间: 2009-05-06 01:08
文章分类

全部博文(54)

文章存档

2011年(14)

2010年(14)

2009年(26)

分类: Oracle

2011-02-22 16:46:08

主要介绍一下srvctl和crs命令
srvctl 命令
[oracle@rac1 ~]$ srvctl -h
Usage: srvctl [-V]
Usage: srvctl add database -d -o [-m ] [-p ] [-A /netmask] [-r {PRIMARY | PHYSICAL_STANDBY | LOGICAL_STANDBY}] [-s ] [-n ] [-y {AUTOMATIC | MANUAL}]
Usage: srvctl add instance -d -i -n
Usage: srvctl add service -d -s -r "" [-a ""] [-P ]
Usage: srvctl add service -d -s -u {-r "" | -a ""}
Usage: srvctl add nodeapps -n -o -A /netmask[/if1[|if2|...]]
Usage: srvctl add asm -n -i -o [-p ]
Usage: srvctl config database
Usage: srvctl config database -d [-a] [-t]
Usage: srvctl config service -d [-s ] [-a] [-S ]
Usage: srvctl config nodeapps -n [-a] [-g] [-o] [-s] [-l]
Usage: srvctl config asm -n
Usage: srvctl config listener -n
Usage: srvctl disable database -d
Usage: srvctl disable instance -d -i ""
Usage: srvctl disable service -d -s "" [-i ]
Usage: srvctl disable asm -n [-i ]
Usage: srvctl enable database -d
Usage: srvctl enable instance -d -i ""
Usage: srvctl enable service -d -s "" [-i ]
Usage: srvctl enable asm -n [-i ]
Usage: srvctl getenv database -d [-t ""]
Usage: srvctl getenv instance -d -i [-t ""]
Usage: srvctl getenv service -d -s [-t ""]
Usage: srvctl getenv nodeapps -n [-t ""]
Usage: srvctl modify database -d [-n ] [-m ] [-p ]  [-r {PRIMARY | PHYSICAL_STANDBY | LOGICAL_STANDBY}] [-s ] [-y {AUTOMATIC | MANUAL}]
Usage: srvctl modify instance -d -i -n
Usage: srvctl modify instance -d -i {-s | -r}
Usage: srvctl modify service -d -s -i -t [-f]
Usage: srvctl modify service -d -s -i -r [-f]
Usage: srvctl modify service -d -s -n -i [-a ] [-f]
Usage: srvctl modify asm -n -i -p
Usage: srvctl relocate service -d -s -i -t [-f]
Usage: srvctl remove database -d [-f]
Usage: srvctl remove instance -d -i [-f]
Usage: srvctl remove service -d -s [-i ] [-f]
Usage: srvctl remove nodeapps -n "" [-f]
Usage: srvctl remove asm -n [-i ] [-f]
Usage: srvctl setenv database -d {-t =[,=,...] | -T =}
Usage: srvctl setenv instance -d [-i ] {-t "=[,=,...]" | -T "="}
Usage: srvctl setenv service -d [-s ] {-t "=[,=,...]" | -T "="}
Usage: srvctl setenv nodeapps -n {-t "=[,=,...]" | -T "="}
Usage: srvctl start database -d [-o ] [-c | -q]
Usage: srvctl start instance -d -i "" [-o ] [-c | -q]
Usage: srvctl start service -d [-s "" [-i ]] [-o ] [-c | -q]
Usage: srvctl start nodeapps -n
Usage: srvctl start asm -n [-i ] [-o ] [-c | -q]
Usage: srvctl start listener -n [-l ]
Usage: srvctl status database -d [-f] [-v] [-S ]
Usage: srvctl status instance -d -i "" [-f] [-v] [-S ]
Usage: srvctl status service -d [-s ""] [-f] [-v] [-S ]
Usage: srvctl status nodeapps -n
Usage: srvctl status asm -n
Usage: srvctl stop database -d [-o ] [-c | -q]
Usage: srvctl stop instance -d -i "" [-o ] [-c | -q]
Usage: srvctl stop service -d [-s "" [-i ]] [-c | -q] [-f]
Usage: srvctl stop nodeapps -n
Usage: srvctl stop asm -n [-i ] [-o ] [-c | -q]
Usage: srvctl stop listener -n [-l ]
Usage: srvctl unsetenv database -d -t ""
Usage: srvctl unsetenv instance -d [-i ] -t ""
Usage: srvctl unsetenv service -d [-s ] -t ""
Usage: srvctl unsetenv nodeapps -n -t ""

从上我们可以看到 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 -i

[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 [-i ] [-o]
[oracle@rac1 ~]$ srvctl start asm -n rac1

6.获取所有的环境信息
$ srvctl getenv database -d [-i ]

7.设置全局环境变量:
$ srvctl setenv database -d -t LANG=en

8.从OCR中删除已有的数据库:
$ srvctl remove database -d

9.向OCR中添加一个数据库:
$ srvctl add database -d -o [-m ] [-p] [-A /netmask] [-r {PRIMARY | PHYSICAL_STANDBY |LOGICAL_STANDBY}] [-s ]

10.向OCR中添加一个数据库的实例:
$ srvctl add instance -d -i -n

11.向OCR中添加一个ASM实例:
$ srvctl add asm -n -i -o
 
12.添加一个service
$ srvctl add service -d -s -r [-a ] [-P ] [-u]
 
13.修改在其他节点上的service(修改的是配置,此时使用的实例不变)
$ srvctl modify service -d -s -i -t
 
14.relocate 某个节点的service到其他节点(当taf转到avail实例上后,又想转到pre的实例上,用relocate)
srvctl relocate service -d -s - i -t

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 --停止数据库

阅读(2192) | 评论(1) | 转发(0) |
0

上一篇:ORA-30012错误

下一篇:Oracle 内存管理

给主人留下些什么吧!~~

chinaunix网友2011-03-06 17:27:33

很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com