代码改变世界

Oracle RAC学习笔记02-RAC维护工具集

2017-02-20 22:46 AlfredZhao 阅读(...) 评论(...) 编辑 收藏

Oracle RAC学习笔记02-RAC维护工具集

RAC维护工具集

本文实验环境:
10.2.0.5 Clusterware + RAC
11.2.0.4 GI + RAC
通过对比命令的输出,也可大致了解10g RAC 到 11g RAC 发生的变化。

1.节点层

1) olsnodes
olsnodes: 列出集群中所有的节点。

10g(10.2.0.5):

[oracle@oradb28 ~]$ olsnodes -h
Usage: olsnodes [-n] [-p] [-i] [<node> | -l] [-g] [-v]
        where
                -n print node number with the node name
                -p print private interconnect name with the node name
                -i print virtual IP name with the node name
                <node> print information for the specified node
                -l print information for the local node 
                -g turn on logging 
                -v run in verbose mode 

11g(11.2.0.4):

[grid@oradb23 ~]$ olsnodes -h
Usage: olsnodes [ [-n] [-i] [-s] [-t] [<node> | -l [-p]] | [-c] ] [-g] [-v]
        where
                -n print node number with the node name
                -p print private interconnect address for the local node
                -i print virtual IP address with the node name
                <node> print information for the specified node
                -l print information for the local node 
                -s print node status - active or inactive 
                -t print node type - pinned or unpinned 
                -g turn on logging 
                -v Run in debug mode; use at direction of Oracle Support only.
                -c print clusterware name

2.网络层

公有网络和私有网络。
1) oifcfg
oifcfg: Oracle Interface配置工具。

10g(10.2.0.5):

[oracle@oradb28 ~]$ oifcfg

Name:
        oifcfg - Oracle Interface Configuration Tool.

Usage:  oifcfg iflist [-p [-n]]
        oifcfg setif {-node <nodename> | -global} {<if_name>/<subnet>:<if_type>}...
        oifcfg getif [-node <nodename> | -global] [ -if <if_name>[/<subnet>] [-type <if_type>] ]
        oifcfg delif [-node <nodename> | -global] [<if_name>[/<subnet>]]
        oifcfg [-help]

        <nodename> - name of the host, as known to a communications network
        <if_name>  - name by which the interface is configured in the system
        <subnet>   - subnet address of the interface
        <if_type>  - type of the interface { cluster_interconnect | public | storage }

11g(11.2.0.4):

[grid@oradb23 ~]$ oifcfg

Name:
        oifcfg - Oracle Interface Configuration Tool.

Usage:  oifcfg iflist [-p [-n]]
        oifcfg setif {-node <nodename> | -global} {<if_name>/<subnet>:<if_type>}...
        oifcfg getif [-node <nodename> | -global] [ -if <if_name>[/<subnet>] [-type <if_type>] ]
        oifcfg delif {{-node <nodename> | -global} [<if_name>[/<subnet>]] [-force] | -force}
        oifcfg [-help]

        <nodename> - name of the host, as known to a communications network
        <if_name>  - name by which the interface is configured in the system
        <subnet>   - subnet address of the interface
        <if_type>  - type of the interface { cluster_interconnect | public }

2) x$ksxpia
集群的网络信息。
SQL> select * from x$ksxpia;

10g(10.2.0.5):

SQL> select * from x$ksxpia;

ADDR                   INDX    INST_ID PUB_KSXPIA PICKED_KSXPIA                       NAME_KSXPIA     IP_KSXPIA
---------------- ---------- ---------- ---------- ----------------------------------- --------------- ----------------
00002AFCDBB29FB8          0          2 N          OCR                                 eth1            10.10.10.28
00002AFCDBB29FB8          1          2 Y          OCR                                 eth0            192.168.1.28

11g(11.2.0.4):

SQL> select * from x$ksxpia;

ADDR                   INDX    INST_ID PUB_KSXPIA PICKED_KSXPIA                       NAME_KSXPIA     IP_KSXPIA
---------------- ---------- ---------- ---------- ----------------------------------- --------------- ----------------
00007F2490C58CE0          0          1 N          GPnP                                eth1:1          169.254.142.42
00007F2490C58CE0          1          1 Y          GPnP                                eth0            192.168.1.23
00007F2490C58CE0          2          1 Y          GPnP                                eth0:1          192.168.1.53
00007F2490C58CE0          3          1 Y          GPnP                                eth0:2          192.168.1.60

发现11.2.0.4版本,内网地址是169.254.xx.xx,是HAIP特性。
另外11.2.0.4版本,会把自己节点的vip和scan vip也查询出来。

3.集群层

crsctl;
ocrcheck, ocrdump, ocrconfig;
crs_profile, crs_register, crs_start, crs_stat, crs_relocate, crs_stop, crs_unregister;

1) crsctl
--检查整个CRS栈
crsctl check crs
--检查votedisk磁盘位置
crsctl query css votedisk
--查看css misscount
crsctl get css misscount

10g(10.2.0.5):

[oracle@oradb27 ~]$ crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy
[oracle@oradb27 ~]$ crsctl query css votedisk
 0.     0    /dev/raw/raw3
 1.     0    /dev/raw/raw4
 2.     0    /dev/raw/raw5

located 3 votedisk(s).
[oracle@oradb27 ~]$ crsctl get css misscount
60[oracle@oradb27 ~]$ 

--crsctl 命令的帮助选项
[oracle@oradb27 ~]$ 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 log crs [module:level]{,module:level} ... 
                             - Turns on debugging for CRS 
       crsctl debug log evm [module:level]{,module:level} ... 
                             - Turns on debugging for EVM
       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

 If necesary any of these commands can be run with additional tracing by
 adding a "trace" argument at the very front.
 Example: crsctl trace check css

11g(11.2.0.4)

[grid@oradb23 ~]$ crsctl check crs
CRS-4638: Oracle High Availability Services is online
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
[grid@oradb23 ~]$ crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   03e741c03bbe4f4ebfe09d4ef5ec3ac8 (/dev/asm-diska) [OCR]
Located 1 voting disk(s).
[grid@oradb23 ~]$ crsctl get css misscount
CRS-4678: Successful get misscount 30 for Cluster Synchronization Services.

--crsctl 命令的帮助选项
[grid@oradb23 ~]$ crsctl 
Usage: crsctl <command> <object> [<options>]
    command: enable|disable|config|start|stop|relocate|replace|status|add|delete|modify|getperm|setperm|check|set|get|unset|debug|lsmodules|query|pin|unpin|discover|release|request
For complete usage, use:
    crsctl [-h | --help]
For detailed help on each command and object and its options use:
    crsctl <command> <object> -h  e.g. crsctl relocate resource -h

--crsctl lsmodules
crsctl lsmodules css
crsctl lsmodules crs
crsctl lsmodules evm

10g(10.2.0.5):

[oracle@oradb27 ~]$ crsctl lsmodules css
The following are the CSS modules :: 
    CSSD
    COMMCRS
    COMMNS

11g(11.2.0.4):

[root@oradb23 ~]# /u01/app/11.2.0/grid/bin/crsctl lsmodules css
List CSSD Debug Module: CLSF
List CSSD Debug Module: CSSD
List CSSD Debug Module: GIPCCM
List CSSD Debug Module: GIPCGM
List CSSD Debug Module: GIPCNM
List CSSD Debug Module: GPNP
List CSSD Debug Module: OLR
List CSSD Debug Module: SKGFD

--以下需要使用root用户执行:

--配置CRS栈是否自动启动:
crsctl disable crs
crsctl enable crs

--关闭/启动crs
crsctl stop crs
crsctl start crs

--11g的 crsctl start cluster 和 crsctl start crs区别:

crsctl start/stop crs - Manage start/stop the entire Oracle Clusterware stack on a node, including the OHASD process, this command is to be used only on the local node..
crsctl start/stop cluster - Manage start/stop the Oracle Clusterware stack on local node if you do not specify either -all or -n and nodes remote if option -n or -all be specified , NOT including the OHASD process. You can't start/stop clusterware stack without OHASD process running.
Despite crsctl start/stop crs manage entire Oracle Clusterware stack on local node crsctl start/stop crs not allow you to manage remote nodes, unlike crsctl start/stop cluster that allows you to manage all the nodes, but if the process OASH is runing.
To manage Oracle Clusterware Stack on remote nodes, the ohasd (Oracle High Availability Services Daemon) must be running on all managed nodes. (i.e using crsctl start cluster -n , )
Then if you try use crsctl start cluster -n node1,node2 and your local node is node1 and on node1 or node2 OHASD not running this command will fails.

--ocrcheck, ocrdump, ocrconfig
2) ocrcheck
10g(10.2.0.5):

[oracle@oradb27 ~]$ ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          2
         Total space (kbytes)     :     130792
         Used space (kbytes)      :       3840
         Available space (kbytes) :     126952
         ID                       : 1298978498
         Device/File Name         : /dev/raw/raw1
                                    Device/File integrity check succeeded
         Device/File Name         : /dev/raw/raw2
                                    Device/File integrity check succeeded

         Cluster registry integrity check succeeded

11g(11.2.0.4):

--grid
[grid@oradb23 ~]$ ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       3100
         Available space (kbytes) :     259020
         ID                       : 1687103331
         Device/File Name         :       +OCR
                                    Device/File integrity check succeeded

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

         Cluster registry integrity check succeeded

         Logical corruption check bypassed due to non-privileged user

--root 
[root@oradb23 ~]# /u01/app/11.2.0/grid/bin/ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       3100
         Available space (kbytes) :     259020
         ID                       : 1687103331
         Device/File Name         :       +OCR
                                    Device/File integrity check succeeded

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

         Cluster registry integrity check succeeded

         Logical corruption check succeeded

3) ocrdump

10g(10.2.0.5):

[oracle@oradb27 ~]$ ocrdump -h
Name:
        ocrdump - Dump contents of Oracle Cluster Registry to a file.

Synopsis:
        ocrdump [<filename>|-stdout] [-backupfile <backupfilename>] [-keyname <keyname>] [-xml] [-noheader]

Description:
        Default filename is OCRDUMPFILE. Examples are:

        prompt> ocrdump
        writes cluster registry contents to OCRDUMPFILE in the current directory

        prompt> ocrdump MYFILE
        writes cluster registry contents to MYFILE in the current directory

        prompt> ocrdump -stdout -keyname SYSTEM
        writes the subtree of SYSTEM in the cluster registry to stdout

        prompt> ocrdump -stdout -xml
        writes cluster registry contents to stdout in xml format

Notes:
        The header information will be retrieved based on best effort basis.
        A log file will be created in
        $ORACLE_HOME/log/<hostname>/client/ocrdump_<pid>.log. Make sure
        you have file creation privileges in the above directory before
        running this tool.

11g(11.2.0.4)

[grid@oradb23 ~]$ ocrdump -h
Name:
        ocrdump - Dump contents of Oracle Cluster/Local Registry to a file.

Synopsis:
        ocrdump [-local] [<filename>|-stdout] [-backupfile <backupfilename>] [-keyname <keyname>] [-xml] [-noheader]

Description:
        Default filename is OCRDUMPFILE. Examples are:

        prompt> ocrdump
        writes cluster registry contents to OCRDUMPFILE in the current directory

        prompt> ocrdump MYFILE
        writes cluster registry contents to MYFILE in the current directory

        prompt> ocrdump -stdout -keyname SYSTEM
        writes the subtree of SYSTEM in the cluster registry to stdout

        prompt> ocrdump -local -stdout -xml
        writes local registry contents to stdout in xml format

        prompt> ocrdump -backupfile /oracle/CRSHOME/backup.ocr -stdout -xml
        writes registry contents in the backup file to stdout in xml format

Notes:
        The header information will be retrieved based on best effort basis.
        A log file will be created in
        $ORACLE_HOME/log/<hostname>/client/ocrdump_<pid>.log. Make sure
        you have file creation privileges in the above directory before
        running this tool.
        Use option '-local' to indicate that the operation is to be performed on the Oracle Local Registry.

4) ocrconfig

10g(10.2.0.5):

[oracle@oradb27 ~]$ ocrconfig
Name:
        ocrconfig - Configuration tool for Oracle Cluster Registry.

Synopsis:
        ocrconfig [option]
        option:
                -export <filename> [-s online]
                                                    - Export cluster register contents to a file
                -import <filename>                  - Import cluster registry contents from a file
                -upgrade [<user> [<group>]]
                                                    - Upgrade cluster registry from previous version
                -downgrade [-version <version string>]
                                                    - Downgrade cluster registry to the specified version
                -backuploc <dirname>                - Configure periodic backup location
                -showbackup                         - Show backup information
                -restore <filename>                 - Restore from physical backup
                -replace ocr|ocrmirror [<filename>] - Add/replace/remove a OCR device/file
                -overwrite                          - Overwrite OCR configuration on disk
                -repair ocr|ocrmirror <filename>    - Repair local OCR configuration
                -help                               - Print out this help information

Note:
        A log file will be created in
        $ORACLE_HOME/log/<hostname>/client/ocrconfig_<pid>.log. Please ensure
        you have file creation privileges in the above directory before
        running this tool.

11g(11.2.0.4):

[oracle@oradb27 ~]$ ocrconfig
Name:
        ocrconfig - Configuration tool for Oracle Cluster Registry.

Synopsis:
        ocrconfig [option]
        option:
                -export <filename> [-s online]
                                                    - Export cluster register contents to a file
                -import <filename>                  - Import cluster registry contents from a file
                -upgrade [<user> [<group>]]
                                                    - Upgrade cluster registry from previous version
                -downgrade [-version <version string>]
                                                    - Downgrade cluster registry to the specified version
                -backuploc <dirname>                - Configure periodic backup location
                -showbackup                         - Show backup information
                -restore <filename>                 - Restore from physical backup
                -replace ocr|ocrmirror [<filename>] - Add/replace/remove a OCR device/file
                -overwrite                          - Overwrite OCR configuration on disk
                -repair ocr|ocrmirror <filename>    - Repair local OCR configuration
                -help                               - Print out this help information

Note:
        A log file will be created in
        $ORACLE_HOME/log/<hostname>/client/ocrconfig_<pid>.log. Please ensure
        you have file creation privileges in the above directory before
        running this tool.

5) private IP 修改(注意:10g 和 11g操作不一样)
RAC后期变更,绑定网卡时:
11g 需要先oifcfg setif -global 新网卡名称/subnet:cluster_interconnect
./oifcfg setif -global bond1/10.10.10.0:cluster_interconnect
而10g 可以在变更后改。

6) 11.2.0.4 haip
res ora.cluster_interconnect.haip
如何禁用HAIP?
如何查看当前HAIP状态?

4.应用层

1) 查看配置:
srvctl config

eg: srvctl config database -d xxx -a
10g(10.2.0.5):

[oracle@oradb27 ~]$ /u01/app/oracle/product/10.2.0.5/crshome_1/bin/srvctl config database -d jyrac -a
oradb27 jyrac1 /u01/app/oracle/product/10.2.0.5/dbhome_1
oradb28 jyrac2 /u01/app/oracle/product/10.2.0.5/dbhome_1
DB_UNIQUE_NAME: jyrac
DB_NAME: null
ORACLE_HOME: /u01/app/oracle/product/10.2.0.5/dbhome_1
SPFILE: null
DOMAIN: null
DB_ROLE: null
START_OPTIONS: null
POLICY:  AUTOMATIC
ENABLE FLAG: DB ENABLED

[oracle@oradb27 ~]$ /u01/app/oracle/product/10.2.0.5/crshome_1/bin/srvctl config -h
Usage (for backward compatibility): srvctl config
Usage (for backward compatibility): srvctl config -p <dbname> -n <node>
Usage (for backward compatibility): srvctl config -V

11g(11.2.0.4):

[oracle@oradb23 ~]$ srvctl config database -d jyzhao -a
数据库唯一名称: jyzhao
数据库名: 
Oracle 主目录: /u01/app/oracle/product/11.2.0/dbhome_1
Oracle 用户: oracle
Spfile: 
域: 
启动选项: open
停止选项: immediate
数据库角色: PRIMARY
管理策略: AUTOMATIC
服务器池: jyzhao
数据库实例: jyzhao1,jyzhao2
磁盘组: DATA,FRA
装载点路径: 
服务: 
类型: RAC
数据库已启用
数据库是管理员管理的

[oracle@oradb23 ~]$ srvctl config -h

SRVCTL config 命令显示存储在 OCR 中的对象配置。

用法: srvctl config database [-d <db_unique_name> [-a] ] [-v]
用法: srvctl config service -d <db_unique_name> [-s <service_name>] [-v]
用法: srvctl config nodeapps [-a] [-g] [-s]
用法: srvctl config vip { -n <node_name> | -i <vip_name> }
用法: srvctl config network [-k <network_number>]
用法: srvctl config asm [-a]
用法: srvctl config listener [-l <lsnr_name>] [-a]
用法: srvctl config scan [-i <ordinal_number>]
用法: srvctl config scan_listener [-i <ordinal_number>]
用法: srvctl config srvpool [-g <pool_name>]
用法: srvctl config oc4j
用法: srvctl config filesystem -d <volume_device>
用法: srvctl config gns [-a] [-d] [-k] [-m] [-n <node_name>] [-p] [-s] [-V] [-q <name>] [-l] [-v]
用法: srvctl config cvu
有关各个命令和对象的详细帮助, 请使用:
  srvctl <command> <object> -h
Usage (for backward compatibility): srvctl config
Usage (for backward compatibility): srvctl config -p <dbname> -n <node>
Usage (for backward compatibility): srvctl config -V

2)添加资源:
srvctl add

10g(10.2.0.5):

[oracle@oradb27 ~]$ /u01/app/oracle/product/10.2.0.5/crshome_1/bin/srvctl add
Usage: srvctl <command> <object> [<options>]
    command: enable|disable|start|stop|relocate|status|add|remove|modify|getenv|setenv|unsetenv|config
    objects: database|instance|service|nodeapps|asm|listener
For detailed help on each command and object and its options use:
    srvctl <command> <object> -h

11g(11.2.0.4):

[oracle@oradb23 ~]$ srvctl add -h

SRVCTL add 命令将配置和 Oracle Clusterware 应用程序添加到集群数据库, 指定实例, 指定服务或指定节点的 OCR。

用法: srvctl add database -d <db_unique_name> -o <oracle_home> [-c {RACONENODE | RAC | SINGLE} [-e <server_list>] [-i <inst_name>] [-w <timeout>]] [-m <domain_name>] [-p <spfile>] [-r {PRIMARY | PHYSICAL_STANDBY | LOGICAL_STANDBY | SNAPSHOT_STANDBY}] [-s <start_options>] [-t <stop_options>] [-n <db_name>] [-y {AUTOMATIC | MANUAL | NORESTART}] [-g \"<serverpool_list>\"] [-x <node_name>] [-a \"<diskgroup_list>\"] [-j \"<acfs_path_list>\"]
用法: srvctl add instance -d <db_unique_name> -i <inst_name> -n <node_name> [-f]
用法: srvctl add service -d <db_unique_name> -s <service_name> {-r "<preferred_list>" [-a "<available_list>"] [-P {BASIC | NONE | PRECONNECT}] | -g <pool_name> [-c {UNIFORM | SINGLETON}] } [-k   <net_num>] [-l [PRIMARY][,PHYSICAL_STANDBY][,LOGICAL_STANDBY][,SNAPSHOT_STANDBY]] [-y {AUTOMATIC | MANUAL}] [-q {TRUE|FALSE}] [-x {TRUE|FALSE}] [-j {SHORT|LONG}] [-B {NONE|SERVICE_TIME|THROUGHPUT}] [-e {NONE|SESSION|SELECT}] [-m {NONE|BASIC}] [-z <failover_retries>] [-w <failover_delay>] [-t <edition>] [-f]
用法: srvctl add service -d <db_unique_name> -s <service_name> -u {-r "<new_pref_inst>" | -a "<new_avail_inst>"} [-f]
用法: srvctl add nodeapps { { -n <node_name> -A <name|ip>/<netmask>/[if1[|if2...]] } | { -S <subnet>/<netmask>/[if1[|if2...]] } } [-e <em-port>] [-l <ons-local-port>]  [-r <ons-remote-port>] [-t <host>[:<port>][,<host>[:<port>]...]] [-v]
用法: srvctl add vip -n <node_name> -k <network_number> -A <name|ip>/<netmask>/[if1[|if2...]] [-v]
用法: srvctl add network [-k <net_num>] -S <subnet>/<netmask>/[if1[|if2...]] [-w <network_type>] [-v]
用法: srvctl add asm [-l <lsnr_name>]
用法: srvctl add listener [-l <lsnr_name>] [-s] [-p "[TCP:]<port>[, ...][/IPC:<key>][/NMP:<pipe_name>][/TCPS:<s_port>] [/SDP:<port>]"] [-o <oracle_home>] [-k <net_num>]
用法: srvctl add scan -n <scan_name> [-k <network_number>] [-S <subnet>/<netmask>[/if1[|if2|...]]]
用法: srvctl add scan_listener [-l <lsnr_name_prefix>] [-s] [-p [TCP:]<port>[/IPC:<key>][/NMP:<pipe_name>][/TCPS:<s_port>] [/SDP:<port>]] 
用法: srvctl add srvpool -g <pool_name> [-l <min>] [-u <max>] [-i <importance>] [-n "<server_list>"] [-f]
用法: srvctl add oc4j [-v]
用法: srvctl add filesystem -d <volume_device> -v <volume_name> -g <dg_name> [-m <mountpoint_path>] [-u <user>]
用法: srvctl add gns -d <domain> -i <vip_name|ip> [-v]
用法: srvctl add cvu [-t <check_interval_in_minutes>]
有关各个命令和对象的详细帮助, 请使用:
  srvctl <command> <object> -h

3)启用/禁用资源自动启动
srvctl enable/disable

10g(10.2.0.5):

[oracle@oradb27 ~]$ /u01/app/oracle/product/10.2.0.5/crshome_1/bin/srvctl enable
Usage: srvctl <command> <object> [<options>]
    command: enable|disable|start|stop|relocate|status|add|remove|modify|getenv|setenv|unsetenv|config
    objects: database|instance|service|nodeapps|asm|listener
For detailed help on each command and object and its options use:
    srvctl <command> <object> -h

11g(11.2.0.4):

[oracle@oradb23 ~]$ srvctl enable
用法: srvctl <command> <object> [<options>]
    命令: enable|disable|start|stop|relocate|status|add|remove|modify|getenv|setenv|unsetenv|config|convert|upgrade
    对象: database|instance|service|nodeapps|vip|network|asm|diskgroup|listener|srvpool|server|scan|scan_listener|oc4j|home|filesystem|gns|cvu
有关各个命令和对象的详细帮助, 请使用:
  srvctl <command> -h 或
  srvctl <command> <object> -h

4)删除资源:
srvctl remove
使用remove命令删除的只是对象在OCR中的定义信息,对象本身不会被删除,之后还可以通过add命令重新添加到OCR中。

10g(10.2.0.5):

[oracle@oradb27 ~]$ /u01/app/oracle/product/10.2.0.5/crshome_1/bin/srvctl remove
Usage: srvctl <command> <object> [<options>]
    command: enable|disable|start|stop|relocate|status|add|remove|modify|getenv|setenv|unsetenv|config
    objects: database|instance|service|nodeapps|asm|listener
For detailed help on each command and object and its options use:
    srvctl <command> <object> -h

11g(11.2.0.4):

[oracle@oradb23 ~]$ srvctl remove
用法: srvctl <command> <object> [<options>]
    命令: enable|disable|start|stop|relocate|status|add|remove|modify|getenv|setenv|unsetenv|config|convert|upgrade
    对象: database|instance|service|nodeapps|vip|network|asm|diskgroup|listener|srvpool|server|scan|scan_listener|oc4j|home|filesystem|gns|cvu
有关各个命令和对象的详细帮助, 请使用:
  srvctl <command> -h 或
  srvctl <command> <object> -h

5)启动/关闭资源:
srvctl start
srvctl stop

10g(10.2.0.5):

[oracle@oradb27 ~]$ /u01/app/oracle/product/10.2.0.5/crshome_1/bin/srvctl start
Usage: srvctl <command> <object> [<options>]
    command: enable|disable|start|stop|relocate|status|add|remove|modify|getenv|setenv|unsetenv|config
    objects: database|instance|service|nodeapps|asm|listener
For detailed help on each command and object and its options use:
    srvctl <command> <object> -h

11g(11.2.0.4):

[oracle@oradb23 ~]$ srvctl start
用法: srvctl <command> <object> [<options>]
    命令: enable|disable|start|stop|relocate|status|add|remove|modify|getenv|setenv|unsetenv|config|convert|upgrade
    对象: database|instance|service|nodeapps|vip|network|asm|diskgroup|listener|srvpool|server|scan|scan_listener|oc4j|home|filesystem|gns|cvu
有关各个命令和对象的详细帮助, 请使用:
  srvctl <command> -h 或
  srvctl <command> <object> -h

6) 跟踪srvctl
export SRVM_TRACE=true
再次执行srvctl相关命令,会显示出跟踪信息。

7) local_listener
在11.2.0.4版本的默认设置为本地vip的地址,在10.2.0.5默认没有配置local_listener。但我们可以手工设置。

LOCAL_LISTENER specifies a network name that resolves to an address or address list of Oracle Net local listeners (that is, listeners that are running on the same machine as this instance). The address or address list is specified in the TNSNAMES.ORA file or other address repository as configured for your system.

10g(10.2.0.5):

SQL> show parameter listener

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
local_listener                       string
remote_listener                      string      LISTENERS_JYRAC

--设置local_listener参数(对应ORA-12545错误):
alter system set local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.67)(PORT=1521))' sid='jyrac1';
alter system set local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.68)(PORT=1521))' sid='jyrac2';

11g(11.2.0.4):

SQL> show parameter listener

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
listener_networks                    string
local_listener                       string       (ADDRESS=(PROTOCOL=TCP)(HOST=
                                                 192.168.1.53)(PORT=1521))
remote_listener                      string      oradb-scan:1521

Reference

  • 张晓明. 大话Oracle RAC[M]. 人民邮电出版社, 2011.
  • 张晓明. 大话Oracle Grid[M]. 人民邮电出版社, 2014.