在 RedHat6.2 上安装 Oracle 11gR2 -- VMware + ASM
实验环境:
OS: Redhat6.2 x64
Database: Oracle Database 11gR2 x64 (11.2.0.1.0)
VMware: VMware Workstation 9.0.0 build-812388
实验步骤:
1. 添加磁盘
1.1. 编辑虚拟机配置
1.2. 添加硬件
1.3. 添加第一块硬盘
1.4. 创建新的虚拟磁盘
1.5. 选择磁盘类型
1.6. 设置磁盘大小
创建一个单个硬盘
1.7. 完成
1.8.
添加第二块磁盘:重复步骤 1~7
1.9.
2. 格式化磁盘
磁盘添加完成后,启动虚拟机,作为 root 用户登录系统,格式化新添加的两块磁盘。
注意到这这就可以了,不要用网上说的把硬盘格式化成文件系统了,也不需要把它们挂载到/etc/fstab目录下,否则你的系统可能启动不了
磁盘格式化完成后,查看所有磁盘情况。
3. 配置用户及用户组
3.l. 添加用户组
groupadd -g 500 oinstall
groupadd -g 501 dba
groupadd -g 502 asmadmin
groupadd -g 503 asmdba
groupadd -g 504 oper
groupadd -g 505 asmoper
3.1.1 查看用户组
cat /etc/group
3.2. 添加用户,并给用户指定组
useradd -g oinstall -G dba,oper,asmdba oracle
useradd -g oinstall -G asmadmin,asmdba,asmoper,dba grid
3.2.1 查看用户组
ls -l /etc/group 查看所有的用户组及权限
2.2 为已有用户指定组
usermod -G dba,oper,asmdba oracle
3.3.创建软件安装目录
mkdir -p /u01/grid/product
mkdir -p /u01/app/product/db
3.4.为目录赋权限
chown -R grid:oinstall /u01
chown -R oracle:oinstall /u01/app
chmod -R 775 /u01
3.5为用户指定密码
passwd grid
passwd oracle
4.配置环境
su grid
cd ~
vim .bash_profile
export ORACLE_BASE=/u01/grid
export ORACLE_HOME=$ORACLE_BASE/product
export ORACLE_SID=+ASM
export PATH=$ORACLE_HOME/bin:$PATH
source .bash_profile
su oracle
cd ~
vim .bash_profile
export ORACLE_BASE=/u01/app
export ORACLE_HOME=$ORACLE_BASE/product/db
export ORACLE_SID=orcl
export PATH=$ORACLE_HOME/bin:$PATH
source .bash_profile
vi /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
vi /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
grid soft nproc 2047
grid hard nproc 16384
grid soft nofile 1024
grid hard nofile 65536
5. 配置 udev 绑定的 scsi_id
注意以下两点:
5.1. 不同的操作系统,scsi_id 命令的位置不同。
[root@localhost~]# cat /etc/issue
OracleLinux Server release 6.4
Kernel\r on an \m
[root@localhost~]# which scsi_id
/sbin/scsi_id
[root@localhost~]#
5.2. 编辑/etc/scsi_id.config 文件,如果该文件不存在,则创建该文件并添加如下行:
[root@localhost~]# cat /etc/scsi_id.config
options=--whitelisted--replace-whitespace
[root@localhost~]#
5.3.如果是使用 VMware 虚拟机,直接输入 scsi_id 命令可能无法获取 id,需修改 VMware 文件参数。
[root@localhost~]# scsi_id --whitelisted --replace-whitespace --device=/dev/sdb
[root@localhost~]# scsi_id --whitelisted --replace-whitespace --device=/dev/sdc
D:\VMs\Oracle Database 11gR2\OracleDatabase 11gR2.vmx
使用文本编辑器编辑该文件,在尾部新增一行参数:
disk.EnableUUID="TRUE"
保存文件,启动虚拟机。
[root@localhost~]# scsi_id --whitelisted --replace-whitespace --device=/dev/sdb
36000c29fe0fc917d7e9982742a28ce7c
[root@localhost~]# scsi_id --whitelisted --replace-whitespace --device=/dev/sdc
36000c293ffc0900fd932348de4b6baf8
[root@localhost~]#
6.创建并配置 udev rules 文件
[root@localhost~]# vi /etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL=="sd*"(单独硬盘用此配置),SUBSYSTEM=="block"(指定为block), PROGRAM=="/sbin/scsi_id(scsi_id命令的位置) --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c29fe0fc917d7e9982742a28ce7c", NAME="asm-diskb",OWNER="grid",GROUP="asmadmin"(grid用户和组), MODE="0660"
以上为讲解,具体配置如下:
KERNEL=="sd*",SUBSYSTEM=="block", PROGRAM=="/sbin/scsi_id --whitelisted--replace-whitespace--device=/dev/$name",RESULT=="36000c294665bf9a869613045b0f61a45",NAME="asm-diskb", OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="sd*",SUBSYSTEM=="block", PROGRAM=="/sbin/scsi_id --whitelisted--replace-whitespace--device=/dev/$name",RESULT=="36000c29901645cea4ee84aa899560d4d",NAME="asm-diskc", OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="sd*",SUBSYSTEM=="block", PROGRAM=="/sbin/scsi_id --whitelisted--replace-whitespace--device=/dev/$name",RESULT=="36000c29d0c9d6b62e4705b96147ca9b6",NAME="asm-diskd", OWNER="grid",GROUP="asmadmin",MODE="0660"
根据步骤 5 获取的 ID 修改 RESULT 值
7. 添加完成后,重启 udev,不同 Linux 发行版本重启方式不一样。
[root@localhost~]# start_udev
Startingudev: [ OK ]
[root@localhost~]#
13. 为 Linux系统配置本地YUM 源
13.1. 创建光盘挂载目录
# mkdir/media/cdrom
此处可省略
14. 通过 ZMODEM 上传文件 linux.x64_11gR2_grid.zip 至用户家目录 /home/grid/
[root@localhost~]# ll /home/grid/
total1028228
-rw-r--r--1 root root 1052897657 Oct 16 13:22 linux.x64_11gR2_grid.zip
[root@localhost~]#
15. 解压文件
[root@localhostgrid]# unzip linux.x64_11gR2_grid.zip
[root@localhostgrid]# ll
total1028232
drwxr-xr-x8 root root 4096 Aug 21 2009 grid
-rw-r--r--1 root root 1052897657 Oct 16 13:22 linux.x64_11gR2_grid.zip
[root@localhostgrid]#
16. 作为 grid 用户登录系统,执行安装程序。
16.1. 检查安装脚本是否具有可执行权限
[grid@localhostgrid]$ id
uid=501(grid)gid=500(oinstall)groups=500(oinstall),501(dba),503(asmadmin),504(asmoper),505(asmdba)
[grid@localhostgrid]$ ll runInstaller
-rwxr-xr-x1 root root 3227 Aug 15 2009runInstaller
[grid@localhostgrid]$
如果无可执行权限,执行以下命令进行授权:
[root@localhost~]# chown -R grid:oinstall /home/grid/grid/
[root@localhost~]# ll /home/grid/grid/runInstaller
-rwxr-xr-x1 grid oinstall 3227 Aug 15 2009/home/grid/grid/runInstaller
[root@localhost~]#
16.2.执行安装脚本/home/grid/grid/runInstaller
Xshell 会话设置如下:
17. 安装过程
17. 安装过程
[grid@localhost~]$ /home/grid/grid/runInstaller
StartingOracle Universal Installer...
CheckingTemp space: must be greater than 120 MB. Actual 38826 MB Passed
Checkingswap space: must be greater than 150 MB. Actual 4095 MB Passed
Checkingmonitor: must be configured to display at least 256 colors. Actual 16777216 Passed
Preparingto launch Oracle Universal Installer from /tmp/OraInstall2013-10-17_03-31-41PM.Please wait ...[grid@localhost ~]$
17.1.
17.2.
17.3.
17.4.
17.5.
17.6.
17.6.1. 检查安装条件
17.6.2.
执行修复脚本:
[root@localhost~]# /tmp/CVU_11.2.0.1.0_grid/runfixup.sh
Responsefile being used is :/tmp/CVU_11.2.0.1.0_grid/fixup.response
Enablefile being used is :/tmp/CVU_11.2.0.1.0_grid/fixup.enable
Logfile location: /tmp/CVU_11.2.0.1.0_grid/orarun.log
SettingKernel Parameters...
kernel.sem= 250 32000 100 128
fs.file-max= 6815744
net.ipv4.ip_local_port_range= 9000 65500
net.core.rmem_default= 262144
net.core.wmem_default= 262144
net.core.rmem_max= 4194304
net.core.wmem_max= 1048576
fs.aio-max-nr= 1048576
17.6.3. 安装缺失软件包
# yum install-y package_name
这些软件包其实已安装,只不过因为 OracleLinux 6.2 自带的软件包版本高于检查版本,所以检查不通过,忽略即可。
Oracle Linux 6.2 的安装光盘中无 pdksh 软件包,安装 ksh 软件包即可。
# yum install -yksh
因为没有 NTP 时钟服务器,所以 NTP 检查不通过,忽略即可。
17.6.4.
17.7.
17.8.
17.9. 安装时间较长,请耐心等待。
安装过程中会弹出对话框,提示你以 root 身份执行两个脚本:
[root@localhost~]# /u01/app/oraInventory/orainstRoot.sh
Changingpermissions of /u01/app/oraInventory.
Addingread,write permissions for group.
Removingread,write,execute permissions for world.
Changinggroupname of /u01/app/oraInventory to oinstall.
Theexecution of the script is complete.
[root@localhost~]# /u01/app/11.2.0/grid/root.sh
RunningOracle 11g root.sh script...
Thefollowing environment variables are set as:
ORACLE_OWNER= grid
ORACLE_HOME= /u01/app/11.2.0/grid
Enterthe full pathname of the local bin directory: [/usr/local/bin]: -- 输入回车
Copying dbhome to /usr/local/bin ...
Copying oraenv to /usr/local/bin ...
Copying coraenv to /usr/local/bin ...
Creating/etc/oratab file...
Entrieswill be added to the /etc/oratab file as needed by
DatabaseConfiguration Assistant when a database is created
Finishedrunning generic part of root.sh script.
Nowproduct-specific root actions will be performed.
Toconfigure Grid Infrastructure for a Stand-Alone Server run the followingcommand as the root user: -- 单实例安装需执行以下脚本
/u01/app/11.2.0/grid/perl/bin/perl-I/u01/app/11.2.0/grid/perl/lib -I/u01/app/11.2.0/grid/crs/install/u01/app/11.2.0/grid/crs/install/roothas.pl
Toconfigure Grid Infrastructure for a Cluster perform the following steps:
1.Provide values for Grid Infrastructure configuration parameters in the file -/u01/app/11.2.0/grid/crs/install/crsconfig_params. For details on how to dothis, see the installation guide.
2.Run the following command as the root user:
/u01/app/11.2.0/grid/perl/bin/perl-I/u01/app/11.2.0/grid/perl/lib -I/u01/app/11.2.0/grid/crs/install/u01/app/11.2.0/grid/crs/install/rootcrs.pl
Toupdate inventory properties for Grid Infrastructure, perform the following
steps.If a pre-11.2 home is already configured, execute the following:
11.2_Home/oui/bin/runInstaller-updateNodeList -silent -local CRS=false ORACLE_HOME=pre-11.2_Home
Alwaysexecute the following to register the current home:
11.2_Home/oui/bin/runInstaller-updateNodeList -silent -local CRS=true ORACLE_HOME=11.2_Home.
Ifeither home is shared, provide the additional argument -cfs.
[root@localhost~]# /u01/app/11.2.0/grid/perl/bin/perl -I/u01/app/11.2.0/grid/perl/lib -I/u01/app/11.2.0/grid/crs/install/u01/app/11.2.0/grid/crs/install/roothas.pl
2013-10-1716:18:19: Checking for super user privileges
2013-10-1716:18:19: User has super user privileges
2013-10-1716:18:19: Parsing the host name
Usingconfiguration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params
Creatingtrace directory
/u01/app/11.2.0/grid/bin/clscfg.bin:error while loading shared libraries: libcap.so.1: cannot open shared objectfile: No such file or directory -- 报错
Failedto create keys in the OLR, rc = 32512, 32512
OLRconfiguration failed
[root@localhost~]#
解决报错:
17.9.1. 检查操作系统中 libcap.so 是否已安装
如果是 64 位系统,i686 和 x86_64 都要安装。
# yum install -y libcap*.i686
# yum install -y libcap*.x86_64
[root@localhost~]# rpm -qa | grep libcap
libcap-ng-0.6.4-3.el6_0.1.i686
libcap-2.16-5.5.el6.x86_64
libcap-devel-2.16-5.5.el6.x86_64
libcap-devel-2.16-5.5.el6.i686
libcap-ng-0.6.4-3.el6_0.1.x86_64
libcap-2.16-5.5.el6.i686
libcap-ng-devel-0.6.4-3.el6_0.1.i686
libcap-ng-devel-0.6.4-3.el6_0.1.x86_64
[root@localhost~]#
17.9.2. 检查 libcap.so 文件
[root@localhost~]# ll /lib64/libcap.so*
lrwxrwxrwx 1 root root 11 Oct 17 16:28 /lib64/libcap.so -> libcap.so.2
lrwxrwxrwx.1 root root 14 Oct 16 15:22/lib64/libcap.so.2 -> libcap.so.2.16
-rwxr-xr-x 1 root root 19016 Oct 13 2011 /lib64/libcap.so.2.16
[root@localhost~]#
17.9.3.
[root@localhost~]# ln -s /lib64/libcap.so.2.16 /lib64/libcap.so.1
[root@localhost~]# ll /lib64/libcap.so*
lrwxrwxrwx 1 root root 11 Oct 17 16:28 /lib64/libcap.so -> libcap.so.2
lrwxrwxrwx 1 root root 21 Oct 17 17:01 /lib64/libcap.so.1 -> /lib64/libcap.so.2.16
lrwxrwxrwx.1 root root 14 Oct 16 15:22/lib64/libcap.so.2 -> libcap.so.2.16
-rwxr-xr-x 1 root root 19016 Oct 13 2011 /lib64/libcap.so.2.16
[root@localhost~]#
17.9.4. 重新执行 /u01/app/11.2.0/grid/root.sh脚本
[root@localhost~]# /u01/app/11.2.0/grid/root.sh
RunningOracle 11g root.sh script...
Thefollowing environment variables are set as:
ORACLE_OWNER= grid
ORACLE_HOME= /u01/app/11.2.0/grid
Enterthe full pathname of the local bin directory: [/usr/local/bin]:
Thefile "dbhome" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]:y -- 输入 y 覆盖安装
Copying dbhome to /usr/local/bin ...
Thefile "oraenv" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]:y -- 输入 y 覆盖安装
Copying oraenv to /usr/local/bin ...
Thefile "coraenv" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]:y -- 输入 y 覆盖安装
Copying coraenv to /usr/local/bin ...
Entrieswill be added to the /etc/oratab file as needed by
DatabaseConfiguration Assistant when a database is created
Finishedrunning generic part of root.sh script.
Nowproduct-specific root actions will be performed.
Toconfigure Grid Infrastructure for a Stand-Alone Server run the followingcommand as the root user:
/u01/app/11.2.0/grid/perl/bin/perl-I/u01/app/11.2.0/grid/perl/lib -I/u01/app/11.2.0/grid/crs/install/u01/app/11.2.0/grid/crs/install/roothas.pl
Toconfigure Grid Infrastructure for a Cluster perform the following steps:
1.Provide values for Grid Infrastructure configuration parameters in the file -/u01/app/11.2.0/grid/crs/install/crsconfig_params. For details on how to dothis, see the installation guide.
2.Run the following command as the root user:
/u01/app/11.2.0/grid/perl/bin/perl-I/u01/app/11.2.0/grid/perl/lib -I/u01/app/11.2.0/grid/crs/install/u01/app/11.2.0/grid/crs/install/rootcrs.pl
Toupdate inventory properties for Grid Infrastructure, perform the following
steps.If a pre-11.2 home is already configured, execute the following:
11.2_Home/oui/bin/runInstaller-updateNodeList -silent -local CRS=false ORACLE_HOME=pre-11.2_Home
Alwaysexecute the following to register the current home:
11.2_Home/oui/bin/runInstaller-updateNodeList -silent -local CRS=true ORACLE_HOME=11.2_Home.
Ifeither home is shared, provide the additional argument -cfs.
[root@localhost~]# /u01/app/11.2.0/grid/perl/bin/perl -I/u01/app/11.2.0/grid/perl/lib-I/u01/app/11.2.0/grid/crs/install /u01/app/11.2.0/grid/crs/install/roothas.pl
2013-10-1717:04:58: Checking for super user privileges
2013-10-1717:04:58: User has super user privileges
2013-10-1717:04:58: Parsing the host name
Usingconfiguration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params
ImproperOracle Clusterware configuration found on this host
Deconfigurethe existing cluster configuration before starting -- 报错
toconfigure a new Clusterware
run'/u01/app/11.2.0/grid/crs/install/rootcrs.pl -deconfig'
toconfigure existing failed configuration and then rerun root.sh
17.9.5. 解决步骤 4) 中的错误
[root@localhost~]# /u01/app/11.2.0/grid/crs/install/roothas.pl -verbose -delete -force
2013-10-1718:25:15: Checking for super user privileges
2013-10-1718:25:15: User has super user privileges
2013-10-1718:25:15: Parsing the host name
Usingconfiguration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params
CRS-4639:Could not contact Oracle High Availability Services
CRS-4000:Command Stop failed, or completed with errors.
CRS-4639:Could not contact Oracle High Availability Services
CRS-4000:Command Delete failed, or completed with errors.
CRS-4544:Unable to connect to OHAS
CRS-4000:Command Stop failed, or completed with errors.
/u01/app/11.2.0/grid/bin/acfsdriverstate:line 51: /lib/acfstoolsdriver.sh: No such file or directory
/u01/app/11.2.0/grid/bin/acfsdriverstate:line 51: exec: /lib/acfstoolsdriver.sh: cannot execute: No such file ordirectory
Successfullydeconfigured Oracle Restart stack
[root@localhost~]#
17.9.6. 重新执行 /u01/app/11.2.0/grid/root.sh脚本
[root@localhost~]# /u01/app/11.2.0/grid/root.sh
RunningOracle 11g root.sh script...
Thefollowing environment variables are set as:
ORACLE_OWNER= grid
ORACLE_HOME= /u01/app/11.2.0/grid
Enterthe full pathname of the local bin directory: [/usr/local/bin]:
Thefile "dbhome" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]:y
Copying dbhome to /usr/local/bin ...
Thefile "oraenv" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]:y
Copying oraenv to /usr/local/bin ...
Thefile "coraenv" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]:y
Copying coraenv to /usr/local/bin ...
Entrieswill be added to the /etc/oratab file as needed by
DatabaseConfiguration Assistant when a database is created
Finishedrunning generic part of root.sh script.
Nowproduct-specific root actions will be performed.
Toconfigure Grid Infrastructure for a Stand-Alone Server run the followingcommand as the root user:
/u01/app/11.2.0/grid/perl/bin/perl-I/u01/app/11.2.0/grid/perl/lib -I/u01/app/11.2.0/grid/crs/install/u01/app/11.2.0/grid/crs/install/roothas.pl
Toconfigure Grid Infrastructure for a Cluster perform the following steps:
1.Provide values for Grid Infrastructure configuration parameters in the file -/u01/app/11.2.0/grid/crs/install/crsconfig_params. For details on how to dothis, see the installation guide.
2.Run the following command as the root user:
/u01/app/11.2.0/grid/perl/bin/perl-I/u01/app/11.2.0/grid/perl/lib -I/u01/app/11.2.0/grid/crs/install/u01/app/11.2.0/grid/crs/install/rootcrs.pl
Toupdate inventory properties for Grid Infrastructure, perform the following
steps.If a pre-11.2 home is already configured, execute the following:
11.2_Home/oui/bin/runInstaller-updateNodeList -silent -local CRS=false ORACLE_HOME=pre-11.2_Home
Alwaysexecute the following to register the current home:
11.2_Home/oui/bin/runInstaller-updateNodeList -silent -local CRS=true ORACLE_HOME=11.2_Home.
Ifeither home is shared, provide the additional argument -cfs.
[root@localhost~]# /u01/app/11.2.0/grid/perl/bin/perl -I/u01/app/11.2.0/grid/perl/lib-I/u01/app/11.2.0/grid/crs/install /u01/app/11.2.0/grid/crs/install/roothas.pl
2013-10-1718:27:55: Checking for super user privileges
2013-10-1718:27:55: User has super user privileges
2013-10-1718:27:55: Parsing the host name
Usingconfiguration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params
LOCALADD MODE
CreatingOCR keys for user 'grid', privgrp 'oinstall'..
Operationsuccessful.
CRS-4664:Node localhost successfully pinned.
Addingdaemon to inittab
CRS-4124:Oracle High Availability Services startup failed. -- 报错
CRS-4000:Command Start failed, or completed with errors.
ohasdfailed to start: Inappropriate ioctl for device
ohasdfailed to start: Inappropriate ioctl for device at/u01/app/11.2.0/grid/crs/install/roothas.pl line 296.
[root@localhost~]#
这是 11.0.2.1 的一个 BUG
17.9.7. 解决 BUG
17.9.7.1. 回滚 /u01/app/11.2.0/grid/root.sh产生的操作
[root@localhost~]# /u01/app/11.2.0/grid/crs/install/roothas.pl -verbose -delete -force
2013-10-1718:45:42: Checking for super user privileges
2013-10-1718:45:42: User has super user privileges
2013-10-1718:45:42: Parsing the host name
Usingconfiguration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params
CRS-4639:Could not contact Oracle High Availability Services
CRS-4000:Command Stop failed, or completed with errors.
CRS-4639:Could not contact Oracle High Availability Services
CRS-4000:Command Delete failed, or completed with errors.
CRS-4544:Unable to connect to OHAS
CRS-4000:Command Stop failed, or completed with errors.
/u01/app/11.2.0/grid/bin/acfsdriverstate:line 51: /lib/acfstoolsdriver.sh: No such file or directory
/u01/app/11.2.0/grid/bin/acfsdriverstate:line 51: exec: /lib/acfstoolsdriver.sh: cannot execute: No such file ordirectory
Successfullydeconfigured Oracle Restart stack
[root@localhost~]#
17.9.7.2. 在执行 root.sh 脚本出现 Adding daemon to inittab 时,以 root 身份立即执行下面的命令:
# /bin/dd if=/var/tmp/.oracle/npohasd of=/dev/nullbs=1024count=1
如果出现 /bin/dd: opening`/var/tmp/.oracle/npohasd': No such file or directory,说明文件还没有生成,继续执行,直到能执行为止。
同时开两个 SSH 会话进行下面两步操作
[root@localhost~]# /bin/dd if=/var/tmp/.oracle/npohasd of=/dev/nullbs=1024 count=1
/bin/dd:opening `/var/tmp/.oracle/npohasd': No such file or directory
[root@localhost~]# /bin/dd if=/var/tmp/.oracle/npohasd of=/dev/nullbs=1024 count=1
[root@localhost~]# /u01/app/11.2.0/grid/root.sh
RunningOracle 11g root.sh script...
Thefollowing environment variables are set as:
ORACLE_OWNER= grid
ORACLE_HOME= /u01/app/11.2.0/grid
Enterthe full pathname of the local bin directory: [/usr/local/bin]:
Thefile "dbhome" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]:y
Copying dbhome to /usr/local/bin ...
Thefile "oraenv" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]:y
Copying oraenv to /usr/local/bin ...
Thefile "coraenv" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]:y
Copying coraenv to /usr/local/bin ...
Entrieswill be added to the /etc/oratab file as needed by
DatabaseConfiguration Assistant when a database is created
Finishedrunning generic part of root.sh script.
Nowproduct-specific root actions will be performed.
Toconfigure Grid Infrastructure for a Stand-Alone Server run the followingcommand as the root user:
/u01/app/11.2.0/grid/perl/bin/perl-I/u01/app/11.2.0/grid/perl/lib -I/u01/app/11.2.0/grid/crs/install/u01/app/11.2.0/grid/crs/install/roothas.pl
Toconfigure Grid Infrastructure for a Cluster perform the following steps:
1.Provide values for Grid Infrastructure configuration parameters in the file -/u01/app/11.2.0/grid/crs/install/crsconfig_params. For details on how to dothis, see the installation guide.
2.Run the following command as the root user:
/u01/app/11.2.0/grid/perl/bin/perl-I/u01/app/11.2.0/grid/perl/lib -I/u01/app/11.2.0/grid/crs/install/u01/app/11.2.0/grid/crs/install/rootcrs.pl
Toupdate inventory properties for Grid Infrastructure, perform the following
steps.If a pre-11.2 home is already configured, execute the following:
11.2_Home/oui/bin/runInstaller-updateNodeList -silent -local CRS=false ORACLE_HOME=pre-11.2_Home
Alwaysexecute the following to register the current home:
11.2_Home/oui/bin/runInstaller-updateNodeList -silent -local CRS=true ORACLE_HOME=11.2_Home.
Ifeither home is shared, provide the additional argument -cfs.
[root@localhost~]# /u01/app/11.2.0/grid/perl/bin/perl -I/u01/app/11.2.0/grid/perl/lib-I/u01/app/11.2.0/grid/crs/install /u01/app/11.2.0/grid/crs/install/roothas.pl
2013-10-1718:55:45: Checking for super user privileges
2013-10-1718:55:45: User has super user privileges
2013-10-1718:55:45: Parsing the host name
Usingconfiguration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params
LOCALADD MODE
CreatingOCR keys for user 'grid', privgrp 'oinstall'..
Operationsuccessful.
CRS-4664:Node localhost successfully pinned.
Addingdaemon to inittab
CRS-4123:Oracle High Availability Services has been started.
ohasdis starting
ADVM/ACFSis not supported on redhat-release-server-6Server-6.4.0.4.0.1.el6.x86_64
localhost 2013/10/17 18:56:11 /u01/app/11.2.0/grid/cdata/localhost/backup_20131017_185611.olr
Successfullyconfigured Oracle Grid Infrastructure for a Standalone Server
[root@localhost~]#
17.10. 结束 Grid 安装
18. 创建磁盘组
以 grid 用户执行 asmca 命令
SYS Password -- sys
ASMSNMP Password --asmsnmp
18.1.
18.2.
Step 1. 给磁盘组命名
Step 2. 选择冗余方式
High: 为每个分配单元创建三个副本(因此至少需要三个磁盘)
Normal: 单镜像(默认)
External: 不会镜像,假定底层存在一个 LVM 并且它正在执行认为适当的任何一种 RAID 级别。
Step 3. 添加磁盘挂载位置
Step 4. 输入磁盘挂载位置和名称
18.3.
这里我只创建了两个磁盘,一个磁盘组,没有创建FRA 区域。如果你创建了 3 个或者 3 个以上磁盘,可以留一部分给后面的 FRA 使用。
18.4. 点击 Create ASM 创建Disk Group
18.5. Disk Group 创建完成,退出。
19. 通过 grid 用户执行 crs_stat -t 检查 ASM 是否安装好,如下所示表示搭建 OK。
[grid@localhost~]$ crs_stat -t
Name Type Target State Host
------------------------
ora.DATA.dg ora....up.type ONLINE ONLINE localhost
ora.asm ora.asm.type ONLINE ONLINE localhost
ora.cssd ora.cssd.type ONLINE ONLINE localhost
ora.diskmon ora....on.type ONLINE ONLINE localhost
[grid@localhost~]$
20. 开始搭建 Oracle 数据库
20.1. 作为 oracle 用户登录系统,将安装包上传到 Oracle 家目录。
20.2. 解压两个压缩包
[oracle@localhost ~]$ ll linux*-rw-r--r-- 1 oracle oinstall 1239269270 Apr 18 20:44 linux.x64_11gR2_database_1of2.zip-rw-r--r-- 1 oracle oinstall 1111416131 Apr 18 20:47 linux.x64_11gR2_database_2of2.zip[oracle@localhost ~]$ unzip linux.x64_11gR2_database_1of2.zip && unzip linux.x64_11gR2_database_2of2.zip20.3. 执行 runInstaller
[oracle@localhost ~]$ /home/oracle/database/runInstallerStarting Oracle Universal Installer...Checking Temp space: must be greater than 120 MB. Actual 30971 MB PassedChecking swap space: must be greater than 150 MB. Actual 4088 MB PassedChecking monitor: must be configured to display at least 256 colors. Actual 16777216 PassedPreparing to launch Oracle Universal Installer from /tmp/OraInstall2013-10-17_08-01-38PM. Please wait ...[oracle@localhost ~]$20.4.
20.5.
20.6.
20.7.
20.8.
20.9.
20.10.
20.11.
20.12.
20.13.
安装时间较长,请耐心等待。
安装快结束时,会弹出窗口,提示你以 root 身份执行一个脚本。
20.2. 解压两个压缩包
[oracle@localhost~]$ ll linux*
-rw-r--r--1 oracle oinstall 1239269270 Apr 18 20:44 linux.x64_11gR2_database_1of2.zip
-rw-r--r--1 oracle oinstall 1111416131 Apr 18 20:47 linux.x64_11gR2_database_2of2.zip
[oracle@localhost~]$ unzip linux.x64_11gR2_database_1of2.zip && unziplinux.x64_11gR2_database_2of2.zip
20.3. 执行 runInstaller
[oracle@localhost~]$ /home/oracle/database/runInstaller
StartingOracle Universal Installer...
CheckingTemp space: must be greater than 120 MB. Actual 30971 MB Passed
Checkingswap space: must be greater than 150 MB. Actual 4088 MB Passed
Checkingmonitor: must be configured to display at least 256 colors. Actual 16777216 Passed
Preparingto launch Oracle Universal Installer from /tmp/OraInstall2013-10-17_08-01-38PM.Please wait ...[oracle@localhost ~]$
20.4.
21. 使用 netmgr 建立监听
需配置好环境变量,否则会出现找不到命令的情况。
21.1.
21.2.
21.3.
21.4.
21.5.
21.6.
点击 File --> Save Network Configuration
然后退出
27. 使用 dbca 创建数据库
27.1.
27.2.
27.3.
27.4.
27.5.
27.6.
27.7.
27.8.
由于前面没有创建 FRA 的 Disk Group,这里就使用文件系统。
如果你创建了 Disk Group,这里选择即可。
27.9.
27.10.
27.11.
27.12.
27.13.
27.14.
28. 至此,基于 ASM 的Oracle Database 11g 环境搭建完毕。
29. 验证
[oracle@localhost~]$ sqlplus / as sysdba
SQL*Plus:Release 11.2.0.1.0 Production on Thu Oct 17 21:37:22 2013
Copyright(c) 1982, 2009, Oracle. All rightsreserved.
Connectedto:
OracleDatabase 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
Withthe Partitioning, Automatic Storage Management, OLAP, Data Mining
andReal Application Testing options
SQL>select * from v$version;
BANNER
--------------------------------------------
OracleDatabase 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQLRelease 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNSfor Linux: Version 11.2.0.1.0 - Production
NLSRTLVersion 11.2.0.1.0 - Production
SQL>select file_name from dba_data_files;
FILE_NAME
--------------------------------------------
+DATA/orcl/datafile/users.259.829084507
+DATA/orcl/datafile/undotbs1.258.829084505
+DATA/orcl/datafile/sysaux.257.829084505
+DATA/orcl/datafile/system.256.829084505
+DATA/orcl/datafile/example.265.829084649
SQL>
最后本文主要参考如下网址:
http://www.myexception.cn/linux-unix/1453300.html
http://blog.csdn.net/hanpengyu/article/details/7475645
http://blog.csdn.net/rudygao/article/details/24025327
http://blog.csdn.net/rudygao/article/details/24025687