前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Oracle 集群软件管理

Oracle 集群软件管理

原创
作者头像
用户8006012
发布2022-04-11 10:39:35
4330
发布2022-04-11 10:39:35
举报
文章被收录于专栏:DATABASE
  1. 配置和管理Oracle 集群软件

1.1创建服务器池

代码语言:javascript
复制
crsctl add serverpool testsp -attr "MAX_SIZE=5"

1.2 评估服务器池的添加

代码语言:javascript
复制
crsctl eval add serverpool sp1 -explain

1.3 删除服务器池

代码语言:javascript
复制
crsctl delete serverpool sp1

1.4 启停scan

代码语言:javascript
复制
srvctl start scan
srvctl stop scan
srvctl stop scan -scannumber

1.5 显示scan 的状态

代码语言:javascript
复制
srvctl status scan
[grid@p19c01:/home/grid]$ srvctl status scan
SCAN VIP scan1 is enabled
SCAN VIP scan1 is running on node p19c01


srvctl status scan_listener
[grid@p19c01:/home/grid]$ srvctl status scan_listener
SCAN Listener LISTENER_SCAN1 is enabled
SCAN listener LISTENER_SCAN1 is running on node p19c01

scan配置信息
srvctl config scan
[grid@p19c01:/home/grid]$ srvctl config scan
SCAN name: p19c-scan, Network: 1
Subnet IPv4: 192.168.30.0/255.255.255.0/ens33, static
Subnet IPv6:
SCAN 1 IPv4 VIP: 192.168.30.55
SCAN VIP is enabled.

检查特定scan vip 状态,-scannumber参数值介于1-3之间
srvctl config scan -scannumber 1

[grid@p19c01:/home/grid]$ srvctl config scan -scannumber 1
SCAN name: p19c-scan, Network: 1
Subnet IPv4: 192.168.30.0/255.255.255.0/ens33, static
Subnet IPv6:
SCAN 1 IPv4 VIP: 192.168.30.55
SCAN VIP is enabled.

1.6 检查集群节点ASM完整性

代码语言:javascript
复制
cluvfy comp asm

[grid@p19c01:/home/grid]$ cluvfy comp asm
This software is "359" days old. It is a best practice to update the CRS home by downloading and applying the latest release update. Refer to MOS note 2731675.1 for more details.

Verifying ASM Integrity ...
  Verifying Node Connectivity ...
    Verifying Hosts File ...PASSED
    Verifying Check that maximum (MTU) size packet goes through subnet ...PASSED
  Verifying Node Connectivity ...PASSED
Verifying ASM Integrity ...PASSED

Verification of ASM Integrity was successful.

CVU operation performed:      ASM Integrity
Date:                         Apr 8, 2022 10:08:59 AM
CVU home:                     /u01/app/19.3.0/grid/
User:                         grid

1.7 启动和停止crs

代码语言:javascript
复制
此命令仅在本地节点上启动和停止ORACLE高可用服务
crsctl start crs
crsctl stop crs

source /home/grid/.bash_profile
[root@p19c01:/root]$ cd  $ORACLE_HOME/bin/
[root@p19c01:/u01/app/19.3.0/grid/bin]$ ./crsctl stop crs

[root@p19c01:/u01/app/19.3.0/grid/bin]$ ./crsctl start crs
CRS-4123: Oracle High Availability Services has been started.

检查本地节点状态
crsctl check crs

[root@p19c01:/u01/app/19.3.0/grid/bin]$ 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

检查OHASD守护进程状态
[root@p19c01:/u01/app/19.3.0/grid/bin]$ crsctl check has
CRS-4638: Oracle High Availability Services is online



启动、停止所有节点集群软件堆栈的状态
crsctl start cluster -all
crsctl stop  cluster -all

启动、停止特定节点
crsctl start cluster -n prod1
crsctl stop  cluster -n prod1

检查所有
crsctl check cluster  #当前节点
crsctl check cluster -all


检查所有节点集群软件堆栈的状态
[root@p19c01:/u01/app/19.3.0/grid/bin]$ crsctl check cluster -all
**************************************************************
p19c01:
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
**************************************************************
p19c02:
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
**************************************************************


整个集群资源
crsctl stat res -t

1.9 OLSNODES 命令检查所有节点是否已加入集群

代码语言:javascript
复制
[root@p19c01:/u01/app/19.3.0/grid/bin]$ olsnodes -help
Usage: olsnodes [ [ [-n] [-i] [-s] [-t] [<node> | -l [-p]] [-a] ] | [-f] | [-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 name or 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
                -a print active node roles of the nodes in the cluster
                -f print historical Leaf Nodes (active and recent)

[root@p19c01:/u01/app/19.3.0/grid/bin]$ olsnodes
p19c01
p19c02
[root@p19c01:/u01/app/19.3.0/grid/bin]$ olsnodes -c
p19c-cluster
[root@p19c01:/u01/app/19.3.0/grid/bin]$ olsnodes -s
p19c01  Active
p19c02  Active
[root@p19c01:/u01/app/19.3.0/grid/bin]$ olsnodes -a
p19c01  Hub
p19c02  Hub
[root@p19c01:/u01/app/19.3.0/grid/bin]$

1.9 检查OCR完整性

代码语言:javascript
复制
$ORCLE_HOME/bin/
[root@p19c01:/u01/app/19.3.0/grid/bin]$ ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          4
         Total space (kbytes)     :     491684
         Used space (kbytes)      :      84532
         Available space (kbytes) :     407152
         ID                       : 1815620549
         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

检查ocr和votedisk的完整新
cluvfy comp ocr -n all -verbose
cluvfy comp vdisk -n all -verbose

2.0 使用OCRCONFIG 管理ocr

代码语言:javascript
复制
OCR集群软件每4小时自动备份,CRSd守护进程每天和周末自动备份
$ORACLE_HOEM/bin

OCR备份位置 
ocrconfig -showbackuploc
[root@p19c01:/u01/app/19.3.0/grid/bin]$ ocrconfig -showbackuploc
The Oracle Cluster Registry backup location is [+OCR].

OCR 可用备份 ocrconfig -showbackup
[root@p19c01:/u01/app/19.3.0/grid/bin]$ ocrconfig -showbackup

p19c02     2022/04/03 21:10:58     +OCR:/p19c-cluster/OCRBACKUP/backup00.ocr.258.1101071453     3331580692

p19c02     2022/04/03 21:10:58     +OCR:/p19c-cluster/OCRBACKUP/day.ocr.259.1101071459     3331580692

p19c02     2022/04/03 21:10:58     +OCR:/p19c-cluster/OCRBACKUP/week.ocr.260.1101071461     3331580692
PROT-25: Manual backups for the Oracle Cluster Registry are not available

2.1 使用ASM管理表决文件

代码语言:javascript
复制
备份表决盘
恢复表决盘
首先恢复OCR


[root@p19c01:/u01/app/19.3.0/grid/bin]$ ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          4
         Total space (kbytes)     :     491684
         Used space (kbytes)      :      84532
         Available space (kbytes) :     407152
         ID                       : 1815620549
         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

获取表决文件列表
[root@p19c01:/u01/app/19.3.0/grid/bin]$ crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   1fbf96d7259f4f82bf869ebc97e934e3 (AFD:OCR1) [OCR]
 2. ONLINE   9afa15d1c7864fddbfa383e817860022 (AFD:OCR2) [OCR]
 3. ONLINE   05bcdef876384fb2bf9b8f809cd249a2 (AFD:OCR3) [OCR]
Located 3 voting disk(s).

所有表决盘文件都存储在ASM上,可以迁移到新的ASM磁盘组

crsctl replace votedisk +ARCH

[root@p19c01:/u01/app/19.3.0/grid/bin]$ crsctl replace votedisk +ARCH
Successful addition of voting disk 713bc400eef64f2ebf0973562f42db0e.
Successful deletion of voting disk 1fbf96d7259f4f82bf869ebc97e934e3.
Successful deletion of voting disk 9afa15d1c7864fddbfa383e817860022.
Successful deletion of voting disk 05bcdef876384fb2bf9b8f809cd249a2.
Successfully replaced voting disk group with +ARCH.
CRS-4266: Voting file(s) successfully replaced

OCR镜像
ocrconfig -add +DG

[root@p19c01:/u01/app/19.3.0/grid/bin]$ ocrconfig -add +DG
[root@p19c01:/u01/app/19.3.0/grid/bin]$ ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          4
         Total space (kbytes)     :     491684
         Used space (kbytes)      :      84532
         Available space (kbytes) :     407152
         ID                       : 1815620549
         Device/File Name         :       +OCR
                                    Device/File integrity check succeeded
         Device/File Name         :      +DG
                                    Device/File integrity check succeeded

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

         Cluster registry integrity check succeeded

删除OCR
ocrconfig -DELETE +DG

[root@p19c01:/u01/app/19.3.0/grid/bin]$ ocrconfig -DELETE +DG
[root@p19c01:/u01/app/19.3.0/grid/bin]$ ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          4
         Total space (kbytes)     :     491684
         Used space (kbytes)      :      84532
         Available space (kbytes) :     407152
         ID                       : 1815620549
         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

[root@p19c01:/u01/app/19.3.0/grid/bin]$

OCR替换


OCR的备份和恢复
ocrconfig -manualbackup
ocrconfig -showbackup
dump备份的ocr文件,会生成一个文件,查看生成文件

手动备份
[root@p19c01:/u01/app/19.3.0/grid/bin]$ ocrconfig -manualbackup

p19c02     2022/04/08 17:14:23     +OCR:/p19c-cluster/OCRBACKUP/backup_20220408_171423.ocr.263.1101489263     3331580692
[root@p19c01:/u01/app/19.3.0/grid/bin]$

验证OCR备份
[root@p19c01:/u01/app/19.3.0/grid/bin]$ ocrdump -backupfile +OCR:/p19c-cluster/OCRBACKUP/backup_20220408_171423.ocr.263.1101489263
查看生成文件
[root@p19c01:/u01/app/19.3.0/grid/bin]$ tail -1000 OCRDUMPFILE


导出ocr文件,文件名ocrEXP
ocrconfig -export ocrEXP
ocrconfig -import ocrEXP
[root@p19c01:/u01/app/19.3.0/grid/bin]$ ocrconfig -export ocrEXP
PROT-58: successfully exported the Oracle Cluster Registry contents to file 'ocrEXP'
[root@p19c01:/u01/app/19.3.0/grid/bin]$ ll ocrEXP
-rw------- 1 root root 208896 Apr  8 17:25 ocrEXP



原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
AI 应用产品
文字识别(Optical Character Recognition,OCR)基于腾讯优图实验室的深度学习技术,将图片上的文字内容,智能识别成为可编辑的文本。OCR 支持身份证、名片等卡证类和票据类的印刷体识别,也支持运单等手写体识别,支持提供定制化服务,可以有效地代替人工录入信息。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档