㈠ 如何修改vip 或者vip 对应的hostname
答:修改vip 或者vip 对应的hostname详细步骤如下:
在oracle 10g 和 11g 的Clusterware 环境中,客户端使用vip(Virtual IP)来连接数据库,客户端应用程序通过vip访问对应的节点上的数据库实例。每个节点都要有一个vip,这些vip是静态的ip地址,必须与公共网络属于同一个子网。每一个vip也要对应一个主机名,而且对于客户端来说,这个主机名应该能够被解析为VIP.VIP通过DNS,/etc/hosts文件来解析(11GR2 可以使用GNS),在安装GI软件时候,会提示为每一个节点填写对应的VIP和VIP对应的hostname,vip信息会存储在OCR和HA架构相关的组件中。
通常来说,VIP的修改需要在规定的时间窗口内,cluster 停止服务。然而对于某种情况下,是不需要停机时间,比如只是修改一个节点的vip维护操作只要在那个节点上就可以了,而不必停止整个cluster。
从10.2.0.3 以来,oracle 去除了ASM/DATABSE对vip的依赖关系,这样对vip的修改可以在不必停止ASM/DATABASE实例的情况下进行,需要做的仅仅是与这个节点连接的客户端受到影响。
实验环境:
版本:
Clusterware :11.2.0.2
database :11.2.0.1
修改vip的操作步骤:
旧vip:
10.10.10.201 rac1-vip
10.10.10.202 rac2-vip
新vip:
10.250.7.111 rac1-vip
10.250.7.112 rac2-vip
子网 10.250.7.0
掩码 255.255.255.0
1 确定vip
对于 10g and 11gR1, 以CRS的属主:
$ srvctl config nodeapps -n -a
比如:
$ srvctl config nodeapps -n racnode1 -a
VIP exists.: /racnode1-vip/101.17.80.184/255.255.254.0/eth1
对于 11gR2, 以Grid 属主:
$ srvctl config nodeapps -a
grid@rac1:/home/grid>srvctl config nodeapps -a
网络存在: 1/10.250.7.0/255.255.255.0/eth0, 类型 static
VIP 存在: /rac1-vip/10.10.10.201/10.250.7.0/255.255.255.0/eth0, 托管节点 rac1
VIP 存在: /rac2-vip/10.10.10.202/10.250.7.0/255.255.255.0/eth0, 托管节点 rac2
2. 确定VIP的状态
grid@rac1:/home/grid>crs_stat -t | grep vip
Name Type Target State Host
------------------------------------------------------------
ora.rac1.vip ora....t1.type ONLINE ONLINE rac1
ora.rac2.vip ora....t1.type ONLINE ONLINE rac2
ora.scan1.vip ora....ip.type ONLINE ONLINE rac1
grid@rac1:ifconfig -a
.....省略.....
eth0:2 Link encap:Ethernet HWaddr 00:50:56:8F:25:0A
inet addr:10.10.10.201 Bcast:10.250.7.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Base address:0x2400 Memory:d8960000-d8980000
.....省略.....
Stopping Resources
3. 停止nodeapps资源和所有依赖于VIP的资源(如果有计划的中断所有服务,则停止ASM/DB 实例)
10g and 11gR1,以CRS的属主:
$ srvctl stop asm -n
$ srvctl stop instance -d -i
$ srvctl stop nodeapps -n
比如:
$ srvctl stop asm -n racnode1
$ srvctl stop instance -d RACDB -i RACDB1
$ srvctl stop nodeapps -n racnode1
11gR2,以Grid属主:
$ srvctl stop instance -d -n
$ srvctl stop vip -n -f
grid@rac1:srvctl stop database -d rac -o immediate
PRCD-1027 : 无法检索数据库 rac
PRCD-1229 : 尝试访问数据库 rac 的配置时被拒绝, 因为其版本 11.2.0.1.0 不同于程序版本 11.2.0.2.0。请改从 /opt/rac/oracle/11.2.0/dbs 运行程序。
oracle@rac1:/home/oracle>srvctl stop database -d rac -o immediate
grid@rac1:/home/grid>srvctl stop vip -n rac1 -f -v
已成功停止 VIP。
grid@rac1:/home/grid>srvctl stop vip -n rac2 -f -v
已成功停止 VIP。
Note: 在 11GR2版本中,-f选项是必须的,否则会报如下错误:
PRCR-1014 : Failed to stop resource ora.rac1.vip
PRCR-1065 : Failed to stop resource ora.rac1.vip
CRS-2529: Unable to act on 'ora.rac1.vip' because that would require stopping or relocating 'ora.LISTENER.lsnr', but the force option was not specified
...
grid@rac1:/home/grid>srvctl stop listener -n rac1
PRCC-1017 : LISTENER 已在 rac1 上停止
PRCR-1005 : 资源 ora.LISTENER.lsnr 已停止
grid@rac1:/home/grid>srvctl stop listener -n rac2
PRCC-1017 : LISTENER 已在 rac2 上停止
PRCR-1005 : 资源 ora.LISTENER.lsnr 已停止
为了防止变更未被确认,而asm 或者db 实例的自动启动,需要将此自动重启功能暂时禁用。
$ srvctl disable database -d
$ srvctl disable asm -n (对于11.2 版本之前的)
$ srvctl disable nodeapps (使用与 11.2 版本以后的)
而我执行srvctl disable nodeapps命令时遇到如下情况(因为vip服务已经停止了)。不会影响最终的操作。
grid@rac1:/home/grid>srvctl disable nodeapps
PRKO-2409 : GSD 已在节点上禁用: rac1,rac2
PRCR-1071 : 无法注册或更新 资源 ora.rac1.vip
CRS-0245: User doesn't have enough privilege to perform. the operation
PRCR-1071 : 无法注册或更新 资源 ora.net1.network
CRS-0245: User doesn't have enough privilege to perform. the operation
4.确认VIP是否已经offline,并且不再绑定到公共网卡上:
grid@rac1:/home/grid>crs_stat -t | grep vip
ora.rac1.vip ora....t1.type OFFLINE OFFLINE
ora.rac2.vip ora....t1.type OFFLINE OFFLINE
ora.scan1.vip ora....ip.type ONLINE ONLINE rac1
使用 ifconfig -a
5 修改VIP和对应的属性值,确保先在OS上做相应的变更 比如/etc/hosts 或者DNS。如果网卡改变了,先确保新的网卡可用。
旧vip:
10.10.10.201 rac1-vip
10.10.10.202 rac2-vip
新vip
10.250.7.111 rac1-vip
10.250.7.112 rac2-vip
子网 10.250.7.0
掩码 255.255.255.0
6. 修改VIP资源
以root用户执行如下命令:
[root@rac1 ~]# /opt/11202/11.2.0/grid/bin/srvctl modify nodeapps -n rac1 -A rac1-vip/255.255.255.0/eth0
[root@rac1 ~]# /opt/11202/11.2.0/grid/bin/srvctl modify nodeapps -n rac2 -A rac2-vip/255.255.255.0/eth0
Note 1: 对于windows平台,如果网卡名称有空格,必须使用 ""
比如:
> srvctl modify nodeapps -n racnode1 -A 110.11.70.11/255.255.255.0/"Local Area Connection 1
Note 2: 从 11.2 开始,VIP依赖于network资源(ora.net1.network),OCR 仅仅只是记录VIP 的hostname或者vip 的ip地址。vip的网络属性比如子网和掩码是记录在network资源里的。
From 11.2.0.2起 , 可以使用srvctl modify network 命令修改网络资源信息
grid@rac1:/home/grid>srvctl modify network -h
修改 Oracle Clusterware 中的网络配置。
用法: srvctl modify network [-k ] [-S /[/if1[|if2...]]] [-w ] [-v]
-k 网络编号 (默认编号为 1)
-S //[if1[|if2...]] 网络的 NET 地址说明
-w 网络类型 (static, dhcp, mixed)
-h 输出用法
-v 详细输出
以root用户:
# srvctl modify network -k 1 -S 110.11.70.0/255.255.255.0/eth2
7. 确认变更:
grid@rac1:/home/grid>srvctl config nodeapps -a
网络存在: 1/10.250.7.0/255.255.255.0/eth0, 类型 static
VIP 存在: /rac1-vip/10.250.7.111/10.250.7.0/255.255.255.0/eth0, 托管节点 rac1
VIP 存在: /rac2-vip/10.250.7.112/10.250.7.0/255.255.255.0/eth0, 托管节点 rac2
8. 重新启动nodeapps资源和相关依赖资源
grid@rac1:/home/grid>srvctl enable nodeapps
PRKO-2415 : VIP 已在节点上启用: rac1,rac2
PRKO-2416 : 网络资源已启用。
oracle@rac1:/home/oracle>srvctl enable database -d rac
grid@rac1:/home/grid>
grid@rac1:/home/grid>srvctl start listener -n rac2
grid@rac1:/home/grid>srvctl start listener -n rac1
grid@rac1:/home/grid>
oracle@rac1:/home/oracle>
oracle@rac1:/home/oracle>srvctl start database -d rac
grid@rac1:/home/grid>
9. 查看新的VIP的状态
grid@rac1:/home/grid>crs_stat -t | grep vip
ora.rac1.vip ora....t1.type ONLINE ONLINE rac1
ora.rac2.vip ora....t1.type ONLINE ONLINE rac2
ora.scan1.vip ora....ip.type ONLINE ONLINE rac1
grid@rac1:/home/grid>
grid@rac1:/home/grid>
grid@rac1:/home/grid>/sbin/ifconfig
eth0 Link encap:Ethernet HWaddr 00:50:56:8F:25:0A
inet addr:10.250.7.225 Bcast:10.250.7.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:fe8f:250a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:560742 errors:0 dropped:0 overruns:0 frame.:0
TX packets:1472284 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:56118003 (53.5 MiB) TX bytes:126169027 (120.3 MiB)
Base address:0x2400 Memory:d8960000-d8980000
eth0:1 Link encap:Ethernet HWaddr 00:50:56:8F:25:0A
inet addr:10.250.7.210 Bcast:10.250.7.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Base address:0x2400 Memory:d8960000-d8980000
eth0:2 Link encap:Ethernet HWaddr 00:50:56:8F:25:0A
inet addr:10.250.7.111 Bcast:10.250.7.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Base address:0x2400 Memory:d8960000-d8980000
eth1 Link encap:Ethernet HWaddr 00:50:56:8F:6F:49
inet addr:10.10.10.101 Bcast:10.10.10.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:fe8f:6f49/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:6842717 errors:0 dropped:0 overruns:0 frame.:0
TX packets:4120949 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4798726508 (4.4 GiB) TX bytes:1472194319 (1.3 GiB)
Base address:0x2440 Memory:d8980000-d89a0000
eth1:1 Link encap:Ethernet HWaddr 00:50:56:8F:6F:49
inet addr:169.254.51.141 Bcast:169.254.255.255 Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Base address:0x2440 Memory:d8980000-d89a0000
grid@rac1:/home/grid>
对于11gR2,只是修改vip的hostname 而不修改其ip地址和vip的其他属性不变:
1.修改VIP 使其指向另一个可用的 hostname,比如rac1
# srvctl modify nodeapps -n racnode1 -A rac2-vip/255.255.255.0/eth2
2.修改 VIP 指定新的hostname
# srvctl modify nodeapps -n racnode1 -A rac1-nvip/255.255.255.0/eth2
3. 确定 USR_ORA_VIP 的值:
# crsctl stat res ora.rac1.vip
㈡ srvctl 工具都有哪些功能
oracle 12c:新特性-RAC数据库的增强
What-if命令评估
通激猜过srvctl使用新的What-if命令评估选项,现在可以确定运行此命令所造成的影响。这一新添加到srvctl的命令,可以在没有实际执行或是不对当前系统做任何改变的情况下模拟此命令。这在想要对一个已存在的系统进行更改却对结果不确定的时候特别有用。这样,伍唤此命令就会明橘型提供进行变更的效果。而–eval 选项也可以通过crsctl 命令来使用来源:CUUG官网。
例如,如果你想要知道停止一个特定数据库会发生什么,那么你就可以使用以下示例:
$ ./srvctl stop database –d MYDB –eval
$ ./crsctl eval modify resource -attr “value”
srvctl的改进
对于srvctl命令还有一些新增功能。以下演示了如何用这些新增功能停止或启动集群上的数据库或实例资源。
srvctl start database|instance –startoption NOMOUNT|MOUNT|OPEN
㈢ 如何用srvctl命令添加ASM amp;DATABASE&LISTENER 注册信息
1.模拟删除ASM & DATABASE 注册信息
删除前请确认这些资源已经是STOP 状态
[oracle@vmrehl4n1 ~]$ srvctl remove database -d myrac
Remove the database myrac? (y/[n]) y
[oracle@vmrehl4n1 ~]$ srvctl remove asm -n vmrehl4n1 -i +ASM1
[oracle@vmrehl4n1 ~拍搏]$ srvctl remove asm -n vmrehl4n2 -i +ASM2
2.添加ASM & DATABASE 注册信息
[oracle@vmrehl4n1 ~]$ srvctl add database -d myrac -o /app/oracle/茄旦proct/10.2.0/db_1
[oracle@vmrehl4n1 ~]$ srvctl add instance -d myrac -i myrac1 -n vmrehl4n1
[oracle@vmrehl4n1 ~]$ srvctl add instance -d myrac -i myrac2 -n vmrehl4n2
[oracle@vmrehl4n1 ~]$ srvctl add asm -n vmrehl4n1 -i +ASM1 -o /app/oracle/proct/10.2.0/db_1
[oracle@vmrehl4n1 ~]$ srvctl add asm -n vmrehl4n2 -i +ASM2 -o /app/oracle/proct/10.2.0/db_1
查看[oracle@vmrehl4n2 admin]$ crs_stat -p ora.myrac.myrac1.inst
显示的此行
REQUIRED_RESOURCES=ora.vmrehl4n1.vip ora.vmrehl4n1.ASM1.asm
如果没有ora.vmrehl4n1.ASM1.asm
需要继续运行以下命令,否则袭纳祥CRS自动启动时不能启动DATABASE:
[oracle@vmrehl4n1 ~]$ srvctl modify instance -d myrac -i myrac1 -s +ASM1
[oracle@vmrehl4n1 ~]$ srvctl modify instance -d myrac -i myrac2 -s +ASM2
㈣ oracle 怎么进入mgmtdb
1 MGMTDB 说明
在Oracle 12.1.0.1的Grid Infrastructure 的安装中,可以选择是否安装Grid Infrastructure Management Repository (GIMR) 数据库:MGMTDB. 如下图:
\
在Grid Infrastructure 12.1.0.2 中,已经没有改选项,MIMR 数据库已经变成了强制选项。
在Oracle 12c 中Management Database 用来存储Cluster HealthMonitor(CHM/OS,ora.crf) ,Oracle Database QoS Management,Rapid Home Provisioning和其他的数据。
ManagementRepository 是受12c Clusterware 管理的一个单实例,在Cluster 启动的时会启动MGMTDG并在其中一个节点上运行,并受GI 管理,如果运行MGMTDG的节点宕机了,GI 会自动把MGMTDB 转移到其他的节点上。
默认情况,MGMTDB 数据库的数据文件存放在共享的设备,如OCR/Voting 的磁盘组中,但后期可蔽雹以移动位置。
在12.1.0.1 中,GIMR 是可选的,如果在安装GI的时候,没有选择Management Database 数据库,那么所有依赖的特性,如ClusterHealth Monitor (CHM/OS) 就会被禁用。
当然,在12.1.0.2 中,可以忽略这个问题,因为是强制安装GIMR了。
另外,对于MGMT 数据库,在目前的版本中,也不需要手工对其进行备份。
2 MGMTDB 基本操作
2.1 查看Management DB 相关的资源:[root@rac1 ~]# crsctl stat res -t
Name Target State Server Statedetails
Local Resources
……
ora.MGMTLSNR
1 ONLINE ONLINE rac2 169.254.142.79 192.168.57.6,STABLE
ora.mgmtdb
1 ONLINE ONLINE rac2 Open,STABLE
……
[root@rac1 ~]#
使用crsctl 命令可以看到ora.mgmtdb和ora.MGMTLSNR。
在操作系统层薯碰面,也可以查看到有2个对应的进程:
[root@rac2 ~]# ps -ef| grep pmon_-MGMTDB
grid 7452 1 0 14:59 ? 00:00:00 mdb_pmon_-MGMTDBroot 7756 7727 0 15:02 pts/4 00:00:00 grep pmon_-MGMTDB[root@rac2 ~]# ps -ef| grep MGMTLSNR
grid 7411 1 014:58 ? 00:00:00/u01/gridsoft/12.1.0/bin/tnslsnr MGMTLSNR -no_crs_notify -inheritroot 7758 7727 0 15:02 pts/4 00:00:00 grep MGMTLSNR[root@rac2 ~]#
2.2 启动和关闭MGMT
正常情况下,MGMTDB 会在GI 启动的时候,会自动启动,但也可以手工管理,直接使用srvctl 操作即可:
Usage: srvctl start mgmtdb[-startoption <start_option>] [-node <node_name>]
2.3 查看Management Database 的log 和trace 文件一般数并谈情况下,是不需要查看MGMT DB的trace的,如果要查看,用如下命令:
[grid@rac2 _mgmtdb]$ pwd
/u01/gridbase/diag/rdbms/_mgmtdb
[grid@rac2 _mgmtdb]$ ls
i_1.mif -MGMTDB
[grid@rac2 _mgmtdb]$
进入$ORACLE_BASE下的trace目录。但是进入-MGMTDB时,要注意,不能直接cd:
[grid@rac2 _mgmtdb]$ cd -MGMTDB
-bash: cd: -M: invalid option
cd: usage: cd [-L|-P] [dir]
[grid@rac2 _mgmtdb]$
必须使用./-MGMTDB,如:
[grid@rac2 _mgmtdb]$ cd ./-MGMTDB
[grid@rac2 -MGMTDB]$ ls
alert hm incpkg lck metadata metadata_pv sweepcmp incident ir log metadata_dgif stage trace[grid@rac2 -MGMTDB]$
[grid@rac2 trace]$ pwd
/u01/gridbase/diag/rdbms/_mgmtdb/-MGMTDB/trace[grid@rac2 trace]$ ls
alert_-MGMTDB.log -MGMTDB_ckpt_4772.trm -MGMTDB_lgwr_7475.trc -MGMTDB_m001_10288.trm -MGMTDB_ora_10486.trc -MGMTDB_p001_5645.trmcdmp_20140807064254 -MGMTDB_ckpt_7477.trc -MGMTDB_lgwr_7475.trm -MGMTDB_m001_10330.trc -MGMTDB_ora_10486.trm -MGMTDB_p001_7523.trccdmp_20141208110548 -MGMTDB_ckpt_7477.trm -MGMTDB_m000_10101.trc -MGMTDB_m001_10330.trm -MGMTDB_ora_10830.trc -MGMTDB_p001_7523.trmcdmp_20141208110550 -MGMTDB_dbrm_4764.trc -MGMTDB_m000_10101.trm -MGMTDB_m001_8055.trc -MGMTDB_ora_10830.trm -MGMTDB_rbal_10460.trccdmp_20141208110553 -MGMTDB_dbrm_4764.trm -MGMTDB_m000_10202.trc -MGMTDB_m001_8055.trm -MGMTDB_ora_3770.trc -MGMTDB_rbal_10460.trmcdmp_20141208110555 -MGMTDB_dbrm_7469.trc -MGMTDB_m000_10202.trm -MGMTDB_mark_10484.trc -MGMTDB_ora_3770.trm -MGMTDB_rbal_4782.trcMGMT DB 的日志和trace 都在这个里。
3 MGMTDB是带一个PDB的CDB数据库
前面说了,MGMTDB 是一个实例,实际上,MGMTDB是带一个PDB的CDB库,我们可以使用GI的命令直接去操作MGMTDB 对应的PDB。
--查看MGMTDB当前节点:
[grid@rac2 /]$ oclumon manage -get masterMaster = rac1
--查看状态:
[grid@rac2 /]$ srvctl status mgmtdb
Database is enabled
Instance -MGMTDB is running on node rac2
--查看配置信息:
[grid@rac2 /]$ srvctl config mgmtdb
Database unique name: _mgmtdb
Database name:
Oracle home: /u01/gridsoft/12.1.0
Oracle user: grid
Spfile:+OCR_VOTING/_mgmtdb/spfile-MGMTDB.oraPassword file:
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Database instance: -MGMTDB
Type: Management
--连接MGMTDB实例
[grid@rac2 /]$ export ORACLE_SID=-MGMTDB
[grid@rac2 /]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Proction onMon Dec 8 15:24:37 2014Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise EditionRelease 12.1.0.1.0 - 64bit ProctionWith the Partitioning, Automatic StorageManagement and Advanced Analytics optionsSQL> select file_name fromdba_data_files union select member file_name from V$logfile;FILE_NAME
+OCR_VOTING/_MGMTDB/DATAFILE/sysaux.258.854939615+OCR_VOTING/_MGMTDB/DATAFILE/sysgridhomedata.261.854939891+OCR_VOTING/_MGMTDB/DATAFILE/sysmgmtdata.260.854939737+OCR_VOTING/_MGMTDB/DATAFILE/system.259.854939661+OCR_VOTING/_MGMTDB/DATAFILE/undotbs1.257.854939605+OCR_VOTING/_MGMTDB/ONLINELOG/group_1.263.854940051+OCR_VOTING/_MGMTDB/ONLINELOG/group_2.264.854940053+OCR_VOTING/_MGMTDB/ONLINELOG/group_3.265.8549400578 rows selected.
这里查询的是MGMTDB的路径,也可以直接用如下命令查询:
[grid@rac2 /]$ oclumon manage -get reppathCHM Repository Path =+OCR_VOTING/_MGMTDB/DATAFILE/sysmgmtdata.260.854939737[grid@rac2 /]$
--查询MGMTDB用户:
SQL> select username,account_status fromdba_users where username like 'CH%';USERNAME ACCOUNT_STATUS
------------- ----------------
CHM OPEN
CHA OPEN
㈤ 如何关闭数据库的asm实例进程
在oracle数据库中关闭asm的实例进程的方法:
1、Shut down all ASM instances on all nodes. To shut down an ASM instance, enter the following command, where node is the name of the node where the ASM instance is running:
$ oracle_home/bin/srvctl stop asm -n node
㈥ 10gRAC系列之使用srvctl管理RAC数据库
srvctl即Server Control 是一个命令行工具 用以管理Oracle的RAC环境 srvctl在Oracle i中引入 Oracle g对其功能进行了大大增强
在命令行下 使用 h参碧顷数可以察看srvctl支持的命令及参数:
bash $ srvctl hUsage: srvctl [ V] Usage: srvctl add a *** n i o [ p ]Usage: srvctl config databaseUsage: srvctl config database d [ a] [ t]Usage: srvctl config service d [ s ] [ a] [ S ]Usage: srvctl config nodeapps n [ a] [ g] [ o] [ s] [ l]Usage: srvctl config a *** n Usage: srvctl config listener n Usage: srvctl disable database d
常用的命令主要如下: 使用srvctl status查看数据库梁慧枣及实例状态查看数据库的状态
bash $ srvctl status database d eygle Instance eygle is running on node db rac Instance eygle is running on node db rac
查看数据库实例的状态
bash $ srvctl status instance d eygle i eygle eygle Instance eygle is running on node db rac Instance eygle is running on node db rac
使用srvctl stop停止数据库或实例停止实例使用srvctl stop instance命令:
bash $ srvctl stop instance PRKO : Invalid mand line syntaxbash $ srvctl stop instance hUsage: srvctl stop instance d i [ o ] [ c | q] d Unique name for the database i Comma separated instance names o Options to shutdown mand (e g normal transactional immediate or abort) c Connect string (default: / as sysdba) q Query connect string from standard input h Print usage
橡拆在命令行发出如下命令
bash $ srvctl stop instance d eygle i eygle
在该节点的警告日志文件中就可以看到如下关闭信息:
Thu Dec : : Shutting down instance: further logons disabledThu Dec : : Stopping background process QMNCThu Dec : : Stopping background process CJQ Thu Dec : : Stopping background process MMNLThu Dec : : Stopping background process MMONThu Dec : : Shutting down instance (immediate)License high water mark = Thu Dec : : Stopping Job queue slave processesThu Dec : : Job queue slave processes stoppedThu Dec : : PMON failed to acquire latch see PMON mpThu Dec : : ALTER DATABASE CLOSE NORMALThu Dec : : SMON: disabling tx recoverySMON: disabling cache recoveryThu Dec : : Shutting down archive processesArchiving is disabledArchive process shutdown avoided: activeThread closed at log sequence Successful close of redo thread Thu Dec : : Completed: ALTER DATABASE CLOSE NORMALThu Dec : : ALTER DATABASE DISMOUNTCompleted: ALTER DATABASE DISMOUNTARCH: Archival disabled e to shutdown: Shutting down archive processesArchiving is disabledArchive process shutdown avoided: activeARCH: Archival disabled e to shutdown: Shutting down archive processesArchiving is disabledArchive process shutdown avoided: activeThu Dec : : freeing rdom
停止数据库使用srvctl stop database命令
bash $ srvctl stop database hUsage: srvctl stop database d [ o ] [ c | q] d Unique name for the database o Options to shutdown mand (e g normal transactional immediate or abort) c Connect string (default: / as sysdba) q Query connect string from standard input h Print usage
发出如下命令后 数据库停止:
bash $ srvctl stop database d eygle
日志文件记录如下过程:
Thu Dec : : Shutting down instance: further logons disabledThu Dec : : Stopping background process CJQ Thu Dec : : Stopping background process QMNCThu Dec : : Stopping background process MMNLThu Dec : : Stopping background process MMONThu Dec : : Shutting down instance (immediate)License high water mark = Thu Dec : : Stopping Job queue slave processesThu Dec : : Job queue slave processes stoppedThu Dec : : PMON failed to acquire latch see PMON mpPMON failed to acquire latch see PMON mpPMON failed to acquire latch see PMON mpThu Dec : : PMON failed to acquire latch see PMON mpThu Dec : : ALTER DATABASE CLOSE NORMALThu Dec : : SMON: disabling tx recoverySMON: disabling cache recoveryThu Dec : : Shutting down archive processesArchiving is disabledArchive process shutdown avoided: activeThread closed at log sequence Successful close of redo thread Thu Dec : : Completed: ALTER DATABASE CLOSE NORMALThu Dec : : ALTER DATABASE DISMOUNTCompleted: ALTER DATABASE DISMOUNTARCH: Archival disabled e to shutdown: Shutting down archive processesArchiving is disabledArchive process shutdown avoided: activeARCH: Archival disabled e to shutdown: Shutting down archive processesArchiving is disabledArchive process shutdown avoided: activeThu Dec : : freeing rdom
使用srvctl start命令启动数据库或实例使用srvctl start database可以启动数据库的所有实例:
bash $ srvctl start database d eygle
在第一个节点 警告日志记录了如下启动过程
Thu Dec : : Starting ORACLE instance (normal)LICENSE_MAX_SESSION = LICENSE_SESSIONS_WARNING = Interface type bge configured from OCR for use as a cluster interconnectInterface type bge configured from OCR for use as a cluster interconnectInterface type bge configured from OCR for use as a public interfacePicked latch free SCN scheme Using LOG_ARCHIVE_DEST_ parameter default value as /opt/oracle/proct/ /db/dbs/archAutotune of undo retention is turned on LICENSE_MAX_USERS = SYS auditing is disabledksdpec: called for event prior to event group initializationStarting up ORACLE RDBMS Version: System parameters with non default values:processes = __shared_pool_size = __large_pool_size = __java_pool_size = __streams_pool_size = spfile = /dev/vx/rdsk/xxfdg/spfilesga_target = control_files = /dev/vx/rdsk/xxfdg/ctlfile /dev/vx/rdsk/xxfdg/ctlfile db_block_size = __db_cache_size = patible = db_file_multiblock_read_count= cluster_database = TRUEcluster_database_instances= thread = instance_number = undo_management = AUTOundo_tablespace = UNDOTBS remote_login_passwordfile= EXCLUSIVEdb_domain = remote_listener = LISTENERS_EYGLEjob_queue_processes = background_mp_dest = /opt/oracle/admin/eygle/bmpuser_mp_dest = /opt/oracle/admin/eygle/umpcore_mp_dest = /opt/oracle/admin/eygle/cmpaudit_file_dest = /opt/oracle/admin/eygle/ampdb_name = eygleopen_cursors = pga_aggregate_target = Cluster munication is configured to use the following interface(s) for this instance Thu Dec : : cluster interconnect IPC version:Oracle UDP/IPIPC Vendor proto DIAG started with pid= OS id= PMON started with pid= OS id= PSP started with pid= OS id= LMON started with pid= OS id= Thu Dec : : WARNING: Failed to set buffer limit on IPC interconnect socketOracle requires that the SocketReceive buffer size be tunable upto MBPlease make sure the kernel parameterwhich limits SO_RCVBUF value set byapplications is atleast MBLMD started with pid= OS id= LMS started with pid= OS id= LMS started with pid= OS id= MMAN started with pid= OS id= DBW started with pid= OS id= LGWR started with pid= OS id= CKPT started with pid= OS id= SMON started with pid= OS id= RECO started with pid= OS id= CJQ started with pid= OS id= MMON started with pid= OS id= MMNL started with pid= OS id= Thu Dec : : lmon registered with NM instance id (internal mem no )Thu Dec : : Reconfiguration started (old inc new inc )List of nodes: Global Resource Directory frozen* allocate domain invalid = TRUE Communication channels reestablishedMaster broadcasted resource hash value bitmapsNon local Process blocks cleaned outThu Dec : : LMS : GCS shadows cancelled closedThu Dec : : LMS : GCS shadows cancelled closedSet master node info Submitted all remote enqueue requestsDwn cvts replayed VALBLKs biousAll grantable enqueues grantedThu Dec : : LMS : GCS shadows traversed replayedThu Dec : : LMS : GCS shadows traversed replayedThu Dec : : Submitted all GCS remote cache requestsFix write in gcs resourcesReconfiguration pleteLCK started with pid= OS id= Thu Dec : : ALTER DATABASE MOUNTThu Dec : : This instance was first to mountSetting recovery target incarnation to Thu Dec : : Successful mount of redo thread with mount id Thu Dec : : Database mounted in Shared Mode (CLUSTER_DATABASE=TRUE)Completed: ALTER DATABASE MOUNTThu Dec : : ALTER DATABASE OPENThis instance was first to openPicked broadcast on mit scheme to generate SCNsThu Dec : : Thread advanced to log sequence Thread opened at log sequence Current log# seq# mem# : /dev/vx/rdsk/xxfdg/redo Successful open of redo thread Thu Dec : : MTTR advisory is disabled because FAST_START_MTTR_TARGET is not setThu Dec : : SMON: enabling cache recoveryThu Dec : : Instance recovery: looking for dead threadsInstance recovery: lock domain invalid but no dead threadsThu Dec : : Successfully onlined Undo Tablespace Thu Dec : : SMON: enabling tx recoveryThu Dec : : Database Characterset is ZHS GBKreplication_dependency_tracking turned off (no async multimaster replication found)Starting background process QMNCQMNC started with pid= OS id= Thu Dec : : Completed: ALTER DATABASE OPEN
节点 记录了如下启动过程:
Thu Dec : : Starting ORACLE instance (normal)LICENSE_MAX_SESSION = LICENSE_SESSIONS_WARNING = Interface type bge configured from OCR for use as a cluster interconnectInterface type bge configured from OCR for use as a cluster interconnectInterface type bge configured from OCR for use as a public interfacePicked latch free SCN scheme Using LOG_ARCHIVE_DEST_ parameter default value as /opt/oracle/proct/ /db/dbs/archAutotune of undo retention is turned on LICENSE_MAX_USERS = SYS auditing is disabledksdpec: called for event prior to event group initializationStarting up ORACLE RDBMS Version: System parameters with non default values:processes = __shared_pool_size = __large_pool_size = __java_pool_size = __streams_pool_size = spfile = /dev/vx/rdsk/xxfdg/spfilesga_target = control_files = /dev/vx/rdsk/xxfdg/ctlfile /dev/vx/rdsk/xxfdg/ctlfile db_block_size = __db_cache_size = patible = db_file_multiblock_read_count= cluster_database = TRUEcluster_database_instances= thread = instance_number = undo_management = AUTOundo_tablespace = UNDOTBS remote_login_passwordfile= EXCLUSIVEdb_domain = remote_listener = LISTENERS_EYGLEjob_queue_processes = background_mp_dest = /opt/oracle/admin/eygle/bmpuser_mp_dest = /opt/oracle/admin/eygle/umpcore_mp_dest = /opt/oracle/admin/eygle/cmpaudit_file_dest = /opt/oracle/admin/eygle/ampdb_name = eygleopen_cursors = pga_aggregate_target = Cluster munication is configured to use the following interface(s) for this instance Thu Dec : : cluster interconnect IPC version:Oracle UDP/IPIPC Vendor proto PMON started with pid= OS id= DIAG started with pid= OS id= PSP started with pid= OS id= LMON started with pid= OS id= Thu Dec : : WARNING: Failed to set buffer limit on IPC interconnect socketOracle requires that the SocketReceive buffer size be tunable upto MBPlease make sure the kernel parameterwhich limits SO_RCVBUF value set byapplications is atleast MBLMD started with pid= OS id= LMS started with pid= OS id= LMS started with pid= OS id= MMAN started with pid= OS id= DBW started with pid= OS id= LGWR started with pid= OS id= CKPT started with pid= OS id= SMON started with pid= OS id= RECO started with pid= OS id= CJQ started with pid= OS id= MMON started with pid= OS id= MMNL started with pid= OS id= Thu Dec : : lmon registered with NM instance id (internal mem no )Thu Dec : : Reconfiguration started (old inc new inc )List of nodes: Global Resource Directory frozen* allocate domain invalid = TRUE Communication channels reestablishedMaster broadcasted resource hash value bitmapsNon local Process blocks cleaned outThu Dec : : LMS : GCS shadows cancelled closedThu Dec : : LMS : GCS shadows cancelled closedSet master node info Submitted all remote enqueue requestsDwn cvts replayed VALBLKs biousAll grantable enqueues grantedPost SMON to start st pass IRThu Dec : : LMS : GCS shadows traversed replayedThu Dec : : LMS : GCS shadows traversed replayedThu Dec : : Submitted all GCS remote cache requestsPost SMON to start st pass IRFix write in gcs resourcesReconfiguration pleteLCK started with pid= OS id= Thu Dec : : ALTER DATABASE MOUNTThu Dec : : Setting recovery target incarnation to Thu Dec : : Successful mount of redo thread with mount id Thu Dec : : Database mounted in Shared Mode (CLUSTER_DATABASE=TRUE)Completed: ALTER DATABASE MOUNTThu Dec : : ALTER DATABASE OPENPicked broadcast on mit scheme to generate SCNsThu Dec : : Thread opened at log sequence Current log# seq# mem# : /dev/vx/rdsk/xxfdg/redo Successful open of redo thread Thu Dec : : MTTR advisory is disabled because FAST_START_MTTR_TARGET is not setThu Dec : : SMON: enabling cache recoveryThu Dec : : Successfully onlined Undo Tablespace Thu Dec : : SMON: enabling tx recoveryThu Dec : : Database Characterset is ZHS GBKreplication_dependency_tracking turned off (no async multimaster replication found)Starting background process QMNCQMNC started with pid= OS id= Thu Dec : : Completed: ALTER DATABASE OPENlishixin/Article/program/Oracle/201311/18569
㈦ 如何用SRVCTL在SQLPLUS中启动数据库失败问题
sqlplus / as sysdba
startup
这些命令在linux下是好用的
但是在windows下只要启动了喊裂oracle服务,数据库就已经被启动了,即使你使用shutdown关闭数据库后你要想再重新启动oracle必须先关闭win服务在启动才可以,使用startup是不可以的枝知。
windows里面已经把东西都集成到服务里面了,你不启动服务oracle无法使用郑搭闭,启动服务oracle也启动了,这就是windows的毛病。