视频1 视频21 视频41 视频61 视频文章1 视频文章21 视频文章41 视频文章61 推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37 推荐39 推荐41 推荐43 推荐45 推荐47 推荐49 关键词1 关键词101 关键词201 关键词301 关键词401 关键词501 关键词601 关键词701 关键词801 关键词901 关键词1001 关键词1101 关键词1201 关键词1301 关键词1401 关键词1501 关键词1601 关键词1701 关键词1801 关键词1901 视频扩展1 视频扩展6 视频扩展11 视频扩展16 文章1 文章201 文章401 文章601 文章801 文章1001 资讯1 资讯501 资讯1001 资讯1501 标签1 标签501 标签1001 关键词1 关键词501 关键词1001 关键词1501 专题2001
Oracle11g搭建RAC步骤
2025-10-02 12:36:18 责编:小OO
文档
一、网卡绑定

1、修改配置文件

/etc/modprobe.conf

alias bond0 bonding

alias bond1 bonding

/etc/sysconfig/network-scripts/ifcfg-bond0

DEVICE=bond0

BOOTPROTO=static

ONBOOT=yes

USERCTL=no

IPADDR=192.168.56.101

BROADCAST=192.168.56.255

NETWORK=192.168.56.0

NETMASK=255.255.255.0

TYPE=Ethernet

BONDING_OPTS="mode=1 miimon=100"

/etc/sysconfig/network-scripts/ifcfg-bond1

DEVICE=bond1

BOOTPROTO=static

ONBOOT=yes

USERCTL=no

IPADDR=192.168.136.101

BROADCAST=192.168.136.255

NETWORK=192.168.136.0

NETMASK=255.255.255.0

TYPE=Ethernet

BONDING_OPTS="mode=1 miimon=100"

/etc/sysconfig/network-scripts/ifcfg-eth0

# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]

DEVICE=eth0

BOOTPROTO=none

ONBOOT=yes

USERCTL=no

HWADDR=00:0c:29:9e:87:44

MASTER=bond0

SLAVE=yes

/etc/sysconfig/network-scripts/ifcfg-eth1

# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]

DEVICE=eth1

BOOTPROTO=none

ONBOOT=yes

HWADDR=00:0c:29:9e:87:4e

MASTER=bond0

SLAVE=yes

/etc/sysconfig/network-scripts/ifcfg-eth2

# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]

DEVICE=eth2

BOOTPROTO=none

ONBOOT=yes

USERCTL=no

HWADDR=00:0c:29:9e:87:58

MASTER=bond1

SLAVE=yes

/etc/sysconfig/network-scripts/ifcfg-eth3

# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]

DEVICE=eth3

BOOTPROTO=none

ONBOOT=yes

HWADDR=00:0c:29:9e:87:62

USERCTL=no

MASTER=bond1

SLAVE=yes

 

命令:

ifensalve bond0 eth0 eth1 

ifensalve bond1 eth2 eth3

service network restart

 

2、检查配置

cat /proc/net/bonding/bond0

Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)

 

Bonding Mode: fault-tolerance (active-backup)

Primary Slave: None

Currently Active Slave: eth0

MII Status: up

MII Polling Interval (ms): 100

Up Delay (ms): 0

Down Delay (ms): 0

 

Slave Interface: eth0

MII Status: up

Link Failure Count: 0

Permanent HW addr: 00:0c:29:9e:87:44

Slave queue ID: 0

 

Slave Interface: eth1

MII Status: up

Link Failure Count: 0

Permanent HW addr: 00:0c:29:9e:87:4e

Slave queue ID: 0

 

cat /proc/net/bonding/bond1

Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)

 

Bonding Mode: fault-tolerance (active-backup)

Primary Slave: None

Currently Active Slave: eth2

MII Status: up

MII Polling Interval (ms): 100

Up Delay (ms): 0

Down Delay (ms): 0

 

Slave Interface: eth2

MII Status: up

Link Failure Count: 0

Permanent HW addr: 00:0c:29:9e:87:58

Slave queue ID: 0

 

Slave Interface: eth3

MII Status: up

Link Failure Count: 0

Permanent HW addr: 00:0c:29:9e:87:62

Slave queue ID: 0

 

3、测试自动切换

在vmware workstation界面上将相应的网卡(cat /proc/met/bonding/bondN)disconnect,依次测试。用ifdown、ifup方式不行不会自动切换

/etc/modprobe.conf (redhat6.0+:/etc/modprobe.d/dist.conf)需要添加fail_over_mac=1 => 切换的时候改MAC地址,不加不会切换成功(virtualbox、vmware workstation下测试)

 

 

二、建用户和组

groupadd oinstall -g 1000

groupadd dba -g 1001

groupadd asmadmin -g 1101

groupadd asmdba -g 1102

groupadd asmoper -g 1103

useradd -m -u 1001 -g oinstall -G asmadmin,asmdba,asmoper -d /home/grid grid

useradd -m -u 1002 -g dba -G oinstall,asmdba,asmoper -d /home/oracle oracle

 

三、创建磁盘

ocr、data ...

KERNEL=="sd?",BUS=="scsi",PROGRAM=="/sbin/scsi_id -g -u /dev/$name",RESULT=="36000c293bc7e9c8139a42cb118aa13",NAME="asm-ocr",OWNER="grid",GROUP="asmadmin",MODE="0660" RUN+="/bin/raw /dev/raw/raw1 /dev/asm-ocr"

KERNEL=="sd?",BUS=="scsi",PROGRAM=="/sbin/scsi_id -g -u /dev/$name",RESULT=="36000c2910f9afeaeaa3ef976f95c50",NAME="asm-data",OWNER="grid",GROUP="asmadmin",MODE="0660" RUN+="/bin/raw /dev/raw/raw2 /dev/asm-data"

 

ACTION=="add",KERNEL=="raw1", OWNER="grid", GROUP="asmadmin", MODE="660"

ACTION=="add",KERNEL=="raw2", OWNER="grid", GROUP="asmadmin", MODE="660"

 

四、安装Grid Infrastructure

这一步老是报错(报diskgroup相关错误,忘记记录了),改成预分配harddisk空间后成功

 

node1:

[root@oel501 ~]# /opt/grid/app/11.2.0/grid/root.sh 

Performing root user operation for Oracle 11g 

 

The following environment variables are set as:

    ORACLE_OWNER= grid

    ORACLE_HOME=  /opt/grid/app/11.2.0/grid

 

Enter the full pathname of the local bin directory: [/usr/local/bin]: 

 

The file "dbhome" already exists in /usr/local/bin.  Overwrite it? (y/n) 

[n]: The file "oraenv" already exists in /usr/local/bin.  Overwrite it? (y/n) 

[n]: 

The file "coraenv" already exists in /usr/local/bin.  Overwrite it? (y/n) 

[n]: 

 

 

Creating /etc/oratab file...

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 be performed.

Using configuration parameter file: /opt/grid/app/11.2.0/grid/crs/install/crsconfig_params

Creating trace directory

User ignored Prerequisites during installation

OLR initialization - successful

  root wallet

  root wallet cert

  root cert export

  peer wallet

  profile reader wallet

  pa wallet

  peer wallet keys

  pa wallet keys

  peer cert request

  pa cert request

  peer cert

  pa cert

  peer root cert TP

  profile reader root cert TP

  pa root cert TP

  peer pa cert TP

  pa peer cert TP

  profile reader pa cert TP

  profile reader peer cert TP

  peer user cert

  pa user cert

CRS-2728: A resource type with the name 'ora.daemon.type' is already registered

CRS-4000: Command Add failed, or completed with errors.

CRS-2728: A resource type with the name 'ora.haip.type' is already registered

CRS-4000: Command Add failed, or completed with errors.

CRS-2728: A resource type with the name 'ora.mdns.type' is already registered

CRS-4000: Command Add failed, or completed with errors.

Failed to register Grid Infrastructure type ora.mdns.type at /opt/grid/app/11.2.0/grid/crs/install/crsconfig_lib.pm line 7777.

/opt/grid/app/11.2.0/grid/perl/bin/perl -I/opt/grid/app/11.2.0/grid/perl/lib -I/opt/grid/app/11.2.0/grid/crs/install /opt/grid/app/11.2.0/grid/crs/install/rootcrs.pl execution failed

[root@oel501 ~]# /opt/grid/app/11.2.0/grid/root.sh 

Performing root user operation for Oracle 11g 

 

The following environment variables are set as:

    ORACLE_OWNER= grid

    ORACLE_HOME=  /opt/grid/app/11.2.0/grid

 

Enter the full pathname of the local bin directory: [/usr/local/bin]: 

The file "dbhome" already exists in /usr/local/bin.  Overwrite it? (y/n) 

[n]: 

The file "oraenv" already exists in /usr/local/bin.  Overwrite it? (y/n) 

[n]: 

The file "coraenv" already exists in /usr/local/bin.  Overwrite it? (y/n) 

[n]: 

 

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 be performed.

 

Using configuration parameter file: /opt/grid/app/11.2.0/grid/crs/install/crsconfig_params

User ignored Prerequisites during installation

 

 

 

 

^C

 

 

 

 

INT at /opt/grid/app/11.2.0/grid/crs/install/crsconfig_lib.pm line 1379.

/opt/grid/app/11.2.0/grid/perl/bin/perl -I/opt/grid/app/11.2.0/grid/perl/lib -I/opt/grid/app/11.2.0/grid/crs/install /opt/grid/app/11.2.0/grid/crs/install/rootcrs.pl execution failed

Oracle root script execution aborted!

 

[root@oel501 ~]# /opt/grid/app/11.2.0/grid/root.sh 

Performing root user operation for Oracle 11g 

 

The following environment variables are set as:

    ORACLE_OWNER= grid

    ORACLE_HOME=  /opt/grid/app/11.2.0/grid

 

Enter the full pathname of the local bin directory: [/usr/local/bin]: 

The file "dbhome" already exists in /usr/local/bin.  Overwrite it? (y/n) 

[n]: 

The file "oraenv" already exists in /usr/local/bin.  Overwrite it? (y/n) 

[n]: 

The file "coraenv" already exists in /usr/local/bin.  Overwrite it? (y/n) 

[n]: 

 

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 be performed.

Using configuration parameter file: /opt/grid/app/11.2.0/grid/crs/install/crsconfig_params

User ignored Prerequisites during installation

CRS-2672: Attempting to start 'ora.mdnsd' on 'oel501'

CRS-2676: Start of 'ora.mdnsd' on 'oel501' succeeded

CRS-2672: Attempting to start 'ora.gpnpd' on 'oel501'

CRS-2676: Start of 'ora.gpnpd' on 'oel501' succeeded

CRS-2672: Attempting to start 'ora.cssdmonitor' on 'oel501'

CRS-2672: Attempting to start 'ora.gipcd' on 'oel501'

CRS-2676: Start of 'ora.cssdmonitor' on 'oel501' succeeded

CRS-2676: Start of 'ora.gipcd' on 'oel501' succeeded

CRS-2672: Attempting to start 'ora.cssd' on 'oel501'

CRS-2672: Attempting to start 'ora.diskmon' on 'oel501'

CRS-2676: Start of 'ora.diskmon' on 'oel501' succeeded

CRS-2676: Start of 'ora.cssd' on 'oel501' succeeded

 

ASM created and started successfully.

 

Disk Group OCR created successfully.

 

clscfg: -install mode specified

Successfully accumulated necessary OCR keys.

Creating OCR keys for user 'root', privgrp 'root'..

Operation successful.

CRS-4256: Updating the profile

Successful addition of voting disk 71e7f2f09e7d4f1bbfa5e6eebf203d8f.

Successfully replaced voting disk group with +OCR.

CRS-4256: Updating the profile

CRS-4266: Voting file(s) successfully replaced

##  STATE    File Universal Id                File Name Disk group

--  -----    -----------------                --------- ---------

 1. ONLINE   71e7f2f09e7d4f1bbfa5e6eebf203d8f (/dev/raw/raw1) [OCR]

Located 1 voting disk(s).

 

CRS-2672: Attempting to start 'ora.asm' on 'oel501'

CRS-2676: Start of 'ora.asm' on 'oel501' succeeded

CRS-2672: Attempting to start 'ora.OCR.dg' on 'oel501'

CRS-2676: Start of 'ora.OCR.dg' on 'oel501' succeeded

Configure Oracle Grid Infrastructure for a Cluster ... succeeded

 

 

node2:

[root@oel502 ~]# /opt/grid/app/oraInventory/orainstRoot.sh

[root@oel502 ~]# /opt/grid/app/11.2.0/grid/root.sh 

Performing root user operation for Oracle 11g 

 

The following environment variables are set as:

    ORACLE_OWNER= grid

    ORACLE_HOME=  /opt/grid/app/11.2.0/grid

 

Enter the full pathname of the local bin directory: [/usr/local/bin]: 

 

The file "dbhome" already exists in /usr/local/bin.  Overwrite it? (y/n) 

[n]: The file "oraenv" already exists in /usr/local/bin.  Overwrite it? (y/n) 

[n]: 

The file "coraenv" already exists in /usr/local/bin.  Overwrite it? (y/n) 

[n]: 

 

 

Creating /etc/oratab file...

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 be performed.

Using configuration parameter file: /opt/grid/app/11.2.0/grid/crs/install/crsconfig_params

Creating trace directory

User ignored Prerequisites during installation

OLR initialization - successful

CRS-2728: A resource type with the name 'ora.daemon.type' is already registered

CRS-4000: Command Add failed, or completed with errors.

CRS-2728: A resource type with the name 'ora.haip.type' is already registered

CRS-4000: Command Add failed, or completed with errors.

CRS-2728: A resource type with the name 'ora.mdns.type' is already registered

CRS-4000: Command Add failed, or completed with errors.

Failed to register Grid Infrastructure type ora.mdns.type at /opt/grid/app/11.2.0/grid/crs/install/crsconfig_lib.pm line 7777.

/opt/grid/app/11.2.0/grid/perl/bin/perl -I/opt/grid/app/11.2.0/grid/perl/lib -I/opt/grid/app/11.2.0/grid/crs/install /opt/grid/app/11.2.0/grid/crs/install/rootcrs.pl execution failed

[root@oel502 ~]# /opt/grid/app/11.2.0/grid/root.sh 

Performing root user operation for Oracle 11g 

 

The following environment variables are set as:

    ORACLE_OWNER= grid

    ORACLE_HOME=  /opt/grid/app/11.2.0/grid

 

Enter the full pathname of the local bin directory: [/usr/local/bin]: 

The file "dbhome" already exists in /usr/local/bin.  Overwrite it? (y/n) 

[n]: 

The file "oraenv" already exists in /usr/local/bin.  Overwrite it? (y/n) 

[n]: 

The file "coraenv" already exists in /usr/local/bin.  Overwrite it? (y/n) 

[n]: 

 

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 be performed.

Using configuration parameter file: /opt/grid/app/11.2.0/grid/crs/install/crsconfig_params

User ignored Prerequisites during installation

CRS-2672: Attempting to start 'ora.mdnsd' on 'oel502'

CRS-2676: Start of 'ora.mdnsd' on 'oel502' succeeded

CRS-2672: Attempting to start 'ora.gpnpd' on 'oel502'

CRS-2676: Start of 'ora.gpnpd' on 'oel502' succeeded

CRS-2672: Attempting to start 'ora.cssdmonitor' on 'oel502'

CRS-2672: Attempting to start 'ora.gipcd' on 'oel502'

CRS-2676: Start of 'ora.gipcd' on 'oel502' succeeded

CRS-2676: Start of 'ora.cssdmonitor' on 'oel502' succeeded

CRS-2672: Attempting to start 'ora.cssd' on 'oel502'

CRS-2672: Attempting to start 'ora.diskmon' on 'oel502'

CRS-2676: Start of 'ora.diskmon' on 'oel502' succeeded

CRS-2674: Start of 'ora.cssd' on 'oel502' failed

CRS-2679: Attempting to clean 'ora.cssd' on 'oel502'

CRS-2681: Clean of 'ora.cssd' on 'oel502' succeeded

CRS-2673: Attempting to stop 'ora.gipcd' on 'oel502'

CRS-2677: Stop of 'ora.gipcd' on 'oel502' succeeded

CRS-2673: Attempting to stop 'ora.cssdmonitor' on 'oel502'

CRS-2677: Stop of 'ora.cssdmonitor' on 'oel502' succeeded

CRS-2673: Attempting to stop 'ora.gpnpd' on 'oel502'

CRS-2677: Stop of 'ora.gpnpd' on 'oel502' succeeded

CRS-2673: Attempting to stop 'ora.mdnsd' on 'oel502'

CRS-2677: Stop of 'ora.mdnsd' on 'oel502' succeeded

CRS-4000: Command Start failed, or completed with errors.

CSS startup failed with return code 1

The exlusive mode cluster start failed, see Grid Infrastructure alert log for more information

Initial cluster configuration failed.  See /opt/grid/app/11.2.0/grid/cfgtoollogs/crsconfig/rootcrs_oel502.log for details

/opt/grid/app/11.2.0/grid/perl/bin/perl -I/opt/grid/app/11.2.0/grid/perl/lib -I/opt/grid/app/11.2.0/grid/crs/install /opt/grid/app/11.2.0/grid/crs/install/rootcrs.pl execution failed

[root@oel502 ~]# /opt/grid/app/11.2.0/grid/root.sh 

Performing root user operation for Oracle 11g 

 

The following environment variables are set as:

    ORACLE_OWNER= grid

    ORACLE_HOME=  /opt/grid/app/11.2.0/grid

 

Enter the full pathname of the local bin directory: [/usr/local/bin]: 

The file "dbhome" already exists in /usr/local/bin.  Overwrite it? (y/n) 

[n]: 

The file "oraenv" already exists in /usr/local/bin.  Overwrite it? (y/n) 

[n]: 

The file "coraenv" already exists in /usr/local/bin.  Overwrite it? (y/n) 

[n]: 

 

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 be performed.

Using configuration parameter file: /opt/grid/app/11.2.0/grid/crs/install/crsconfig_params

User ignored Prerequisites during installation

CRS-4402: The CSS daemon was started in exclusive mode but found an active CSS daemon on node oel501, number 1, and is terminating

An active cluster was found during exclusive startup, restarting to join the cluster

 

[root@oel502 grid]# /opt/grid/app/11.2.0/grid/crs/install/rootcrs.pl -verbose -deconfig -force

Using configuration parameter file: /opt/grid/app/11.2.0/grid/crs/install/crsconfig_params

Network exists: 1/192.168.56.0/255.255.255.0/bond1, type static

VIP exists: /oel501-vip/192.168.56.201/192.168.56.0/255.255.255.0/bond1, hosting node oel501

GSD exists

ONS exists: Local port 6100, remote port 6200, EM port 2016

PRKO-2439 : VIP does not exist.

 

PRKO-2313 : VIP oel502 does not exist.

CLSU-00100: Operating System function: failed failed with error data: 2

CLSU-00101: Operating System error message: No such file or directory

CLSU-00103: error location: scrsearch3

CLSU-00104: additional error information: id doesnt exist scls_scr_setval

CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'oel502'

CRS-2673: Attempting to stop 'ora.crsd' on 'oel502'

CRS-2790: Starting shutdown of Cluster Ready Services-managed resources on 'oel502'

CRS-2673: Attempting to stop 'ora.OCR.dg' on 'oel502'

CRS-2677: Stop of 'ora.OCR.dg' on 'oel502' succeeded

CRS-2673: Attempting to stop 'ora.asm' on 'oel502'

CRS-2677: Stop of 'ora.asm' on 'oel502' succeeded

CRS-2792: Shutdown of Cluster Ready Services-managed resources on 'oel502' has completed

CRS-2677: Stop of 'ora.crsd' on 'oel502' succeeded

CRS-2673: Attempting to stop 'ora.crf' on 'oel502'

CRS-2673: Attempting to stop 'ora.ctssd' on 'oel502'

CRS-2673: Attempting to stop 'ora.evmd' on 'oel502'

CRS-2673: Attempting to stop 'ora.asm' on 'oel502'

CRS-2673: Attempting to stop 'ora.mdnsd' on 'oel502'

CRS-2677: Stop of 'ora.evmd' on 'oel502' succeeded

CRS-2677: Stop of 'ora.crf' on 'oel502' succeeded

CRS-2677: Stop of 'ora.ctssd' on 'oel502' succeeded

CRS-2677: Stop of 'ora.mdnsd' on 'oel502' succeeded

CRS-2677: Stop of 'ora.asm' on 'oel502' succeeded

CRS-2673: Attempting to stop 'ora.cluster_interconnect.haip' on 'oel502'

CRS-2677: Stop of 'ora.cluster_interconnect.haip' on 'oel502' succeeded

CRS-2673: Attempting to stop 'ora.cssd' on 'oel502'

CRS-2677: Stop of 'ora.cssd' on 'oel502' succeeded

CRS-2673: Attempting to stop 'ora.gipcd' on 'oel502'

CRS-2677: Stop of 'ora.gipcd' on 'oel502' succeeded

CRS-2673: Attempting to stop 'ora.gpnpd' on 'oel502'

CRS-2677: Stop of 'ora.gpnpd' on 'oel502' succeeded

CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'oel502' has completed

CRS-4133: Oracle High Availability Services has been stopped.

Successfully deconfigured Oracle clusterware stack on this node

 

[root@oel502 grid]# /opt/grid/app/11.2.0/grid/root.sh 

Performing root user operation for Oracle 11g 

 

The following environment variables are set as:

    ORACLE_OWNER= grid

    ORACLE_HOME=  /opt/grid/app/11.2.0/grid

 

Enter the full pathname of the local bin directory: [/usr/local/bin]: 

The file "dbhome" already exists in /usr/local/bin.  Overwrite it? (y/n) 

[n]: The file "oraenv" already exists in /usr/local/bin.  Overwrite it? (y/n) 

[n]: The file "coraenv" already exists in /usr/local/bin.  Overwrite it? (y/n) 

[n]: 

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 be performed.

Using configuration parameter file: /opt/grid/app/11.2.0/grid/crs/install/crsconfig_params

User ignored Prerequisites during installation

OLR initialization - successful

Adding Clusterware entries to inittab

CRS-4402: The CSS daemon was started in exclusive mode but found an active CSS daemon on node oel501, number 1, and is terminating

An active cluster was found during exclusive startup, restarting to join the cluster

Preparing packages for installation...

cvuqdisk-1.0.9-1

Configure Oracle Grid Infrastructure for a Cluster ... succeeded

 

五、安装DB software

出现: invalid distance code, invalid block type,重新解压安装介质后成功:

 

六、create db

这里选了admin-managed

....

22%时,虚拟机重启了。。尝试create database 方式手工添加 

[oracle@oel501 ~]$ orapw file=$ORACLE_HOME/dbs/orapwRAC password=zzzz entries=5 force=y

[oracle@oel501 ~]$ cat init.ora |grep -v ^# > initRAC1.ora;

[oracle@oel501 ~]$ vi initRAC1.ora

*.compatible='11.2.0'

*.control_files='+DATA/RAC/CONTROLFILE/control00.ctl'

*.db_block_size=8192

*.db_name='RAC'

*.open_cursors=300

*.pga_aggregate_target=120M

*.processes=150

*.remote_login_passwordfile='EXCLUSIVE'

*.sga_target=256M

[oracle@oel501 ~]$ sqlplus / as sysdba

SQL> startup nomount;

SQL> create spfile='+DATA/RAC/SPFILE/spfileRAC.ora' from pfile;

SQL> shutdown abort;

[oracle@oel501 ~]$ vi initRAC1.ora

spfile='+DATA/RAC/SPFILE/spfileRAC.ora'

[oracle@oel501 ~]$ sqlplus / as sysdba

SQL> startup nomount

SQL> CREATE DATABASE RAC

  2  USER SYS IDENTIFIED BY zzzz

  3  USER SYSTEM IDENTIFIED BY zzzz

  4  LOGFILE

  5    GROUP 1 ('+DATA/RAC/ONLINELOG/redo1_01.rdo') SIZE 25M BLOCKSIZE 512,

  6    GROUP 2 ('+DATA/RAC/ONLINELOG/redo1_02.rdo') SIZE 25M BLOCKSIZE 512

  7  MAXLOGFILES 5

  8  MAXLOGMEMBERS 5

  9  MAXLOGHISTORY 1

 10  MAXDATAFILES 100

 11  CHARACTER SET AL32UTF8

 12  NATIONAL CHARACTER SET AL16UTF16

 13  EXTENT MANAGEMENT LOCAL

 14  DATAFILE '+DATA/RAC/DATAFILE/system00.dbf' SIZE 700M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED

 15  SYSAUX DATAFILE '+DATA/RAC/DATAFILE/sysaux00.dbf' SIZE 700M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED

 16  DEFAULT TEMPORARY TABLESPACE tempts1

 17  TEMPFILE '+DATA/RAC/TEMPFILE/temp01.dbf' SIZE 20M REUSE

 18  UNDO TABLESPACE undotbs1

 19  DATAFILE '+DATA/RAC/DATAFILE/undotbs1_01.dbf'

 20  SIZE 100M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;

Database created.

[oracle@oel501 ~]$ srvctl add database -d RAC -o /opt/oracle/app/oracle/product/11.2.0/dbhome_1 -c RAC -p +DATA/RAC/spfile/spfileRAC.ora

[oracle@oel501 ~]$ srvctl add instance -d RAC -i RAC1 -n oel501

[oracle@oel501 ~]$ srvctl add instance -d RAC -i RAC2 -n oel502

[grid@oel501 ~]$ srvctl stop instance -d RAC -n oel501

[grid@oel501 ~]$ srvctl start instance -d RAC -n oel501

[grid@oel501 ~]$ srvctl  stop instance -d RAC -n oel502

[grid@oel501 ~]$ srvctl start instance -d RAC -n oel502

PRCR-1013 : Failed to start resource ora.rac.db

PRCR-10 : Failed to start resource ora.rac.db on node oel502

CRS-2546: Server 'oel502' is not online

 

[oracle@oel501 ~]$ sqlplus / as sysdba

SQL> @?/rdbms/admin/catalog

SQL> @?/rdbms/admin/catproc

...等一段时间

SQL> alter system set undo_tablespace=undotbs1 scope=spfile sid='RAC1';

SQL> alter system set undo_tablespace=undotbs2 scope=spfile sid='RAC2';

SQL> alter database add logfile instance 'RAC2' group 3 '+DATA/rac/onlinelog/redo2_01.rdo' size 25M

SQL> alter database add logfile instance 'RAC2' group 4 '+DATA/rac/onlinelog/redo2_02.rdo' size 25M

SQL> alter database enable thread 2;

SQL> shutdown immediate;

[root@oel502 ~]# /opt/grid/app/11.2.0.3/grid/crs/install/roothas.pl -verbose -deconfig -force 

[root@oel502 ~]# /opt/grid/app/11.2.0.3/grid/root.sh

[oracle@oel502 ~]$ sqlplus / as sysdba

SQL> startup

...

Database opened.

[grid@oel501 ~]$ srvctl start instance -d rac -n oel501

PRCR-1013 : Failed to start resource ora.rac.db

PRCR-10 : Failed to start resource ora.rac.db on node oel501

CRS-5017: The resource action "ora.rac.db start" encountered the following error: 

ORA-01034: ORACLE not available

ORA-27101: shared memory realm does not exist

Linux-x86_ Error: 2: No such file or directory

Process ID: 0

Session ID: 0 Serial number: 0

. For details refer to "(:CLSN00107:)" in "/opt/grid/app/11.2.0/grid/log/oel501/agent/crsd/oraagent_oracle/oraagent_oracle.log".

CRS-2674: Start of 'ora.rac.db' on 'oel501' failed

$DIAG_INFO/rdbms/trace/alertlog: USER (ospid: 22841): terminating the instance due to error 304

[grid@oel501 ~]$ oerr ora 304

00304, 00000, "requested INSTANCE_NUMBER is busy"

// *Cause:  An instance tried to start by using a value of the

//          initialization parameter INSTANCE_NUMBER that is already in use.

// *Action: Either

//       a) specify another INSTANCE_NUMBER,

//       b) shut down the running instance with this number

//       c) wait for instance recovery to complete on the instance with

//          this number.

[oracle@oel502 ~]$ sqlplus / as sysdba

SQL> show parameter instance_number

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

instance_number                      integer     0

SQL> alter system set instance_number=2 scope=spfile sid='RAC2';

SQL> shutdown immediate

[oracle@oel501 ~]$ sqlplus / as sysdba

SQL> startup nomount

SQL> show parameter instance_number

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

instance_number                      integer     0

SQL> alter system set instance_number=1 scope=spfile sid='RAC1';

SQL> shutdown immediate

 

[grid@oel502 ~]$ srvctl start instance -d rac -n oel502

PRCR-1013 : Failed to start resource ora.rac.db

PRCR-10 : Failed to start resource ora.rac.db on node oel502

CRS-5017: The resource action "ora.rac.db start" encountered the following error: 

ORA-01102: cannot mount database in EXCLUSIVE mode

. For details refer to "(:CLSN00107:)" in "/opt/grid/app/11.2.0/grid/log/oel502/agent/crsd/oraagent_oracle/oraagent_oracle.log".

CRS-2674: Start of 'ora.rac.db' on 'oel502' failed

$DIAG_INFO/rdbms/trace/alertlog: USER (ospid: 8609): terminating the instance due to error 1102

[grid@oel502 ~]$ oerr ora 1102

01102, 00000, "cannot mount database in EXCLUSIVE mode"

// *Cause:  Some other instance has the database mounted exclusive or shared.

// *Action: Shutdown other instance or mount in a compatible mode.

[oracle@oel502 dbs]$ sqlplus / as sysdba

SQL> show parameter cluster

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

cluster_database                     boolean     FALSE

cluster_database_instances           integer     1

cluster_interconnects                string

SQL> alter system set cluster_database=true scope=spfile;

SQL> alter system set cluster_database_instances=2 scope=spfile;

[grid@oel502 ~]$ srvctl start instance -d rac -n oel502

[grid@oel501 ~]$ srvctl start instance -d rac -n oel501

 

成了!

 

十八、故障

(1)操作系统重启,ohasd起不来,操作系统日志:autorun file for ohasd is missing

检查 grep AUTO /etc/init.d/init.ohasd

[grid@oel501 ~]$ grep AUTO /etc/init.d/init.ohasd 

AUTORUNFILE=/etc/oracle/scls_scr/$MY_HOST/root/ohasdrun   ---------- 这个文件少了,检查节点二,里面就一个单词:restart

     if [ -r $AUTORUNFILE ]

      case `$CAT $AUTORUNFILE` in

     $ECHO "stop" > $AUTORUNFILE

     if [ -r $AUTORUNFILE ]

       case `$CAT $AUTORUNFILE` in

          $ECHO "restart" > $AUTORUNFILE

                $ECHO "stop" > $AUTORUNFILE

执行以下命令后crs起来了:

1、/opt/grid/app/11.2.0.3/grid/crs/install/roothas.pl -verbose -deconfig -force 

2、/opt/grid/app/11.2.0.3/grid/root.sh

 

十九、ORACLE11G RAC管理

1、启动

...

2、关闭

[root@oel502 grid]# crsctl stop has -f

CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'oel502'

CRS-2673: Attempting to stop 'ora.crsd' on 'oel502'

CRS-2790: Starting shutdown of Cluster Ready Services-managed resources on 'oel502'

CRS-2673: Attempting to stop 'ora.OCR.dg' on 'oel502'

CRS-2673: Attempting to stop 'ora.LISTENER_SCAN1.lsnr' on 'oel502'

CRS-2677: Stop of 'ora.LISTENER_SCAN1.lsnr' on 'oel502' succeeded

CRS-2673: Attempting to stop 'ora.scan1.vip' on 'oel502'

CRS-2677: Stop of 'ora.scan1.vip' on 'oel502' succeeded

CRS-2672: Attempting to start 'ora.scan1.vip' on 'oel501'

CRS-2676: Start of 'ora.scan1.vip' on 'oel501' succeeded

CRS-2672: Attempting to start 'ora.LISTENER_SCAN1.lsnr' on 'oel501'

CRS-2676: Start of 'ora.LISTENER_SCAN1.lsnr' on 'oel501' succeeded

CRS-2677: Stop of 'ora.OCR.dg' on 'oel502' succeeded

CRS-2673: Attempting to stop 'ora.asm' on 'oel502'

CRS-2677: Stop of 'ora.asm' on 'oel502' succeeded

CRS-2673: Attempting to stop 'ora.ons' on 'oel502'

CRS-2677: Stop of 'ora.ons' on 'oel502' succeeded

CRS-2673: Attempting to stop 'ora.net1.network' on 'oel502'

CRS-2677: Stop of 'ora.net1.network' on 'oel502' succeeded

CRS-2792: Shutdown of Cluster Ready Services-managed resources on 'oel502' has completed

CRS-2677: Stop of 'ora.crsd' on 'oel502' succeeded

CRS-2673: Attempting to stop 'ora.ctssd' on 'oel502'

CRS-2673: Attempting to stop 'ora.evmd' on 'oel502'

CRS-2673: Attempting to stop 'ora.asm' on 'oel502'

CRS-2673: Attempting to stop 'ora.mdnsd' on 'oel502'

CRS-2677: Stop of 'ora.evmd' on 'oel502' succeeded

CRS-2677: Stop of 'ora.ctssd' on 'oel502' succeeded

CRS-2677: Stop of 'ora.mdnsd' on 'oel502' succeeded

CRS-2677: Stop of 'ora.asm' on 'oel502' succeeded

CRS-2673: Attempting to stop 'ora.cluster_interconnect.haip' on 'oel502'

CRS-2677: Stop of 'ora.cluster_interconnect.haip' on 'oel502' succeeded

CRS-2673: Attempting to stop 'ora.cssd' on 'oel502'

CRS-2677: Stop of 'ora.cssd' on 'oel502' succeeded

CRS-2673: Attempting to stop 'ora.crf' on 'oel502'

CRS-2677: Stop of 'ora.crf' on 'oel502' succeeded

CRS-2673: Attempting to stop 'ora.gipcd' on 'oel502'

CRS-2677: Stop of 'ora.gipcd' on 'oel502' succeeded

CRS-2673: Attempting to stop 'ora.gpnpd' on 'oel502'

CRS-2677: Stop of 'ora.gpnpd' on 'oel502' succeeded

CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'oel502' has completed

CRS-4133: Oracle High Availability Services has been stopped.

 

二十、清除ORACLE11G RAC

1、/etc/oracle 目录

2、cat /etc/inittab |grep init.ohasd 这一行 (用inittab.no_crs 替换inittab)

3、/etc/oraInst.loc

4、/etc/oratab

5、ORACLE_HOME、ORACLE_BASE等目录的下的软连接

6、[root@oel502 etc]# find . |grep ohasd

./oracle/scls_scr/oel502/root/ohasdrun

./oracle/scls_scr/oel502/root/ohasdstr

./rc.d/rc0.d/K15ohasd

./rc.d/rc4.d/K15ohasd

./rc.d/rc3.d/K15ohasd

./rc.d/rc3.d/S96ohasd

./rc.d/init.d/init.ohasd

./rc.d/init.d/ohasd

./rc.d/rc2.d/K15ohasd

./rc.d/rc1.d/K15ohasd

./rc.d/rc5.d/S96ohasd

./rc.d/rc6.d/K15ohasd

7、清理磁盘(dd命令)

 

 

 下载本文

显示全文
专题