ORACLE数据库RA 集群的启动和关闭

前端之家收集整理的这篇文章主要介绍了ORACLE数据库RA 集群的启动和关闭前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

ORACLE --RAC 集群的启动和关闭

RAC集群的启动和关闭,貌似非常的简单,敲来敲去也就是那五六个命令。但是深入理解下去,非常有助于我们了解RAC的构架.

 启动和关闭rac一般使用三种方式:sqlplus,srvctl以及dbconsole或者Oracle grid control,本节中简要介绍下使用srvctl启动和关闭rac数据库集群!

使用crs_stat命令可以查询当前rac各节点下的asm实例,监听器,global service daemon,oracle notification server,vip,数据库实例是否正常!

复制代码

[root@rac1~]#su-oracle
[oracle@rac1~]$crs_stat-t-v
NameTypeR/RAF/FTTargetStateHost
----------------------------------------------------------------------ora....SM1.asmapplication0/50/0ONLINEONLINErac1
ora....C1.lsnrapplication0/50/0ONLINEONLINErac1
ora.rac1.gsdapplication0/50/0ONLINEONLINErac1
ora.rac1.onsapplication0/30/0ONLINEONLINErac1
ora.rac1.vipapplication0/00/0ONLINEONLINErac1
ora....SM2.asmapplication0/50/0ONLINEONLINErac2
ora....C2.lsnrapplication0/50/0ONLINEONLINErac2
ora.rac2.gsdapplication0/50/0ONLINEONLINErac2
ora.rac2.onsapplication0/30/0ONLINEONLINErac2
ora.rac2.vipapplication0/00/0ONLINEONLINErac2
ora.racdb.dbapplication0/10/1ONLINEONLINErac1
ora....b1.instapplication0/50/0ONLINEONLINErac1
ora....b2.instapplication0/50/0ONLINEONLINErac2

复制代码

srvctl命令的使用
srvctl是service control的缩写,基本的用法是srvctl <command> <object> [<options>],使用srvctl命令,可以对rac各个节点的数据库实例,asm实例和监听器等进行管理,挺方便的工具

复制代码

oracle@rac2~]$srvctl
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
Fordetailedhelponeachcommandandobjectanditsoptionsuse:
srvctl<command><object>-h

获取更详细的帮助
[oracle@rac2~]$srvctlstartasm-h
Usage:srvctlstartasm-n<node_name>[-i<asm_inst_name>][-o<start_options>][-c<connect_str>|-q]-n<node>Nodename-i<asm_inst_name>ASMinstancename-o<start_options>Optionstostartupcommand(e.g.open,mount,ornomount)-c<connstr>Connectstring(default:/assysdba)-qQueryconnectstringfromstandardinput-hPrintusage

复制代码

关闭RAC数据库

复制代码

[oracle@rac2~]$srvctlstopdatabase-dracdb
[oracle@rac2~]$crs_stat-t-v
NameTypeR/RAF/FTTargetStateHost
----------------------------------------------------------------------ora....SM1.asmapplication0/50/0ONLINEONLINErac1
ora....C1.lsnrapplication0/50/0ONLINEONLINErac1
ora.rac1.gsdapplication0/50/0ONLINEONLINErac1
ora.rac1.onsapplication0/30/0ONLINEONLINErac1
ora.rac1.vipapplication0/00/0ONLINEONLINErac1
ora....SM2.asmapplication0/50/0ONLINEONLINErac2
ora....C2.lsnrapplication0/50/0ONLINEONLINErac2
ora.rac2.gsdapplication0/50/0ONLINEONLINErac2
ora.rac2.onsapplication0/30/0ONLINEONLINErac2
ora.rac2.vipapplication0/00/0ONLINEONLINErac2
ora.racdb.dbapplication0/10/1OFFLINEOFFLINE
ora....b1.instapplication0/50/0OFFLINEOFFLINE
ora....b2.instapplication0/50/0OFFLINEOFFLINE

复制代码

关闭各节点的ASM实例

复制代码

[oracle@rac2~]$srvctlstopasm-nrac1
[oracle@rac2~]$srvctlstopasm-nrac2
[oracle@rac2~]$crs_stat-t-v
NameTypeR/RAF/FTTargetStateHost
----------------------------------------------------------------------ora....SM1.asmapplication0/50/0OFFLINEOFFLINE
ora....C1.lsnrapplication0/50/0ONLINEONLINErac1
ora.rac1.gsdapplication0/50/0ONLINEONLINErac1
ora.rac1.onsapplication0/30/0ONLINEONLINErac1
ora.rac1.vipapplication0/00/0ONLINEONLINErac1
ora....SM2.asmapplication0/50/0OFFLINEOFFLINE
ora....C2.lsnrapplication0/50/0ONLINEONLINErac2
ora.rac2.gsdapplication0/50/0ONLINEONLINErac2
ora.rac2.onsapplication0/30/0ONLINEONLINErac2
ora.rac2.vipapplication0/00/0ONLINEONLINErac2
ora.racdb.dbapplication0/10/1OFFLINEOFFLINE
ora....b1.instapplication0/50/0OFFLINEOFFLINE
ora....b2.instapplication0/50/0OFFLINEOFFLINE

复制代码

关闭各节点的服务包括 gsd,ons,vip,lisener 监听器等

复制代码

[oracle@rac2~]$srvctlstopnodeapps-nrac1
[oracle@rac2~]$srvctlstopnodeapps-nrac2
[oracle@rac2~]$crs_stat-t-v
NameTypeR/RAF/FTTargetStateHost
----------------------------------------------------------------------ora....SM1.asmapplication0/50/0OFFLINEOFFLINE
ora....C1.lsnrapplication0/50/0OFFLINEOFFLINE
ora.rac1.gsdapplication0/50/0OFFLINEOFFLINE
ora.rac1.onsapplication0/30/0OFFLINEOFFLINE
ora.rac1.vipapplication0/00/0OFFLINEOFFLINE
ora....SM2.asmapplication0/50/0OFFLINEOFFLINE
ora....C2.lsnrapplication0/50/0OFFLINEOFFLINE
ora.rac2.gsdapplication0/50/0OFFLINEOFFLINE
ora.rac2.onsapplication0/30/0OFFLINEOFFLINE
ora.rac2.vipapplication0/00/0OFFLINEOFFLINE
ora.racdb.dbapplication0/10/1OFFLINEOFFLINE
ora....b1.instapplication0/50/0OFFLINEOFFLINE
ora....b2.instapplication0/50/0OFFLINEOFFLINE

复制代码

关闭数据库实例,关闭各节点的ASM实例,关闭各节点实例,启动的顺序反之。

复制代码

[oracle@rac2~]$srvctlstartnodeapps-nrac1
[oracle@rac2~]$srvctlstartnodeapps-nrac2
[oracle@rac2~]$srvctlstartasm-nrac1
[oracle@rac2~]$srvctlstartasm-nrac2
[oracle@rac2~]$srvctlstartinstance-dracdb-iracdb1-omount
[oracle@rac2~]$srvctlstartinstance-dracdb-iracdb2-oopen

[oracle@rac2~]$sqlplussys/123456@racdb1assysdba

sql*Plus:Release10.2.0.1.0-ProductiononSatNov2612:15:572011Copyright(c)1982,2005,Oracle.Allrightsreserved.

Connectedto:
OracleDatabase10gEnterpriseEditionRelease10.2.0.1.0-64bitProduction
WiththePartitioning,RealApplicationClusters,OLAPandDataMiningoptions

sql>selectopen_mode,namefromv$database;

OPEN_MODENAME---------------------------------------------------------MOUNTEDRACDB

sql>connsys/123456@racdb2assysdba
Connected.
sql>selectopen_mode,namefromv$database;

OPEN_MODENAME---------------------------------------------------------READWRITERACDB

复制代码

关闭RAC节点的某个实例

[oracle@rac2 ~]$ srvctl start nodeapps -n rac1
[oracle@rac2 ~]$ srvctl start nodeapps -n rac2
[oracle@rac2 ~]$ srvctl start asm -n rac1
[oracle@rac2 ~]$ srvctl start asm -n rac2
[oracle@rac2 ~]$ srvctl start instance -d racdb -i racdb1 -o mount
[oracle@rac2 ~]$ srvctl start instance -d racdb -i racdb2 -o open
[oracle@rac2 ~]$ sqlplus sys/123456@racdb1 as sysdba
sql*Plus: Release 10.2.0.1.0 - Production on Sat Nov 26 12:15:57 2011
Copyright (c) 1982,Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning,Real Application Clusters,OLAP and Data Mining options
sql> select open_mode,name from v$database;
OPEN_MODE NAME
------------------------------ ---------------------------
MOUNTED RACDB
sql> conn sys/123456@racdb2 as sysdba
Connected.
sql> select open_mode,name from v$database;
OPEN_MODE NAME
------------------------------ ---------------------------
READ WRITE RACDB

禁止ASM实例和RAC实例自启动

[oracle@rac2 ~]$ srvctl disable asm -n rac1[oracle@rac2 ~]$ srvctl disable asm -n rac2[oracle@rac2 ~]$ srvctl disable database -d racdb[oracle@rac1 ~]$ uptime 21:46:45 up 2 min,1 user,load average: 2.03,0.78,0.28[oracle@rac1 ~]$ crs_stat -t -vName Type R/RA F/FT Target State Host ----------------------------------------------------------------------ora....SM1.asm application 0/5 0/0 ONLINE OFFLINE ora....C1.lsnr application 0/5 0/0 ONLINE ONLINE rac1 ora.rac1.gsd application 0/5 0/0 ONLINE ONLINE rac1 ora.rac1.ons application 0/3 0/0 ONLINE ONLINE rac1 ora.rac1.vip application 0/0 0/0 ONLINE ONLINE rac1 ora....SM2.asm application 0/5 0/0 ONLINE OFFLINE ora....C2.lsnr application 0/5 0/0 ONLINE ONLINE rac2 ora.rac2.gsd application 0/5 0/0 ONLINE ONLINE rac2 ora.rac2.ons application 0/3 0/0 ONLINE ONLINE rac2 ora.rac2.vip application 0/0 0/0 ONLINE ONLINE rac2 ora.racdb.db application 0/1 0/1 OFFLINE OFFLINE ora....b1.inst application 0/1 0/0 OFFLINE OFFLINE ora....b2.inst application 0/1 0/0 OFFLINE OFFLINE

原文链接:https://www.f2er.com/oracle/208839.html

猜你在找的Oracle相关文章