注册 登录  
 加关注
查看详情
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

曾国藩的博客

 
 
 

日志

 
 

RAC 管理(crs_stat、crsctl、srvctl)  

2013-04-18 16:34:12|  分类: SQL/Oracle/Mysql |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
http://duqiangatom.blog.163.com/blog/static/1150251820100188205246/

使用秘诀:

srvctl +<command:status,start,stop,config,modify,relocate>+<object:database,service,instance,nodeapps> + <option: -i ,-d,-s,-n>

srvctl  -h

srvctl stop instance  -h

srvctl relocate service -h
eg:

AEG2_DB2:/oracle/product/10.2.0/crs>srvctl relocate service -h
Usage: srvctl relocate service -d <name> -s <service_name> -i <old_inst_name> -t <new_inst_name> [-f]
    -d <name>           Unique name for the database
    -s <service>        Service name
    -i <old_inst>       Old instance name
    -t <new_inst>       New instance name
    -f                  Disconnect all sessions during stop or relocate service operations
    -h                  Print usage

根据你写出的长度不同的命令,会具体给出这个命令对应的作用的使用方法,非常好用。

---------------------Start/Stop Instance--------------------

$ srvctl status database -d racdb

$ srvctl stop instance -d racdb -i racdb1 -o abort

$ srvctl status database -d racdb

$ srvctl start instance –d db –i db02

 

-------------------Start/Stop CRS--------------------------

$ crsctl check crs

 

$ crsctl stop crs

$ /etc/init.crs stop

$ crs_stop –all

 

$ crsctl start crs

$ /etc/init.crs start

 

$ /etc/init.crs disable

$ /etc/init.crs enable

 

-----------------CRS Resource-----------------------------

$ crs_stat

$ crs_stat -t

$ crsctl check boot

$ crsctl check crs

# /etc/init.crs disable

# /etc/init.crs stop

# su – oracle

$ cd $ORA_CRS_HOME/bin

$./ocrconfig -restore /opt/app/oracle/crs/cdata/crs/week.ocr

# /etc/init.crs enable

 

$ crsctl

Usage: crsctl check  crs          - checks the viability of the CRS stack

       crsctl check  cssd         - checks the viability of CSS

       crsctl check  crsd         - checks the viability of CRS

       crsctl check  evmd         - checks the viability of EVM

       crsctl set    css <parameter> <value> - sets a parameter override

       crsctl get    css <parameter> - gets the value of a CSS parameter

       crsctl unset  css <parameter> - sets CSS parameter to its default

       crsctl query  css votedisk    - lists the voting disks used by CSS

       crsctl add    css votedisk <path> - adds a new voting disk

       crsctl delete css votedisk <path> - removes a voting disk

       crsctl enable  crs    - enables startup for all CRS daemons

       crsctl disable crs    - disables startup for all CRS daemons

       crsctl start crs  - starts all CRS daemons.

       crsctl stop  crs  - stops all CRS daemons. Stops CRS resources in case of cluster.

       crsctl start resources  - starts CRS resources.

       crsctl stop resources  - stops  CRS resources.

       crsctl debug statedump evm  - dumps state info for evm objects

       crsctl debug statedump crs  - dumps state info for crs objects

       crsctl debug statedump css  - dumps state info for css objects

       crsctl debug log css [module:level]{,module:level} ...

                             - Turns on debugging for CSS

       crsctl debug trace css - dumps CSS in-memory tracing cache

       crsctl debug log crs [module:level]{,module:level} ...

                             - Turns on debugging for CRS

       crsctl debug trace crs - dumps CRS in-memory tracing cache

       crsctl debug log evm [module:level]{,module:level} ...

                             - Turns on debugging for EVM

       crsctl debug trace evm - dumps EVM in-memory tracing cache

       crsctl debug log res <resname:level> turns on debugging for resources

       crsctl query crs softwareversion [<nodename>] - lists the version of CRS software installed

       crsctl query crs activeversion - lists the CRS software operating version

       crsctl lsmodules css - lists the CSS modules that can be used for debugging

       crsctl lsmodules crs - lists the CRS modules that can be used for debugging

       crsctl lsmodules evm - lists the EVM modules that can be used for debugging

 

SRVCTL命令介绍

SRVCTL命令可以控制RAC数据库中的instance,listener以及services。

通常SRVCTL在ORACLE用户下执行。下面我们来介绍srvctl命令。

1、通过SRVCTL命令来start/stop/check所有的实例:

$ srvctl start|stop|status database -d <db_name>

 

2、start/stop指定的实例:

$ srvctl start|stop|status instance -d <db_name> -i <instance_name>

 

3、列出当前RAC下所有的

$ srvctl config database -d <db_name>

 

4、start/stop/check 所有的nodeapps,比如:VIP, GSD, listener, ONS:

$ srvctl start|stop|status nodeapps -n <node_name>

5、如果你使用ASM,srvctl也可以start/stop ASM实例:

$ srvctl start|stop asm -n <node_name> [-i <asm_inst_name>] [-o<oracle_home>]

6、可以获取所有的环境信息:

$ srvctl getenv database -d <db_name> [-i <instance_name>]

7、设置全局环境和变量:

$ srvctl setenv database -d <db_name> -t LANG=en

8、从OCR中删除已有的数据库:

$ srvctl remove database -d <db_name>

9、向OCR中添加一个数据库:

$ srvctl add database -d <db_name> -o <oracle_home>

[-m <domain_name>] [-p<spfile>] [-A <name|ip>/netmask] [-r {PRIMARY | PHYSICAL_STANDBY |LOGICAL_STANDBY}] [-s <start_options>]

10、向OCR中添加一个数据库的实例:

$ srvctl add instance -d <db_name> -i <instance_name> -n <node1>

$ srvctl add instance -d <db_name> -i <instance_name> -n <node2>

11、向OCR中添加一个ASM实例:

$ srvctl add asm -n <node_name> -i <asm_inst_name> -o <oracle_home>

12、添加一个service

$ srvctl add service -d <db_name> -s <service_name> -r <preferred_list>

 

[-a <available_list>] [-P <TAF_policy>] [-u]

13、修改在其他节点上的service(修改的是配置,此时使用的实例不变)

$ srvctl modify service -d <db_name> -s <service_name> -I <orig_instance_name> -t <target_instance_name>

14、relocate 某个节点的service到其他节点(当taf转到avail实例上后,又想转到pre的实例上,用relocate)

srvctl relocate service -d <db_name> -s <service_name> -I

<orig_instance_name> -t <target_instance_name>

 

 

 

SRVCTL相关的选项

SRVCTL START/STOP/STATUS options:

-d database name

-i instance name

-n node name (for nodeapps)

 

SRVCTL ADD options:

-A vip range, node, and database, address specification. The format of address string is:

[<logical host name>]/<VIP address>/<net mask> [/<host interface1 [ | host interface2 |..]>] [,]

[<logical host name>]/<VIP address>/<net mask> [/<host interface1[ | host interface2 |..]>]

-a for services, list of available instances, this list cannot include preferred instances

-m domain name with the format “us.domain.com”

-n node name that will support one or more instances

-o $ORACLE_HOME to locate Oracle binaries

-P for services, TAF preconnect policy - NONE, PRECONNECT

-r for services, list of preferred instances, this list cannot include available instances.

-s spfile name

-u updates the preferred or available list for the service to support the specified

instance. Only one instance may be specified with the -u switch. Instances that already

support the service should not be included.

 

SRVCTL MODIFY options:

-i <instance-name> -t <instance-name> : the instance name (-i) is replaced by the

instance name (-t) -i <instance-name>

-r : the named instance is modified to be a preferred instance -A address-list for VIP application,

at node level -s <asm_inst_name> : add or remove ASM dependency

 

SRVCTL RELOCATE options:

-i <instance-name> -t <instance-name> : the instance name (-i) is replaced by the instance name (-t)

 

 

 

CRS及相关服务的常用命令

1、查看状态的命令

# su – oracle -- 先切换到oracle用户

$ crs_stat -t -- 查看crs及所有的service的状态

Name Type Target State Host

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

ora.oradb.db application ONLINE ONLINE db01

ora....radb.cs application ONLINE ONLINE db01

ora....db1.srv application ONLINE ONLINE db01

ora....db2.srv application ONLINE ONLINE db02

ora....b1.inst application ONLINE ONLINE db01

ora....b2.inst application ONLINE ONLINE db02

ora....C1.lsnr application ONLINE ONLINE db01

ora.db01.gsd application ONLINE ONLINE db01

ora.db01.ons application ONLINE ONLINE db01

ora.db01.vip application ONLINE ONLINE db01

ora....C2.lsnr application ONLINE ONLINE db02

ora.db02.gsd application ONLINE ONLINE db02

ora.db02.ons application ONLINE ONLINE db02

ora.db02.vip application ONLINE ONLINE db02

$ crsctl check crs -- 用crsctl命令,检查crs相关服务的状态

CSS appears healthy

CRS appears healthy

EVM appears healthy

$ srvctl status nodeapps -n db01 (db02) -- 使用srvctl查看所有节点上的服务是否正常

VIP is running on node:db01

GSD is running on node:db01

Listener is running on node:db01

ONS daemon is running on node:db01

$ srvctl status database -d db -- 使用srvctl查看数据库状态

Instance db01 is running on node db01

Instance db02 is running on node db02

2、启动和关闭相关服务的命令

# su – oracle

$ crs_start –all --启动所有的crs服务

$ crs_stop –all --停止所有的crs服务

$ crsctl start crs --启动crs服务

$ crsctl stop crs --停止crs服务

 

$ srvctl start nodeapps -n db01(db02) --启动某节点上所有的应用

$ srvctl stop nodeapps -n db01(db02) --停止某节点上所有的应用

$ srvctl start listener -n db01(db02) --启动某个节点的listener

$ srvctl stop listener -n db01(db02) --停止某个节点的listener

$ srvctl start instance –d db –i db01(db02) --启动某个instance

$ srvctl stop instance –d db –i db01(db02) --停止某个instance

$ srvctl start database –d db --启动数据库

$ srvctl stop database –d db --停止数据库

  评论这张
 
阅读(878)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018