首页 > 数据库 > Oracle > 11gr2 rac 基本管理命令(一)
Oracle clusterware 命令集
|
层次 |
命令 |
|
节点层 |
olsnodes |
|
网络层 |
oifcfg |
|
集群层 |
crsctl 、orccheck、orcdump、ocrconfig |
|
应用层 |
Srvctl 、onsctl、crs_stat |
节点层
表格详解 olsnodes 常用命令
|
目标 |
命令 |
|
集群名称 |
olsnodes -c |
|
节点编号 |
olsnodes -n |
|
节点活动情况 |
olsnodes -s |
|
本地节点名称 |
olsnodes -l |
|
debug 模式,详细信息 |
olsnodes -v |
[root@dou_rac1 ~]# olsnodes --help
Usage: olsnodes [ [-n] [-i] [-s] [-t] [
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
-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
[root@dou_rac1 ~]# olsnodes -c -- (集群名称)
dou_rac
[root@dou_rac1 ~]# olsnodes -n -- (节点编号)
dou_rac1 1
dou_rac2 2
[root@dou_rac1 ~]# olsnodes -s -- (节点活动情况)
dou_rac1 Active
dou_rac2 Active
[root@dou_rac1 ~]# olsnodes -l -- (本地节点名称)
dou_rac1
[root@dou_rac1 ~]# olsnodes -v -- (debug模式,详细信息)
lang init : Initializing LXL global
main: Initializing CLSS context
memberlist: No of cluster members configured = 256
memberlist: Allocated mem for lease node vector.
memberlist: Leased NodeList entries used = 2.
memberlist: Getting information for nodenum = 1
memberlist: node_name = dou_rac1
memberlist: ctx->lsdata->node_num = 1
print data: Printing the node data
dou_rac1
memberlist: Getting information for nodenum = 2
memberlist: node_name = dou_rac2
memberlist: ctx->lsdata->node_num = 2
print data: Printing the node data
dou_rac2
main: olsnodes executed successfully
term: Terminating LSF
网络层
表格详解 oifcfg常用命令
|
目标 |
命令 |
|
网络配置 清单 |
oifcfg iflist |
|
检索网络信息, 发现公用网络和私有网络 |
oifcfg getif |
|
添加 私有网络 |
oifcfg setif -global eth0/172.19.141.0:cluster_interconnect |
|
删除 网络配置 |
oifcfg delif -global eth1/172.21.65.0 |
|
删除 所有网络配置 |
oifcfg delif -global eth1/172.21.65.0 |
[root@dou_rac1 ~]# oifcfg --help
PRIF-9: incorrect usage
Name:
oifcfg - Oracle Interface Configuration Tool.
Usage: oifcfg iflist [-p [-n]]
oifcfg setif {-node
oifcfg getif [-node
oifcfg delif [{-node
oifcfg [-help]
[root@dou_rac1 ~]# oifcfg iflist -- 网络配置清单
eth0 192.168.1.0
eth1 10.10.10.0
[root@dou_rac1 ~]# oifcfg getif -- 检索网络信息,发现公用网络和私有网络
eth0 192.168.1.0 global public
eth1 10.10.10.0 global cluster_interconnect
oifcfg setif -global eth0/172.19.141.0:cluster_interconnect – 添加私有网络
oifcfg delif -global eth1/172.21.65.0 -- 删除网络配置
oifcfg delif –global -- 删除所有网络配置
集群层
表格详解
|
目标 |
命令 |
|
CRS 状态 |
crsctl check crs |
|
查看votedisk磁盘位置 |
crsctl query css votedisk |
|
检查OCR情况 |
ocrcheck |
|
查看OCR自动备份 |
|
|
手动备份OCR |
ocrconfig –export orcexp.bak |
|
手动恢复OCR |
ocrconfig –import orcexp.bak |
[root@dou_rac1 ~]# crsctl --help
Usage: crsctl add - add a resource, type or other entity
crsctl check - check a service, resource or other entity
crsctl config - output autostart configuration
crsctl debug - obtain or modify debug state
crsctl delete - delete a resource, type or other entity
crsctl disable - disable autostart
crsctl enable - enable autostart
crsctl get - get an entity value
crsctl getperm - get entity permissions
crsctl lsmodules - list debug modules
crsctl modify - modify a resource, type or other entity
crsctl query - query service state
crsctl pin - Pin the nodes in the nodelist
crsctl relocate - relocate a resource, server or other entity
crsctl replace - replaces the location of voting files
crsctl setperm - set entity permissions
crsctl set - set an entity value
crsctl start - start a resource, server or other entity
crsctl status - get status of a resource or other entity
crsctl stop - stop a resource, server or other entity
crsctl unpin - unpin the nodes in the nodelist
crsctl unset - unset a entity value, restoring its default
[root@dou_rac1 ~]# crsctl check crs -- (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
Crsctl start crs --( 开启crs)
Crsctl stop crs --( 关闭crs)
关闭、开启开机自启CRS特性
Crsctl disable crs
Crsctl enable crs
[root@dou_rac1 ~]# crsctl query css votedisk --( 查看votedisk磁盘位置)
## STATE File Universal Id File Name Disk group
-- ----- ----------------- --------- ---------
1. ONLINE 38c99c120ba14f72bf9639a4f409c603 (/dev/asm-data02) [DATA]
Located 1 voting disk(s).
[root@dou_rac1 ~]# ocrcheck -- (检查OCR情况)
Status of Oracle Cluster Registry is as follows :
Version : 3
Total space (kbytes) : 262120
Used space (kbytes) : 2700
Available space (kbytes) : 259420
ID : 995956308
Device/File Name : +DATA
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
[grid@dou_rac1 ~]$ /opt/grid/
runcluvfy.
sh comp ocr -n all
--
(使用cluvfy工具检查OCR一致性)
验证 OCR 完整性
正在检查 OCR 完整性...
正在检查是否缺少非集群配置...
所有节点都没有非集群的, 仅限本地的配置
“ASM 运行”检查通过。ASM 正在所有集群节点上运行
正在检查 OCR 配置文件 "/etc/oracle/ocr.loc"...
OCR 配置文件 "/etc/oracle/ocr.loc" 检查成功
ocr 位置 "+DATA" 的磁盘组在所有节点上都可用
正在检查 OCR 位置 "+DATA" 的大小...
OCR 位置 "+DATA" 的大小检查成功...
OCR 位置 "+DATA" 的大小检查成功...
WARNING:
此检查不验证 OCR 内容的完整性。请以授权用户的身份执行 'ocrcheck' 以验证 OCR 的内容。
OCR 完整性检查已通过
OCR 完整性 的验证成功。
[root@dou_rac1 client]# ocrconfig -showbackup -- (OCR自动备份)
dou_rac1 2013/07/22 20:39:39 /u01/app/11.2.0/grid/cdata/dou_rac/backup00.ocr
dou_rac1 2013/07/22 16:39:47 /u01/app/11.2.0/grid/cdata/dou_rac/backup01.ocr
dou_rac1 2013/07/22 12:39:44 /u01/app/11.2.0/grid/cdata/dou_rac/backup02.ocr
dou_rac1 2013/07/22 12:39:44 /u01/app/11.2.0/grid/cdata/dou_rac/day.ocr
dou_rac1 2013/07/22 12:39:44 /u01/app/11.2.0/grid/cdata/dou_rac/week.ocr
PROT-25: Manual backups for the Oracle Cluster Registry are not available
手动备份OCR
Crsctl stop crs --( 先关闭CRS)
Ocrconfig –export orcexp.bak --( 导出OCR,备份)
Ocrconfig –import orcexp.bak --( 导入OCR,恢复)
应用层
表格详解
|
目标 |
命令 |
|
查看CRS资源状态 |
crs_stat -t |
|
CRS 资源详细信息 |
crs_stat -v ora.DATA.dg |
|
CRS 资源更详细信息 |
crs_stat -p ora.DATA.dg |
|
显示OCR中注册的所有数据库 |
srvctl config database |
|
显示某个数据库配置 |
srvctl config database -d racdb |
|
查看VIP配置,ONS端口 |
srvctl config nodeapps |
|
查看listener |
srvctl config listener |
|
查看ASM |
srvctl config asm |
|
查看数据库节点运行情况 |
srvctl status database -d racdb |
[root@dou_rac1 tmp]# crs_stat -t -- (查看CRS资源状态)
Name Type Target State Host
------------------------------------------------------------
ora.CRSBAK.dg ora....up.type ONLINE ONLINE dou_rac1
ora.DATA.dg ora....up.type ONLINE ONLINE dou_rac1
ora....ER.lsnr ora....er.type ONLINE ONLINE dou_rac1
ora....N1.lsnr ora....er.type ONLINE ONLINE dou_rac2
ora.asm ora.asm.type ONLINE ONLINE dou_rac1
ora....SM1.asm application ONLINE ONLINE dou_rac1
ora....C1.lsnr application ONLINE ONLINE dou_rac1
ora....ac1.gsd application OFFLINE OFFLINE
ora....ac1.ons application ONLINE ONLINE dou_rac1
ora....ac1.vip ora....t1.type ONLINE ONLINE dou_rac1
ora....SM2.asm application ONLINE ONLINE dou_rac2
ora....C2.lsnr application ONLINE ONLINE dou_rac2
ora....ac2.gsd application OFFLINE OFFLINE
ora....ac2.ons application ONLINE ONLINE dou_rac2
ora....ac2.vip ora....t1.type ONLINE ONLINE dou_rac2
ora.eons ora.eons.type ONLINE OFFLINE
ora.gsd ora.gsd.type OFFLINE OFFLINE
ora....network ora....rk.type ONLINE ONLINE dou_rac1
ora.oc4j ora.oc4j.type ONLINE ONLINE dou_rac2
ora.ons ora.ons.type ONLINE ONLINE dou_rac1
ora.racdb.db ora....se.type ONLINE ONLINE dou_rac1
ora....ry.acfs ora....fs.type ONLINE ONLINE dou_rac1
ora.scan1.vip ora....ip.type ONLINE ONLINE dou_rac2
[root@dou_rac1 tmp]# crs_stat -v ora.DATA.dg -- (CRS资源详细信息)
NAME=ora.DATA.dg
TYPE=ora.diskgroup.type
RESTART_ATTEMPTS=5
RESTART_COUNT=0
FAILURE_THRESHOLD=
FAILURE_COUNT=0
TARGET=ONLINE
STATE=ONLINE on dou_rac1
[root@dou_rac1 tmp]# crs_stat -p ora.DATA.dg -- (CRS资源更详细内容)
NAME=ora.DATA.dg
TYPE=ora.diskgroup.type
ACTION_SCRIPT=
AUTO_START=never
CHECK_INTERVAL=300
DESCRIPTION=CRS resource type definition for ASM disk group resource
RESTART_ATTEMPTS=5
SCRIPT_TIMEOUT=60
START_TIMEOUT=900
STOP_TIMEOUT=180
UPTIME_THRESHOLD=1d
[root@dou_rac1 tmp]# srvctl --help
用法: srvctl
命令: enable|disable|start|stop|relocate|status|add|remove|modify|getenv|setenv|unsetenv|config
对象: database|instance|service|nodeapps|vip|asm|diskgroup|listener|srvpool|server|scan|scan_listener|oc4j|home|filesystem|gns
有关各个命令和对象的详细帮助, 请使用:
srvctl
srvctl
You have new mail in /var/spool/mail/root
[root@dou_rac1 tmp]# srvctl config database -- (显示OCR中注册的所有数据库)
racdb
[root@dou_rac1 tmp]# srvctl config database -d racdb -- (显示某个数据库配置)
数据库唯一名称: racdb
数据库名: racdb
Oracle 主目录: /u01/app/oracle/product/11.2.0/dbhome_1
Oracle 用户: oracle
Spfile: +DATA/racdb/spfileracdb.ora
域:
启动选项: open
停止选项: immediate
数据库角色: PRIMARY
管理策略: AUTOMATIC
服务器池: racdb
数据库实例: racdb1,racdb2
磁盘组: DATA
服务:
数据库是管理员管理的
[root@dou_rac1 tmp]# srvctl config nodeapps -- (查看VIP配置,ONS端口)
VIP 已存在。:dou_rac1
VIP 已存在。: /dou_rac1-vip/192.168.1.221/255.255.255.0/eth0
VIP 已存在。:dou_rac2
VIP 已存在。: /dou_rac2-vip/192.168.1.222/255.255.255.0/eth0
GSD 已存在。
ONS 守护程序已存在。本地端口 6100, 远程端口 6200
eONS 守护程序已存在。多点传送端口 24553, 多点传送 IP 地址 234.218.189.29, 监听端口 2016
You have new mail in /var/spool/mail/root
[root@dou_rac1 tmp]# srvctl config listener -- (查看listener)
名称: LISTENER
网络: 1, 所有者: grid
主目录:
端点: TCP:1521
[root@dou_rac1 tmp]# srvctl config asm -- (查看ASM)
ASM 主目录: /u01/app/11.2.0/grid
ASM 监听程序: LISTENER
[root@dou_rac1 tmp]# srvctl status database -d racdb -- (查看数据库节点运行情况)
实例 racdb1 正在节点 dou_rac1 上运行
实例 racdb2 正在节点 dou_rac2 上运行
Srvctl start database -d racdb --( 开启数据库)
Srvctl start database -d racdb -o mount -- (开启数据库到mount)
Srvctl stop database -d racdb -- (关闭数据库)
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/26442936/viewspace-767342/ ,如需转载,请注明出处,否则将追究法律责任。