Oracle11g启动、停止实例和RAC数据库操作实例
程序员文章站
2022-06-23 16:03:30
管理RAC数据库的工具可以是OEM、SQL*Plus和SRVCTL。
1、查看集群的状态
[grid@node1 ~]$ crsctl stat res -t
-----...
管理RAC数据库的工具可以是OEM、SQL*Plus和SRVCTL。
1、查看集群的状态
[grid@node1 ~]$ crsctl stat res -t -------------------------------------------------------------------------------- NAME TARGET STATE SERVER STATE_DETAILS -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- ora.DATA.dg ONLINE ONLINE node1 ONLINE ONLINE node2 ora.FRA.dg ONLINE ONLINE node1 ONLINE ONLINE node2 ora.LISTENER.lsnr ONLINE ONLINE node1 ONLINE ONLINE node2 ora.asm ONLINE ONLINE node1 Started --ASM实例处于启动状态 ONLINE ONLINE node2 Started ora.gsd OFFLINE OFFLINE node1 OFFLINE OFFLINE node2 ora.net1.network ONLINE ONLINE node1 ONLINE ONLINE node2 ora.ons ONLINE ONLINE node1 ONLINE ONLINE node2 -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.LISTENER_SCAN1.lsnr 1 ONLINE ONLINE node1 ora.LISTENER_SCAN2.lsnr 1 ONLINE ONLINE node2 ora.LISTENER_SCAN3.lsnr 1 ONLINE ONLINE node1 ora.cvu 1 ONLINE ONLINE node2 ora.node1.vip 1 ONLINE ONLINE node1 ora.node2.vip 1 ONLINE ONLINE node2 ora.oc4j 1 ONLINE ONLINE node2 ora.orcl.db 1 ONLINE ONLINE node1 Open --数据库处于打开状态 2 ONLINE ONLINE node2 Open ora.scan1.vip 1 ONLINE ONLINE node1 ora.scan2.vip 1 ONLINE ONLINE node2 ora.scan3.vip 1 ONLINE ONLINE node1 [grid@node1 ~]$ [grid@node1 ~]$ srvctl status database -d orcl Instance orcl1 is running on node node1 Instance orcl2 is running on node node2
2、关闭数据库 数据库关闭顺序为:关闭数据库——>卸载数据库——>关闭实例
[grid@node1 ~]$ srvctl stop database -d orcl [grid@node1 ~]$ srvctl status database -d orcl Instance orcl1 is not running on node node1 Instance orcl2 is not running on node node2
3、关闭ASM实例 ASM实例关闭顺序为:卸载磁盘——>关闭ASM实例
[grid@node1 ~]$ srvctl status asm --查看ASM状态 ASM is running on node2,node1 --停止磁盘组 [grid@node1 ~]$ srvctl stop diskgroup -g DATA -n node1,node2 [grid@node1 ~]$ srvctl stop diskgroup -g FRA -n node1,node2 [grid@node1 ~]$ srvctl status diskgroup -g DATA -n node1,node2 Disk Group DATA is not running on node1,node2 [grid@node1 ~]$ srvctl status diskgroup -g FRA -n node1,node2 --查看磁盘组状态 Disk Group FRA is not running on node1,node2 --关闭ASM实例 [grid@node1 ~]$ srvctl stop asm --查看实例状态 [grid@node1 ~]$ srvctl status asm ASM is not running. [grid@node1 ~]$ srvctl status asm -n node1 ASM is not running on node1 [grid@node1 ~]$ srvctl status asm -n node2 ASM is not running on node2 --查看集群状态 [grid@node1 ~]$ crs_stat -t -v Name Type R/RA F/FT Target State Host ---------------------------------------------------------------------- ora.DATA.dg ora....up.type 0/5 0/ OFFLINE OFFLINE ora.FRA.dg ora....up.type 0/5 0/ OFFLINE OFFLINE ora....ER.lsnr ora....er.type 0/5 0/ ONLINE ONLINE node1 ora....N1.lsnr ora....er.type 0/5 0/0 ONLINE ONLINE node1 ora....N2.lsnr ora....er.type 0/5 0/0 ONLINE ONLINE node2 ora....N3.lsnr ora....er.type 0/5 0/0 ONLINE ONLINE node1 ora.asm ora.asm.type 0/5 0/ OFFLINE OFFLINE ora.cvu ora.cvu.type 0/5 0/0 ONLINE ONLINE node2 ora.gsd ora.gsd.type 0/5 0/ OFFLINE OFFLINE ora....network ora....rk.type 0/5 0/ ONLINE ONLINE node1 ora....SM1.asm application 0/5 0/0 OFFLINE OFFLINE ora....E1.lsnr application 0/5 0/0 ONLINE ONLINE node1 ora.node1.gsd application 0/5 0/0 OFFLINE OFFLINE ora.node1.ons application 0/3 0/0 ONLINE ONLINE node1 ora.node1.vip ora....t1.type 0/0 0/0 ONLINE ONLINE node1 ora....SM2.asm application 0/5 0/0 OFFLINE OFFLINE ora....E2.lsnr application 0/5 0/0 ONLINE ONLINE node2 ora.node2.gsd application 0/5 0/0 OFFLINE OFFLINE ora.node2.ons application 0/3 0/0 ONLINE ONLINE node2 ora.node2.vip ora....t1.type 0/0 0/0 ONLINE ONLINE node2 ora.oc4j ora.oc4j.type 0/1 0/2 ONLINE ONLINE node2 ora.ons ora.ons.type 0/3 0/ ONLINE ONLINE node1 ora.orcl.db ora....se.type 0/2 0/1 OFFLINE OFFLINE ora.scan1.vip ora....ip.type 0/0 0/0 ONLINE ONLINE node1 ora.scan2.vip ora....ip.type 0/0 0/0 ONLINE ONLINE node2 ora.scan3.vip ora....ip.type 0/0 0/0 ONLINE ONLINE node1 [grid@node1 ~]$
4、启动ASM实例
[grid@node1 ~]$ sqlplus / as sysasm SQL*Plus: Release 11.2.0.4.0 Production on Wed Apr 18 21:24:25 2018 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to an idle instance. SQL> startup ASM instance started Total System Global Area 1135747072 bytes Fixed Size 2260728 bytes Variable Size 1108320520 bytes ASM Cache 25165824 bytes ASM diskgroups mounted SQL> [grid@node1 ~]$ srvctl status asm ASM is running on node2,node1
5、启动数据库
--查看数据库状态 [grid@node1 ~]$ srvctl status database -d orcl Instance orcl1 is not running on node node1 Instance orcl2 is not running on node node2 --启动数据库 [grid@node1 ~]$ srvctl start database -d orcl --查看数据库状态 [grid@node1 ~]$ srvctl status database -d orcl Instance orcl1 is running on node node1 Instance orcl2 is running on node node2 [grid@node1 ~]$
6、查看监听器状态
[grid@node1 ~]$ srvctl status listener Listener LISTENER is enabled Listener LISTENER is running on node(s): node2,node1
7、查看集群状态
[grid@node1 ~]$ crs_stat -t -v Name Type R/RA F/FT Target State Host ---------------------------------------------------------------------- ora.DATA.dg ora....up.type 0/5 0/ ONLINE ONLINE node1 ora.FRA.dg ora....up.type 0/5 0/ ONLINE ONLINE node1 ora....ER.lsnr ora....er.type 0/5 0/ ONLINE ONLINE node1 ora....N1.lsnr ora....er.type 0/5 0/0 ONLINE ONLINE node1 ora....N2.lsnr ora....er.type 0/5 0/0 ONLINE ONLINE node2 ora....N3.lsnr ora....er.type 0/5 0/0 ONLINE ONLINE node1 ora.asm ora.asm.type 0/5 0/ ONLINE ONLINE node1 ora.cvu ora.cvu.type 0/5 0/0 ONLINE ONLINE node2 ora.gsd ora.gsd.type 0/5 0/ OFFLINE OFFLINE ora....network ora....rk.type 0/5 0/ ONLINE ONLINE node1 ora....SM1.asm application 0/5 0/0 ONLINE ONLINE node1 ora....E1.lsnr application 0/5 0/0 ONLINE ONLINE node1 ora.node1.gsd application 0/5 0/0 OFFLINE OFFLINE ora.node1.ons application 0/3 0/0 ONLINE ONLINE node1 ora.node1.vip ora....t1.type 0/0 0/0 ONLINE ONLINE node1 ora....SM2.asm application 0/5 0/0 ONLINE ONLINE node2 ora....E2.lsnr application 0/5 0/0 ONLINE ONLINE node2 ora.node2.gsd application 0/5 0/0 OFFLINE OFFLINE ora.node2.ons application 0/3 0/0 ONLINE ONLINE node2 ora.node2.vip ora....t1.type 0/0 0/0 ONLINE ONLINE node2 ora.oc4j ora.oc4j.type 0/1 0/2 ONLINE ONLINE node2 ora.ons ora.ons.type 0/3 0/ ONLINE ONLINE node1 ora.orcl.db ora....se.type 0/2 0/1 ONLINE ONLINE node1 ora.scan1.vip ora....ip.type 0/0 0/0 ONLINE ONLINE node1 ora.scan2.vip ora....ip.type 0/0 0/0 ONLINE ONLINE node2 ora.scan3.vip ora....ip.type 0/0 0/0 ONLINE ONLINE node1 [grid@node1 ~]$
上一篇: Oracle基础学习之事务控制语言TCL
推荐阅读
-
Python操作Oracle数据库的简单方法和封装类实例
-
Oracle数据库的启动和关闭顺序实例讲解
-
Python操作MySQL数据库的两种方式实例分析【pymysql和pandas】
-
Oracle11g启动、停止实例和RAC数据库操作实例
-
PHP5.5基于mysqli连接MySQL数据库和读取数据操作实例详解
-
python中常用的各种数据库操作模块和连接实例
-
Python操作Oracle数据库的简单方法和封装类实例
-
Oracle10g/11g RAC数据库中的Master实例、Owner实例和Past Image的概念PART3
-
PHP的Yii框架中使用数据库的配置和SQL操作实例教程_php实例
-
python中常用的各种数据库操作模块和连接实例