VMWARE下创建Linux虚拟机,具体配置如下图:
[root@oragrid ~]# hostname
oragrid
[root@oragrid ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.230.133 oragrid
[root@oragrid ~]# cat /etc/issue
Red Hat Enterprise Linux Server release 6.5 (Santiago)
[root@oragrid ~]# free -m
total used free shared buffers cached
Mem: 1998 511 1487 0 25 183
-/+ buffers/cache: 301 1696
Swap: 1999 0 1999
#内存至少1G,swap至少为1.5倍内存,此处的内存为2G,swap也为2G,安装时会提示不满足安装条件,可以忽略也可以增加swap。
版本为:11.2.0.4
需要三个安装包,分别为:
p13390677_112040_Linux-x86-64_1of7.zip
p13390677_112040_Linux-x86-64_2of7.zip
p13390677_112040_Linux-x86-64_3of7.zip
[root@oragrid ~]# groupadd oinstall [root@oragrid ~]# groupadd dba
[root@oragrid ~]# useradd -g oinstall -G dba oracle
[root@oragrid ~]# useradd -g oinstall -G dba grid
[root@oragrid ~]# passwd oracle
Changing password for user oracle.
New password:
BAD PASSWORD: it is too simplistic/systematic
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.
[root@oragrid ~]# passwd grid
Changing password for user grid.
New password:
BAD PASSWORD: it is too simplistic/systematic
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.
[root@oragrid ~]# mkdir -p /u01/oraInventory
[root@oragrid ~]# mkdir -p /u01/app/grid
[root@oragrid ~]# mkdir -p /u01/app/oracle
[root@oragrid ~]# chown -R grid:oinstall /u01
[root@oragrid ~]# chown -R oracle:oinstall /u01/app/oracle
[root@oragrid ~]# chmod -R 775 /u01/
Grid用户:
[root@oragrid ~]# su - grid
[grid@oragrid ~]$ vim .bash_profile
[grid@oragrid ~]$ tail -5 .bash_profile
ORACLE_BASE=/u01/app/grid
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/grid
ORACLE_SID=+ASM
PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH
[grid@oragrid ~]$ source .bash_profile
[grid@oragrid ~]$ env | grep ORACLE
ORACLE_SID=+ASM
ORACLE_BASE=/u01/app/grid
ORACLE_HOME=/u01/app/grid/product/11.2.0/grid
Oracle用户:
[grid@oragrid ~]$ su - oracle
Password:
[oracle@oragrid ~]$ vim .bash_profile
[oracle@oragrid ~]$ tail -5 .bash_profile
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
ORACLE_SID=stone
PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH
[oracle@oragrid ~]$ source .bash_profile
[oracle@oragrid ~]$ env | grep ORACLE
ORACLE_SID=stone
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
[root@oragrid ~]# cat /proc/partitions
major minor #blocks name
8 0 52428800 sda
8 1 204800 sda1
8 2 2048000 sda2
8 3 50174976 sda3
8 16 10485760 sdb
8 32 10485760 sdc
8 48 5242880 sdd
8 64 5242880 sde
8 80 5242880 sdf
#总共6块磁盘,/dev/sda为系统所在磁盘,/dev/sdb、/dev/sdc、/dev/sdd、/dev/sde、/dev/sdf为没有使用的磁盘,提供给ASM用。下面对以上5块磁盘进行分区。
[root@oragrid ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xfc089d2c.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1305, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1305, default 1305):
Using default value 1305
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
对剩余磁盘进行同样操作。
[root@oragrid ~]# partprobe
Warning: WARNING: the kernel failed to re-read the partition table on /dev/sda (Device or resource busy). As a result, it may not reflect all of your changes until after reboot.
[root@oragrid ~]# cat /proc/partitions
major minor #blocks name
8 0 52428800 sda
8 1 204800 sda1
8 2 2048000 sda2
8 3 50174976 sda3
8 16 10485760 sdb
8 17 10482381 sdb1
8 32 10485760 sdc
8 33 10482381 sdc1
8 48 5242880 sdd
8 49 5237158 sdd1
8 64 5242880 sde
8 65 5237158 sde1
8 80 5242880 sdf
8 81 5237158 sdf1
将分区映射为raw设备:
[root@oragrid ~]# vim /etc/udev/rules.d/60-raw.rules
[root@oragrid ~]# tail -6 /etc/udev/rules.d/60-raw.rules
ACTION=="add", KERNEL=="sdb1", RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add", KERNEL=="sdc1", RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add", KERNEL=="sdd1", RUN+="/bin/raw /dev/raw/raw3 %N"
ACTION=="add", KERNEL=="sde1", RUN+="/bin/raw /dev/raw/raw4 %N"
ACTION=="add", KERNEL=="sdf1", RUN+="/bin/raw /dev/raw/raw5 %N"
KERNEL=="raw*", OWNER="grid" GROUP="dba", MODE="0660"
[root@oragrid ~]# ls /dev/raw/
rawctl
[root@oragrid ~]# start_udev
Starting udev: [ OK ]
[root@oragrid ~]# ls /dev/raw/
raw1 raw2 raw3 raw4 raw5 rawctl
在grid用户的home目录下解压GI安装包。
[grid@oragrid ~]$ unzip /mnt/hgfs/11204/p13390677_112040_Linux-x86-64_3of7.zip
[grid@oragrid ~]$ ls grid/
install readme.html response rpm runcluvfy.sh runInstaller sshsetup stage welcome.html
在宿主机(IP:192.168.230.1)上启动Xmanager Passive。然后在虚拟机上设置DISPLAY环境变量。
[grid@oragrid ~]$ export DISPLAY=192.168.230.1:0.0
[grid@oragrid ~]$ cd grid/
[grid@oragrid grid]$ ./runInstaller
Starting Oracle Universal Installer...
Checking Temp space: must be greater than 120 MB. Actual 38607 MB Passed
Checking swap space: must be greater than 150 MB. Actual 1999 MB Passed
Checking monitor: must be configured to display at least 256 colors. Actual 16777216 Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2015-06-04_12-55-52PM. Please wait ...
[root@oragrid ~]# /tmp/CVU_11.2.0.4.0_grid/runfixup.sh
Response file being used is :/tmp/CVU_11.2.0.4.0_grid/fixup.response
Enable file being used is :/tmp/CVU_11.2.0.4.0_grid/fixup.enable
Log file location: /tmp/CVU_11.2.0.4.0_grid/orarun.log
Setting Kernel Parameters...
The value for shmmni in response file is not greater than value of shmmni for current session. Hence not changing it.
The value for semmsl in response file is not greater than value of semmsl for current session. Hence not changing it.
The value for semmns in response file is not greater than value of semmns for current session. Hence not changing it.
The value for semmni in response file is not greater than value of semmni for current session. Hence not changing it.
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
uid=501(grid) gid=500(oinstall) groups=500(oinstall),501(dba)
配置YUM:
[root@oragrid ~]# cd /etc/yum.repos.d/
[root@oragrid yum.repos.d]# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
[root@oragrid yum.repos.d]# yum makecache
安装需要的软件包:
[root@oragrid yum.repos.d]# yum install gcc compat-libstdc++-33 elfutils-libelf-devel gcc-c++ libaio-devel libstdc++-devel pdksh -y
[root@oragrid ~]# /u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.
[root@oragrid ~]# /u01/app/grid/product/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= /u01/app/grid/product/11.2.0/grid
Enter the 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...
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: /u01/app/grid/product/11.2.0/grid/crs/install/crsconfig_params
Creating trace directory
/u01/app/grid/product/11.2.0/grid/bin/clscfg.bin: error while loading shared libraries: libcap.so.1: cannot open shared object file: No such file or directory
Failed to create keys in the OLR, rc = 127, Message:
Failed to create keys in the OLR at /u01/app/grid/product/11.2.0/grid/crs/install/crsconfig_lib.pm line 7660.
/u01/app/grid/product/11.2.0/grid/perl/bin/perl -I/u01/app/grid/product/11.2.0/grid/perl/lib -I/u01/app/grid/product/11.2.0/grid/crs/install /u01/app/grid/product/11.2.0/grid/crs/install/roothas.pl execution failed
执行这个脚本报错error while loading shared libraries: libcap.so.1,解决方法如下:
[root@oragrid ~]# yum install -y compat-libcap1
[root@oragrid ~]# /u01/app/grid/product/11.2.0/grid/crs/install/rootcrs.pl -verbose -deconfig -force
Using configuration parameter file: /u01/app/grid/product/11.2.0/grid/crs/install/crsconfig_params
Usage: srvctl
commands: enable|disable|start|stop|status|add|remove|modify|getenv|setenv|unsetenv|config|upgrade
objects: database|service|asm|diskgroup|listener|home|ons
For detailed help on each command and object and its options use:
srvctl
srvctl
PRKO-2012 : nodeapps object is not supported in Oracle Restart
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 Modify failed, or completed with errors.
CRS-4639: Could not contact Oracle High Availability Services
CRS-4000: Command Delete failed, or completed with errors.
CRS-4013: This command is not supported in a single-node configuration.
CRS-4000: Command Stop failed, or completed with errors.
################################################################
# You must kill processes or reboot the system to properly #
# cleanup the processes started by Oracle clusterware #
################################################################
ACFS-9313: No ADVM/ACFS installation detected.
Failure in execution (rc=-1, 256, No such file or directory) for command /etc/init.d/ohasd deinstall
error: package cvuqdisk is not installed
Successfully deconfigured Oracle clusterware stack on this node
[root@oragrid ~]# /u01/app/grid/product/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= /u01/app/grid/product/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 be performed.
Using configuration parameter file: /u01/app/grid/product/11.2.0/grid/crs/install/crsconfig_params
LOCAL ADD MODE
Creating OCR keys for user 'grid', privgrp 'oinstall'..
Operation successful.
LOCAL ONLY MODE
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
CRS-4664: Node oragrid successfully pinned.
Adding Clusterware entries to upstart
oragrid 2015/06/04 23:03:35 /u01/app/grid/product/11.2.0/grid/cdata/oragrid/backup_20150604_230335.olr
Successfully configured Oracle Grid Infrastructure for a Standalone Server
由于在安装GI的时候只能创建一个磁盘组,如果需要增加磁盘组的话,在GI安装完成后,使用ASMCA命令增加磁盘组。
[grid@oragrid grid]$ export DISPLAY=192.168.230.1:0.0
[grid@oragrid grid]$ asmca
在oracle用户的home目录下解压database安装包。
[root@oragrid ~]# su – oracle
[oracle@oragrid ~]$ unzip /mnt/hgfs/11204/p13390677_112040_Linux-x86-64_1of7.zip
[oracle@oragrid ~]$ unzip /mnt/hgfs/11204/p13390677_112040_Linux-x86-64_2of7.zip
[oracle@oragrid ~]$ export DISPLAY=192.168.230.1:0.0
[[oracle@oragrid ~]$ cd database/
[oracle@oragrid database]$ ./runInstaller
[root@oragrid ~]# /tmp/CVU_11.2.0.4.0_oracle/runfixup.sh
Response file being used is :/tmp/CVU_11.2.0.4.0_oracle/fixup.response
Enable file being used is :/tmp/CVU_11.2.0.4.0_oracle/fixup.enable
Log file location: /tmp/CVU_11.2.0.4.0_oracle/orarun.log
uid=500(oracle) gid=500(oinstall) groups=500(oinstall),501(dba)
[root@oragrid ~]# /u01/app/oracle/product/11.2.0/dbhome_1/root.sh
Performing root user operation for Oracle 11g
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/oracle/product/11.2.0/dbhome_1
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 be performed.
Finished product-specific root actions.
[oracle@oragrid database]$ dbca
大功告成。