Oracle Rac集群日常维护管理命令

一:查看集群的状态

使用crsctl status resource [-t]

使用crs_stat [-t]

使用srvctl status obj 来查询集群、资源的状态

  1. 检查集群的状态

简单的输出

crsctl check cluster

crsctl check crs

crsctl check cluster -n  itpux1

crsctl check cluster -n  itpux2

asmcmd lsdg

详细的信息

#crs_stat -t

#crsctl status res -t

ocrcheck

crsctl query css votedisk
  1. 使用下面命令(root登陆)使用 destination_file 或者 +ASM_disk_group取代现在的OCR
    Location
 ocrconfig -replace current_OCR_location -replacement new_OCR_location

如果只有一个OCR Location, 那么使用下面的命令:

 ocrconfig -add  +new_storage_disk_group

 ocrconfig -delete  +current_disk_group
  1. 运行下面的命令显示备份:
$ ocrconfig   -showbackup
  1. 当Oracle Clusterware起来的时候,在一个节点上运行ocrconfig -manualbackup命令
[grid@rac01 ~]$ ocrconfig   -manualbackup

然后使用 $ ocrconfig -showbackup 可以查看到备份信息。

  1. 运行下面的命令检验备份文件内容及完整性。
$ ocrdump -backupfile backup_file_name   

二:RAC起、停节点、群集

  1. 按顺序操作启动与停止:

停止:关闭数据库,关闭CRS

第一个节点,第二个节点

 su – oracle

$ sqlplus “as sysdba”

   sqlshutdown immediate

所有节点

$ su – root

 crsctl stop crs

启动:直接启动CRS服务即可

 crsctl start crs

 crsctl check crs

 su - grid

$ crs_start -all

$ crs_stat -t

启用CRS系统重启而自动启动

crsctl enable crs

crsctl disable crs

crsctl config crs

ASM空间的检查

asmcmd lsdg
  1. 数据库实例的启动与停止

停止

shutdown immedate;
 
Shutdown mode

A = ABORT

I = IMMEDIATE

T = TRANSACTIONAL

N = NORMAL

启动

NOMOUNT

Instance started

MOUNT

Control file opened for this instance

OPEN

All files opened as described by the control file for this instance

sqlplus as sysdba'

startup

select name,open_mode from v$database;

select instance_name,status from v$instance;

三:增强的群集资源控制命令

  1. 通过 srvctl 可以控制rac中的resource的方方面面

svrctl -h:获取所有命令的帮助

svrctl cmd -h:获取cmd命令的帮助

  1. 停止和启动Resource

在第一节中,看到直接停止集群,相关的Resource 也会被停止。 但一些实际情况下,我们操作更多的是对某些资源的操作。具体就是使用SRVCTL 命令

查看命令帮助:

srvclt –h

这个命令显示的结果太长,不好查看,可以进一步的查看帮助:

–使用-h:

$ srvctl start -h
The SRVCTL start command starts, OracleClusterware enabled, non-running objects.

 

Usage srvctl start database -ddb_unique_name [-o start_options] [-n node]

Usage srvctl start instance -d db_unique_name{-n node_name [-i inst_name]  -i inst_name_list} [-ostart_options]

Usage srvctl start service -ddb_unique_name [-s service_name_list [-nnode_name  -i inst_name] ] [-o start_options]

Usage srvctl start nodeapps [-n node_name][-g] [-v]

Usage srvctl start vip { -nnode_name  -i vip_name } [-v]

Usage srvctl start asm [-nnode_name] [-o start_options]

Usage srvctl start listener [-llsnr_name] [-n node_name]

Usage srvctl start scan [-iordinal_number] [-n node_name]

Usage srvctl start scan_listener [-nnode_name] [-i ordinal_number]

Usage srvctl start oc4j [-v]

Usage srvctl start home -ooracle_home -s state_file -n node_name

Usage srvctl start filesystem -dvolume_device [-n node_name]

Usage srvctl start diskgroup -gdg_name [-n node_list]

Usage srvctl start gns [-llog_level] [-n node_name] [-v]

Usage srvctl start cvu [-nnode_name]

For detailed help on each command andobject and its options use

 srvctl command object -h

–或者命令不敲全:

$ srvctl database
Usage srvctl commandobject [options]

   commandsenabledisablestartstoprelocatestatusaddremovemodifygetenvsetenvunsetenvconfigconvertupgrade

   objects databaseinstanceservicenodeappsvipnetworkasmdiskgrouplistenersrvpoolserverscanscan_listeneroc4jhomefilesystemgnscvu

For detailed help on each command andobject and its options use

 srvctl command -h or

 srvctl command object -h
  1. 检查集群状态
crsctl check cluster
  1. 所有Oracle实例(数据库状态)
srvctl status database -dsdd      
  1. 检查单个实例状态
srvctl status instance -itpux -i itpux1
  1. 节点应用程序状态
srvctl status nodeapps
  1. 列出所有的配置数据库
srvctl config database
  1. 数据库配置
srvctl config database -dsdd -a
  1. ASM状态以及ASM配置
srvctl status asm

srvctl status asm -a
  1. TNS监听器状态以及配置
srvctl status listener

srvctl config listener -a
  1. SCAN状态以及配置
srvctl status scan

srvctl config scan
  1. 节点应用程序配置信息(VIP、GSD、ONS、监听器)
$ srvctl config nodeapps -a -g -s -l

三.数据库与实例相关状态

srvctl config database # 列出安装的数据库

srvctl config database -d itpux -a # 检查数据库相关的信息

srvctl status database -d itpux # 检查数据库的状态

srvctl status instance -d itpux -i itpux1 # 检查指定实例的状态

srvctl config asm -a # ASM配置

srvctl status asm # ASM的状态

srvctl start database -d itpux# 启动数据库

srvctl stop database -d itpux# 关闭数据库

srvctl start instance -d itpux -i itpux1 # 启动指定的实例

srvctl stop instance -d itpux -i itpux2 # 关闭指定实例

四. 网络相关状态

srvctl status listener # 检查TNS listener的状态

srvctl config scan # SCAN的配置

srvctl status scan # SCAN listener状态, 包含当前运行节点的信息

五. 检查VIP的配置及状态

srvctl status vip -n rac1

srvctl config vip -n rac1

查看各资源状态(nodeapps节点应用程序,ASM实例,数据库等)

 crs_stat -t   

在11g R2中,默认 oc4j和gsd资源是 disable的;oc4j 是用于WLM 的一个资源, WLM在 11.2.0.2 才可用;gsd是 CRS 用于跟 9i RAC 进行通信的一个模块,是为了向后兼容才保留的,不影响性能;建议不要刪除, 也不要尝试开启他们, 忽略即可。

ora.gsd is OFFLINE by default ifthere is no 9i database in the cluster.

ora.oc4j is OFFLINE in 11.2.0.1 as DatabaseWorkload Management(DBWLM) is unavailable. these can be ignored in11gR2 RAC.

状态检查也可以使用如下命令:

crsctl stat resource –t

或者

crsctl stat resource

1、通过SRVCTL命令来startstopcheck所有的实例

 srvctl startstopstatus database -ddb_name

2、startstop指定的实例:

srvctl startstopstatusinstance -d db_name -i instance_name

3、列出当前RAC下所有的

 srvctl config database -d db_name

4、startstopcheck 所有的nodeapps,比如:VIP, GSD, listener, ONS:

 srvctl startstopstatus nodeapps -nnode_name

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

  srvctl startstop asm -n node_name[-i asm_inst_name] [-ooracle_home]

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

 srvctl getenv database -d db_name [-iinstance_name]

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

srvctl setenv database -ddb_name -t

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

 srvctl remove database -d db_name

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

 srvctl add instance -d db_name -iinstance_name -n node1

 srvctl add instance -d db_name -iinstance_name -n node2

相关推荐

  1. Oracle Rac日常维护管理命令

    2024-03-15 17:36:03       17 阅读
  2. Hadoop生产各种维护命令

    2024-03-15 17:36:03       53 阅读
  3. k8s 日常维护命令简介

    2024-03-15 17:36:03       11 阅读
  4. 03.磁盘管理维护命令

    2024-03-15 17:36:03       10 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-03-15 17:36:03       16 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-03-15 17:36:03       16 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-03-15 17:36:03       15 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-03-15 17:36:03       18 阅读

热门阅读

  1. Rabbitmq---topics模型之动态路由

    2024-03-15 17:36:03       18 阅读
  2. IUV-5G全网仿真软件实训手册-手工整理

    2024-03-15 17:36:03       17 阅读
  3. 神经网络量化

    2024-03-15 17:36:03       17 阅读
  4. [Vue]插槽

    2024-03-15 17:36:03       19 阅读
  5. openssl生成免费证书

    2024-03-15 17:36:03       22 阅读
  6. verilog中,何时用reg和wire

    2024-03-15 17:36:03       23 阅读
  7. Cron 表达式

    2024-03-15 17:36:03       18 阅读
  8. Python中Pandas常用函数及案例详解

    2024-03-15 17:36:03       18 阅读