今天是2014-04-01,忙碌了一天终于有时间写点东西了。前段时间写了RAc中ocr存在备份的情况下如何恢复,今天写一下在没有备份情况下如何去重建ocr和olr呢?
最大的悲剧莫过于数据库坏了备份没了。让我想起了前几年流行的一句话:“最大的悲剧是人活着,钱没了”。总之备份重于一切。
情景介绍:
在11G中ocr的asm磁盘组被用户不小心删了且所有备份都误删,olr呢也损坏了。至此悲剧重演。
恢复过程:(其实就是使用root.sh重建ocr的过程,重建之后可能需要重新注册相关资源如listener or database 实例等!)
1、清空所有节点cluster配置信息:(11G中存在rootcrs.sh脚本,该脚本默认存在于$GRID_HOME/crs/install)。
注,该脚本需要在root下执行,否则会有错误提示
?
1
2
3
4
5
6
[grid@rac-one install]$ ./rootcrs.pl
You must be logged in as root to run this script.
Log in as root and rerun this script.
2014-04-01 17:08:12: Not running as authorized user
Insufficient privileges to execute this script.
root or administrative privileges needed to run thescript.
了解该脚本的功能可以查看-help。如升级、回退、重新配置等待》
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
[root@rac-two install]# ./rootcrs.pl-help
Usage:
rootcrs.pl [-verbose] [-upgrade[-force] | -patch]
[-paramfile <parameter-file>]
[-deconfig [-deinstall] [-keepdg][-force] [-lastnode]]
[-downgrade -oldcrshome <old crshomepath> -version <old crs version> [-force] [-lastnode]]
[-unlock [-crshome <path to crs home>] [-nocrsstop]]
[-init]
Options:
-verboseRun this script in verbose mode
-upgradeOracle HA is being upgraded from previous version
-patchOracle HA is being upgraded to a patch version
-paramfileComplete path of file specifying HA parameter values
-lastnodeForce the node this script is executing on to be considered
as the last node of deconfiguration or downgrade, and perform
actions associated with deconfiguring or downgrading the
last node
-downgradeDowngrade theclusterware
-versionFor use with downgrade; special handling is required if
downgrading to 9i. This is the old crs version in the format
A.B.C.D.E (e.g 11.1.0.6.0).
-deconfigRemove Oracle Clusterwareto allow it to be uninstalled or reinstalled
-forceForce the execution of steps in delete or dwongrade that cannot
be verified to be safe
-deinstallReset the permissionson CRS home duringde-configuration
-keepdgKeep existing diskgroupsduring de-configuration
-unlockUnlock CRS home
-crshomeComplete path of crs home. Use with unlock option
-oldcrshome For use with downgrade. Complete path of the old crs home
-nocrsstopused with unlock option to reset permissions on an inactive grid home
-initReset the permissionsof all files and directories under CRS home
If neither -upgrade nor -patchis supplied, a new install is performed
To see the full manpage for this program, execute:
perldoc rootcrs.pl
[root@rac-twoinstall]#
在root下清除所有节点cluster 信息:
节点2:
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
[grid@rac-one install]$ su
Password:
[root@rac-one install]# ./rootcrs.pl-deconfig -force
Using configuration parameter file:./crsconfig_params
Network exists:1/192.168.4.0/255.255.255.0/eth0, type static
VIP exists:/rac-one-vip/192.168.4.113/192.168.4.0/255.255.255.0/eth0, hosting noderac-one
VIP exists:/rac-two-vip/192.168.4.114/192.168.4.0/255.255.255.0/eth0, hosting noderac-two
GSD exists
ONS exists: Local port 6100, remote port 6200, EM port2016
CRS-2673: Attempting to stop 'ora.registry.acfs' on 'rac-one'
CRS-2677: Stop of 'ora.registry.acfs' on 'rac-one' succeeded
CRS-2791: Starting shutdown of Oracle High Availability Services-managedresources on 'rac-one'
CRS-2673: Attempting to stop 'ora.crsd' on 'rac-one'
CRS-2790: Starting shutdown of Cluster Ready Services-managed resourceson 'rac-one'
CRS-2673: Attempting to stop 'ora.oc4j' on 'rac-one'
CRS-2673: Attempting to stop 'ora.GIDG.dg' on 'rac-one'
CRS-2673: Attempting to stop 'ora.DATADG.dg' on 'rac-one'
CRS-2677: Stop of 'ora.DATADG.dg' on 'rac-one' succeeded
CRS-2677: Stop of 'ora.GIDG.dg' on 'rac-one' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'rac-one'
CRS-2677: Stop of 'ora.oc4j' on 'rac-one' succeeded
CRS-2672: Attempting to start 'ora.oc4j' on 'rac-two'
CRS-2677: Stop of 'ora.asm' on 'rac-one' succeeded
CRS-2676: Start of 'ora.oc4j' on 'rac-two' succeeded
CRS-2792: Shutdown of Cluster Ready Services-managed resourceson 'rac-one' has completed
CRS-2677: Stop of 'ora.crsd' on 'rac-one' succeeded
CRS-2673: Attempting to stop 'ora.crf' on 'rac-one'
CRS-2673: Attempting to stop 'ora.ctssd' on 'rac-one'
CRS-2673: Attempting to stop 'ora.evmd' on 'rac-one'
CRS-2673: Attempting to stop 'ora.asm' on 'rac-one'
CRS-2673: Attempting to stop 'ora.drivers.acfs' on 'rac-one'
CRS-2673: Attempting to stop 'ora.mdnsd' on 'rac-one'
CRS-2677: Stop of 'ora.crf' on 'rac-one' succeeded
CRS-2677: Stop of 'ora.evmd' on 'rac-one' succeeded
CRS-2677: Stop of 'ora.mdnsd' on 'rac-one' succeeded
CRS-2677: Stop of 'ora.ctssd' on 'rac-one' succeeded
CRS-2677: Stop of 'ora.asm' on 'rac-one' succeeded
CRS-2673: Attempting to stop 'ora.cluster_interconnect.haip'on 'rac-one'
CRS-2677: Stop of 'ora.cluster_interconnect.haip'on 'rac-one' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'rac-one'
CRS-2677: Stop of 'ora.cssd' on 'rac-one' succeeded
CRS-2673: Attempting to stop 'ora.gipcd' on 'rac-one'
CRS-2677: Stop of 'ora.drivers.acfs' on 'rac-one' succeeded
CRS-2677: Stop of 'ora.gipcd' on 'rac-one' succeeded
CRS-2673: Attempting to stop 'ora.gpnpd' on 'rac-one'
CRS-2677: Stop of 'ora.gpnpd' on 'rac-one' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managedresources on 'rac-one' has completed
CRS-4133: Oracle High AvailabilityServices has been stopped.
Removing Trace File Analyzer
Successfully deconfigured Oracleclusterware stack on this node
[root@rac-oneinstall]#
节点1,因为我的RAC是双节点的,那么在清除最后一个使用lastnode参数:
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
[grid@rac-two crs]$ cdinstall/
[grid@rac-two install]$ su
Password:
[root@rac-two install]# ./rootcrs.pl-deconfig -force -lastnode
Using configuration parameter file:./crsconfig_params
CRS resources for listeners are stillconfigured
Network exists:1/192.168.4.0/255.255.255.0/eth0, type static
VIP exists:/rac-two-vip/192.168.4.114/192.168.4.0/255.255.255.0/eth0, hosting noderac-two
GSD exists
ONS exists: Local port 6100, remote port 6200, EM port2016
CRS-2673: Attempting to stop 'ora.registry.acfs' on 'rac-two'
CRS-2677: Stop of 'ora.registry.acfs' on 'rac-two' succeeded
CRS-2673: Attempting to stop 'ora.crsd' on 'rac-two'
CRS-2790: Starting shutdown of Cluster Ready Services-managed resourceson 'rac-two'
CRS-2673: Attempting to stop 'ora.oc4j' on 'rac-two'
CRS-2673: Attempting to stop 'ora.GIDG.dg' on 'rac-two'
CRS-2673: Attempting to stop 'ora.DATADG.dg' on 'rac-two'
CRS-2677: Stop of 'ora.DATADG.dg' on 'rac-two' succeeded
CRS-2677: Stop of 'ora.oc4j' on 'rac-two' succeeded
CRS-2677: Stop of 'ora.GIDG.dg' on 'rac-two' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'rac-two'
CRS-2677: Stop of 'ora.asm' on 'rac-two' succeeded
CRS-2792: Shutdown of Cluster Ready Services-managed resourceson 'rac-two' has completed
CRS-2677: Stop of 'ora.crsd' on 'rac-two' succeeded
CRS-2673: Attempting to stop 'ora.ctssd' on 'rac-two'
CRS-2673: Attempting to stop 'ora.evmd' on 'rac-two'
CRS-2673: Attempting to stop 'ora.asm' on 'rac-two'
CRS-2677: Stop of 'ora.evmd' on 'rac-two' succeeded
CRS-2677: Stop of 'ora.asm' on 'rac-two' succeeded
CRS-2673: Attempting to stop 'ora.cluster_interconnect.haip'on 'rac-two'
CRS-2677: Stop of 'ora.cluster_interconnect.haip'on 'rac-two' succeeded
CRS-2677: Stop of 'ora.ctssd' on 'rac-two' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'rac-two'
CRS-2677: Stop of 'ora.cssd' on 'rac-two' succeeded
CRS-2672: Attempting to start 'ora.cssdmonitor' on 'rac-two'
CRS-2676: Start of 'ora.cssdmonitor' on 'rac-two' succeeded
CRS-2672: Attempting to start 'ora.cssd' on 'rac-two'
CRS-2672: Attempting to start 'ora.diskmon' on 'rac-two'
CRS-2676: Start of 'ora.diskmon' on 'rac-two' succeeded
CRS-2676: Start of 'ora.cssd' on 'rac-two' succeeded
CRS-4611: Successful deletion of voting disk +GIDG.
ASM de-configuration trace file location:/tmp/asmcadc_clean2014-04-01_05-14-52-PM.log
ASM Clean Configuration START
ASM Clean Configuration END
ASM with SID +ASM1 deleted successfully.Check /tmp/asmcadc_clean2014-04-01_05-14-52-PM.log for details.
CRS-2791: Starting shutdown of Oracle High Availability Services-managedresources on 'rac-two'
CRS-2673: Attempting to stop 'ora.mdnsd' on 'rac-two'
CRS-2673: Attempting to stop 'ora.ctssd' on 'rac-two'
CRS-2673: Attempting to stop 'ora.asm' on 'rac-two'
CRS-2677: Stop of 'ora.mdnsd' on 'rac-two' succeeded
CRS-2677: Stop of 'ora.ctssd' on 'rac-two' succeeded
CRS-2677: Stop of 'ora.asm' on 'rac-two' succeeded
CRS-2673: Attempting to stop 'ora.cluster_interconnect.haip'on 'rac-two'
CRS-2677: Stop of 'ora.cluster_interconnect.haip'on 'rac-two' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'rac-two'
CRS-2677: Stop of 'ora.cssd' on 'rac-two' succeeded
CRS-2673: Attempting to stop 'ora.crf' on 'rac-two'
CRS-2677: Stop of 'ora.crf' on 'rac-two' succeeded
CRS-2673: Attempting to stop 'ora.gipcd' on 'rac-two'
CRS-2677: Stop of 'ora.gipcd' on 'rac-two' succeeded
CRS-2673: Attempting to stop 'ora.gpnpd' on 'rac-two'
CRS-2677: Stop of 'ora.gpnpd' on 'rac-two' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managedresources on 'rac-two' has completed
CRS-4133: Oracle High AvailabilityServices has been stopped.
Removing Trace File Analyzer
Successfully deconfigured Oracleclusterware stack on this node
[root@rac-two install]#
二、重建ocr和olr,使用root.sh脚本完成重建,其实这就是在安装RAC中执行的脚本,默认位置为:$GRID_HOME/;
eg:
节点1:
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
[root@rac-two grid]# ./root.sh
Performing root user operation for Oracle 11g
The following environment variables areset as:
ORACLE_OWNER= grid
ORACLE_HOME=/u01/app/11.2.0/grid
Enter the full pathname of the local bin directory: [/usr/local/bin]:
The contents of "dbhome" have not changed. No need to overwrite.
The contents of "oraenv" have not changed. No need to overwrite.
The contents of "coraenv" have not changed. No need to overwrite.
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will beperformed.
Using configuration parameter file:/u01/app/11.2.0/grid/crs/install/crsconfig_params
User ignored Prerequisites duringinstallation
Installing Trace FileAnalyzer
CRS-2672: Attempting to start 'ora.mdnsd' on 'rac-two'
CRS-2676: Start of 'ora.mdnsd' on 'rac-two' succeeded
CRS-2672: Attempting to start 'ora.gpnpd' on 'rac-two'
CRS-2676: Start of 'ora.gpnpd' on 'rac-two' succeeded
CRS-2672: Attempting to start 'ora.cssdmonitor' on 'rac-two'
CRS-2672: Attempting to start 'ora.gipcd' on 'rac-two'
CRS-2676: Start of 'ora.cssdmonitor' on 'rac-two' succeeded
CRS-2676: Start of 'ora.gipcd' on 'rac-two' succeeded
CRS-2672: Attempting to start 'ora.cssd' on 'rac-two'
CRS-2672: Attempting to start 'ora.diskmon' on 'rac-two'
CRS-2676: Start of 'ora.diskmon' on 'rac-two' succeeded
CRS-2676: Start of 'ora.cssd' on 'rac-two' succeeded
ASM created and started successfully.
Disk Group GIDG created successfully.
clscfg: -install modespecified
Successfully accumulated necessary OCRkeys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
Successful addition of voting disk498646ba39604f86bf697c9748a67697.
Successful addition of voting disk2e1bd16f9e6d4f36bf93550dc8268725.
Successful addition of voting disk3fbd31a0b2634feabfa1115a504cbbe6.
Successfully replaced voting diskgroup with +GIDG.
CRS-4266: Voting file(s) successfullyreplaced
##STATEFile UniversalIdFile Name Disk group
--------------------------------- ---------
1. ONLINE498646ba39604f86bf697c9748a67697 (/dev/asm-diske) [GIDG]
2. ONLINE2e1bd16f9e6d4f36bf93550dc8268725 (/dev/asm-diskd) [GIDG]
3. ONLINE3fbd31a0b2634feabfa1115a504cbbe6 (/dev/asm-diskf) [GIDG]
Located 3 voting disk(s).
CRS-2672: Attempting to start 'ora.asm' on 'rac-two'
CRS-2676: Start of 'ora.asm' on 'rac-two' succeeded
CRS-2672: Attempting to start 'ora.GIDG.dg' on 'rac-two'
CRS-2676: Start of 'ora.GIDG.dg' on 'rac-two' succeeded
Preparing packages for installation...
cvuqdisk-1.0.9-1
Configure Oracle Grid Infrastructurefor a Cluster ... succeeded
[root@rac-twogrid]#
另外注意,如果asm磁盘损坏了那么需要重新修复磁盘,然后会自动重新创建之前的diskgroup.
至此olr和ocr创建成功
节点2:
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
[root@rac-one grid]# ./root.sh
Performing root user operation for Oracle 11g
The following environment variables areset as:
ORACLE_OWNER= grid
ORACLE_HOME=/u01/app/11.2.0/grid
Enter the full pathname of the local bin directory: [/usr/local/bin]:
The contents of "dbhome" have not changed. No need to overwrite.
The contents of "oraenv" have not changed. No need to overwrite.
The contents of "coraenv" have not changed. No need to overwrite.
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will beperformed.
Using configuration parameter file:/u01/app/11.2.0/grid/crs/install/crsconfig_params
User ignored Prerequisites duringinstallation
Installing Trace FileAnalyzer
OLR initialization -successful
Adding Clusterware entries to upstart
CRS-4402: The CSS daemon was startedin exclusive mode but found an active CSSdaemon on node rac-two, number 1, and is terminating
An active cluster was found duringexclusive startup, restarting to join the cluster
Preparing packages for installation...
cvuqdisk-1.0.9-1
Configure Oracle Grid Infrastructurefor a Cluster ... succeeded
[root@rac-one grid]#
3、检查资源信息:
现在呢开始使用srvctl和crsctl工具,这是oracle RAC 经常使用的,另外还有一个工具是oifcfg配置网卡信息等。不在介绍了。
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
[root@rac-one bin]# ./crsctl check crs
CRS-4638: Oracle High AvailabilityServices is online
CRS-4537: Cluster Ready Servicesis online
CRS-4529: Cluster Synchronization Servicesis online
CRS-4533: Event Manager is online
[root@rac-one bin]# ./crsctl stat res -t
--------------------------------------------------------------------------------
NAMETARGETSTATESERVERSTATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.GIDG.dg
ONLINEONLINErac-one
ONLINEONLINErac-two
ora.asm
ONLINEONLINErac-oneStarted
ONLINEONLINErac-twoStarted
ora.gsd
OFFLINE OFFLINErac-one
OFFLINE OFFLINErac-two
ora.net1.network
ONLINEONLINErac-one
ONLINEONLINErac-two
ora.ons
ONLINEONLINErac-one
ONLINEONLINErac-two
ora.registry.acfs
ONLINEONLINErac-one
ONLINEONLINErac-two
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1ONLINEONLINErac-one
ora.LISTENER_SCAN2.lsnr
1ONLINEONLINErac-two
ora.LISTENER_SCAN3.lsnr
1ONLINEONLINErac-two
ora.cvu
1ONLINEONLINErac-two
ora.oc4j
1ONLINEONLINErac-two
ora.rac-one.vip
1ONLINEONLINErac-one
ora.rac-two.vip
1ONLINEONLINErac-two
ora.scan1.vip
1ONLINEONLINErac-one
ora.scan2.vip
1ONLINEONLINErac-two
ora.scan3.vip
1ONLINEONLINErac-two
[root@rac-one bin]#
[root@rac-one bin]# su - grid
[grid@rac-one ~]$ sqlplus / as sysasm
SQL*Plus: Release 11.2.0.4.0 Productionon Tue Apr 1 17:40:53 2014
Copyright (c) 1982, 2013, Oracle.All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0- 64bit Production
With the Real Application Clusters and Automatic Storage Managementoptions
SQL> select name,state from v$asm_diskgroup;
NAMESTATE
-----------------------------------------
GIDGMOUNTED
DATADGDISMOUNTED
SQL> alter diskgroup datadg mount;
Diskgroup altered.
SQL>
4、添加资源
可以看到目前启动的缺少本地监听和database资源和实例,那么下面开始重新注册这些信息到ocr中,
注册listener:
注:使用grid用户:
?
1
2
3
4
5
[grid@rac-one ~]$ srvctl add listener -l listener
PRCN-2061 : Failed to add listener ora.LISTENER.lsnr
PRCN-2065 : Port(s) 1521 are not available on the nodes given
PRCN-2067 : Port 1521 is not available across node(s) "rac-two-vip"
[grid@rac-one~]$
提示1521该端口被ora.rac-two.vip所使用,暂且跳过
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
[grid@rac-one ~]$ crsctl stop resourceora.rac-two.vip
CRS-2673: Attempting to stop 'ora.rac-two.vip' on 'rac-two'
CRS-2677: Stop of 'ora.rac-two.vip' on 'rac-two' succeeded
[grid@rac-one ~]$ srvctl add listener -l listener
[grid@rac-one ~]$ crsctl start resourceora.rac-two.vip
CRS-2672: Attempting to start 'ora.rac-two.vip' on 'rac-two'
CRS-2676: Start of 'ora.rac-two.vip' on 'rac-two' succeeded
[grid@rac-one ~]$ srvctl configlistener
Name: LISTENER
Network: 1, Owner: grid
Home: <CRS home>
End points: TCP:1521
[grid@rac-one ~]$
[grid@rac-one ~]$
[grid@rac-one ~]$ crsctl stat res-t
--------------------------------------------------------------------------------
NAMETARGETSTATESERVERSTATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATADG.dg
ONLINEONLINErac-one
OFFLINE OFFLINErac-two
ora.GIDG.dg
ONLINEONLINErac-one
ONLINEONLINErac-two
ora.LISTENER.lsnr
OFFLINE OFFLINErac-one
OFFLINE OFFLINErac-two
ora.asm
ONLINEONLINErac-oneStarted
ONLINEONLINErac-twoStarted
ora.gsd
OFFLINE OFFLINErac-one
OFFLINE OFFLINErac-two
ora.net1.network
ONLINEONLINErac-one
ONLINEONLINErac-two
ora.ons
ONLINEONLINErac-one
ONLINEONLINErac-two
ora.registry.acfs
ONLINEONLINErac-one
ONLINEONLINErac-two
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1ONLINEONLINErac-one
ora.LISTENER_SCAN2.lsnr
1ONLINEONLINErac-two
ora.LISTENER_SCAN3.lsnr
1ONLINEONLINErac-two
ora.cvu
1ONLINEONLINErac-two
ora.oc4j
1ONLINEONLINErac-two
ora.rac-one.vip
1ONLINEONLINErac-one
ora.rac-two.vip
1ONLINEONLINErac-two
ora.scan1.vip
1ONLINEONLINErac-one
ora.scan2.vip
1ONLINEONLINErac-two
ora.scan3.vip
1ONLINEONLINErac-two
[grid@rac-one ~]$
至此监听添加到ocr完毕。下面开始添加db,注意使用oracle用户:
继续添加:
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
[grid@rac-one ~]$ su - oracle
Password:
[oracle@rac-one ~]$ srvctl add database -h
Adds a database configuration to the Oracle Clusterware.
Usage: srvctl add database -d <db_unique_name> -o<oracle_home> [-c {RACONENODE | RAC | SINGLE} [-e <server_list>] [-i<inst_name>] [-w <timeout>]] [-m <domain_name>] [-p<spfile>] [-r {PRIMARY | PHYSICAL_STANDBY | LOGICAL_STANDBY |SNAPSHOT_STANDBY}] [-s <start_options>] [-t <stop_options>] [-n<db_name>] [-y {AUTOMATIC | MANUAL | NORESTART}] [-g "<serverpool_list>"] [-x <node_name>] [-a "<diskgroup_list>"] [-j "<acfs_path_list>"]
-d <db_unique_name>Unique name for the database
-o <oracle_home>ORACLE_HOMEpath
-c <type>Typeof database: RAC One Node, RAC, or Single Instance
-e <server_list>Candidateserver list for RAC One Node database
-i <inst_name>Instancename prefix for administrator-managed RAC One Nodedatabase (default first 12 characters of <db_unique_name>)
-w <timeout>Onlinerelocation timeout in minutes
-x <node_name>Nodename. -x option is specified for single-instance databases
-m <domain>Domainfor database. Must be set if database has DB_DOMAIN set.
-p <spfile>Serverparameter file path
-r <role>Roleof the database (primary, physical_standby, logical_standby,snapshot_standby)
-s <start_options>Startupoptions for the database. Examples of startup options are OPEN, MOUNT, or 'READ ONLY'.
-t <stop_options>Stopoptions for the database. Examples of shutdown options are NORMAL,TRANSACTIONAL, IMMEDIATE, or ABORT.
-n <db_name>Database name (DB_NAME), if different from the unique name given by the -d option
-y <dbpolicy>Managementpolicy for the database (AUTOMATIC, MANUAL, or NORESTART)
-g "<serverpool_list>"Comma separated list of database server pool names
-a "<diskgroup_list>"Comma separated list of disk groups
-j "<acfs_path_list>"Comma separated list of ACFS paths where database's dependency will be set
-hPrintusage
[oracle@rac-one ~]$ srvctl add database -d Rac -o/u01/app/oracle/product/11.2.0/db_1/ -c RAC
[oracle@rac-one ~]$
[oracle@rac-one ~]$ srvctl add instance -h
Adds a database instance configuration to the Oracle Clusterware.
Usage: srvctl add instance -d <db_unique_name> -i<inst_name> -n <node_name> [-f]
-d <db_unique_name>Unique name for the database
-i <inst>Instancename
-n <node_name>Nodename
-fForce the add operation even though some resource(s) will be stopped
-hPrintusage
[oracle@rac-one ~]$ srvctl add instance -d Rac -i Rac1 -nrac-two
[oracle@rac-one ~]$ srvctl add instance -d Rac -i Rac2 -nrac-one
[oracle@rac-one ~]$
[oracle@rac-one ~]$ srvctl configdatabase -d Rac
Database unique name: Rac
Database name:
Oracle home:/u01/app/oracle/product/11.2.0/db_1/
Oracle user: oracle
Spfile:
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: Rac
Database instances: Rac2,Rac1
Disk Groups:
Mount point paths:
Services:
Type: RAC
Database is administrator managed
[oracle@rac-one~]$
重启crs。
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
[root@rac-one bin]# ./crsctl start cluster-all
CRS-2672: Attempting to start 'ora.cssdmonitor' on 'rac-one'
CRS-2672: Attempting to start 'ora.cssdmonitor' on 'rac-two'
CRS-2676: Start of 'ora.cssdmonitor' on 'rac-one' succeeded
CRS-2676: Start of 'ora.cssdmonitor' on 'rac-two' succeeded
CRS-2672: Attempting to start 'ora.cssd' on 'rac-two'
CRS-2672: Attempting to start 'ora.cssd' on 'rac-one'
CRS-2672: Attempting to start 'ora.diskmon' on 'rac-one'
CRS-2672: Attempting to start 'ora.diskmon' on 'rac-two'
CRS-2676: Start of 'ora.diskmon' on 'rac-one' succeeded
CRS-2676: Start of 'ora.diskmon' on 'rac-two' succeeded
CRS-2676: Start of 'ora.cssd' on 'rac-two' succeeded
CRS-2676: Start of 'ora.cssd' on 'rac-one' succeeded
CRS-2672: Attempting to start 'ora.ctssd' on 'rac-two'
CRS-2672: Attempting to start 'ora.ctssd' on 'rac-one'
CRS-2672: Attempting to start 'ora.cluster_interconnect.haip'on 'rac-one'
CRS-2672: Attempting to start 'ora.cluster_interconnect.haip'on 'rac-two'
CRS-2676: Start of 'ora.ctssd' on 'rac-one' succeeded
CRS-2672: Attempting to start 'ora.evmd' on 'rac-one'CRS-2676: Start of 'ora.ctssd' on 'rac-two' succeeded
CRS-2672: Attempting to start 'ora.evmd' on 'rac-two'
CRS-2676: Start of 'ora.evmd' on 'rac-one' succeeded
CRS-2676: Start of 'ora.evmd' on 'rac-two' succeeded
CRS-2676: Start of 'ora.cluster_interconnect.haip'on 'rac-one' succeeded
CRS-2672: Attempting to start 'ora.asm' on 'rac-one'
CRS-2676: Start of 'ora.cluster_interconnect.haip'on 'rac-two' succeeded
CRS-2672: Attempting to start 'ora.asm' on 'rac-two'
CRS-2676: Start of 'ora.asm' on 'rac-two' succeeded
CRS-2672: Attempting to start 'ora.crsd' on 'rac-two'
CRS-2676: Start of 'ora.crsd' on 'rac-two' succeeded
CRS-2676: Start of 'ora.asm' on 'rac-one' succeeded
CRS-2672: Attempting to start 'ora.crsd' on 'rac-one'
CRS-2676: Start of 'ora.crsd' on 'rac-one' succeeded
再次查看(等2分钟):
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
[root@rac-one bin]# ./crsctl stat res-t
--------------------------------------------------------------------------------
NAMETARGETSTATESERVERSTATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATADG.dg
ONLINEONLINErac-one
ONLINEONLINErac-two
ora.GIDG.dg
ONLINEONLINErac-one
ONLINEONLINErac-two
ora.LISTENER.lsnr
ONLINEONLINErac-one
ONLINEINTERMEDIATErac-twoNot All Endpoints R
egistered
ora.asm
ONLINEONLINErac-oneStarted
ONLINEONLINErac-twoStarted
ora.gsd
OFFLINE OFFLINErac-one
OFFLINE OFFLINErac-two
ora.net1.network
ONLINEONLINErac-one
ONLINEONLINErac-two
ora.ons
ONLINEONLINErac-one
ONLINEONLINErac-two
ora.registry.acfs
ONLINEONLINErac-one
ONLINEONLINErac-two
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1ONLINEONLINErac-one
ora.LISTENER_SCAN2.lsnr
1ONLINEONLINErac-two
ora.LISTENER_SCAN3.lsnr
1ONLINEONLINErac-two
ora.cvu
1ONLINEONLINErac-two
ora.oc4j
1ONLINEONLINErac-two
ora.rac-one.vip
1ONLINEONLINErac-one
ora.rac-two.vip
1ONLINEONLINErac-two
ora.rac.db
1ONLINEONLINErac-twoOpen
2ONLINEONLINErac-oneOpen
ora.scan1.vip
1ONLINEONLINErac-one
ora.scan2.vip
1ONLINEONLINErac-two
ora.scan3.vip
1ONLINEONLINErac-two
为什么会存在一个监听在rac-two上无法注册呢?
查看该节点监听:
?
1
2
3
4
5
[grid@rac-two admin]$ ps -ef | grepLISTENER
grid612010 17:02 ?00:00:00 /u01/app/11.2.0/grid/bin/tnslsnr LISTENER -inherit
grid851110 18:28 ?00:00:00 /u01/app/11.2.0/grid/bin/tnslsnr LISTENER_SCAN1 -inherit
grid1101010 18:42 ?00:00:00 /u01/app/11.2.0/grid/bin/tnslsnr LISTENER -inherit
grid1124691910 18:44 pts/100:00:00 grep LISTENER
原来是启动了两个,全部停掉再次重启:
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
[grid@rac-two admin]$ id
uid=1100(grid) gid=1000(oinstall)groups=1000(oinstall),1100(asmadmin),1200(dba),1300(asmdba),1301(asmoper)
[grid@rac-two admin]$ lsnrctl stop
LSNRCTL for Linux: Version 11.2.0.4.0 - Productionon 01-APR-2014 18:45:11
Copyright (c) 1991, 2013, Oracle.All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
The command completedsuccessfully
[grid@rac-two admin]$ ps -ef | grepLISTENER
grid612010 17:02 ?00:00:00 /u01/app/11.2.0/grid/bin/tnslsnr LISTENER -inherit
grid851110 18:28 ?00:00:00 /u01/app/11.2.0/grid/bin/tnslsnr LISTENER_SCAN1 -inherit
grid1145291910 18:45 pts/100:00:00 grep LISTENER
[grid@rac-two admin]$ exit
logout
[root@rac-two bin]# kill -96120
[root@rac-two bin]# ps -ef | grepLISTENER
grid851110 18:28 ?00:00:00 /u01/app/11.2.0/grid/bin/tnslsnr LISTENER_SCAN1 -inherit
root11518 112800 18:46 pts/100:00:00 grep LISTENER
[root@rac-two bin]# su - grid
[grid@rac-two ~]$ crsctl status res-t
--------------------------------------------------------------------------------
NAMETARGETSTATESERVERSTATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATADG.dg
ONLINEONLINErac-one
ONLINEONLINErac-two
ora.GIDG.dg
ONLINEONLINErac-one
ONLINEONLINErac-two
ora.LISTENER.lsnr
ONLINEONLINErac-one
OFFLINE OFFLINErac-two
ora.asm
ONLINEONLINErac-oneStarted
ONLINEONLINErac-twoStarted
ora.gsd
OFFLINE OFFLINErac-one
OFFLINE OFFLINErac-two
ora.net1.network
ONLINEONLINErac-one
ONLINEONLINErac-two
ora.ons
ONLINEONLINErac-one
ONLINEONLINErac-two
ora.registry.acfs
ONLINEONLINErac-one
ONLINEONLINErac-two
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1ONLINEONLINErac-two
ora.LISTENER_SCAN2.lsnr
1ONLINEONLINErac-one
ora.LISTENER_SCAN3.lsnr
1ONLINEONLINErac-one
ora.cvu
1ONLINEONLINErac-one
ora.oc4j
1ONLINEONLINErac-one
ora.rac-one.vip
1ONLINEONLINErac-one
ora.rac-two.vip
1ONLINEONLINErac-two
ora.rac.db
1ONLINEONLINErac-twoOpen
2ONLINEONLINErac-oneOpen
ora.scan1.vip
1ONLINEONLINErac-two
ora.scan2.vip
1ONLINEONLINErac-one
ora.scan3.vip
1ONLINEONLINErac-one
[grid@rac-two ~]$ crsctl start resourceora.LISTENER.lsnr
CRS-2672: Attempting to start 'ora.LISTENER.lsnr' on 'rac-two'
CRS-2676: Start of 'ora.LISTENER.lsnr' on 'rac-two' succeeded
[grid@rac-two ~]$
[grid@rac-two ~]$ crsctl stat res-t
--------------------------------------------------------------------------------
NAMETARGETSTATESERVERSTATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATADG.dg
ONLINEONLINErac-one
ONLINEONLINErac-two
ora.GIDG.dg
ONLINEONLINErac-one
ONLINEONLINErac-two
ora.LISTENER.lsnr
ONLINEONLINErac-one
ONLINEONLINErac-two
ora.asm
ONLINEONLINErac-oneStarted
ONLINEONLINErac-twoStarted
ora.gsd
OFFLINE OFFLINErac-one
OFFLINE OFFLINErac-two
ora.net1.network
ONLINEONLINErac-one
ONLINEONLINErac-two
ora.ons
ONLINEONLINErac-one
ONLINEONLINErac-two
ora.registry.acfs
ONLINEONLINErac-one
ONLINEONLINErac-two
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1ONLINEONLINErac-two
ora.LISTENER_SCAN2.lsnr
1ONLINEONLINErac-one
ora.LISTENER_SCAN3.lsnr
1ONLINEONLINErac-one
ora.cvu
1ONLINEONLINErac-one
ora.oc4j
1ONLINEONLINErac-one
ora.rac-one.vip
1ONLINEONLINErac-one
ora.rac-two.vip
1ONLINEONLINErac-two
ora.rac.db
1ONLINEONLINErac-twoOpen
2ONLINEONLINErac-oneOpen
ora.scan1.vip
1ONLINEONLINErac-two
ora.scan2.vip
1ONLINEONLINErac-one
ora.scan3.vip
1ONLINEONLINErac-one
[grid@rac-two~]$
至此所有问题得到彻底解决。