11gR2 单实例下应用ASM 安装数据库

安装软件:
yum -y install binutils-2.17.50.0.6
yum -y install compat-libstdc++-33-3.2.3
yum -y install elfutils-libelf-0.125
yum -y install elfutils-libelf-devel-0.125
yum -y install elfutils-libelf-devel-static-0.125
yum -y install gcc-4.1.2
yum -y install gcc-c++-4.1.2
yum -y install glibc-2.5-24
yum -y install glibc-common-2.5
yum -y install glibc-devel-2.5
yum -y install glibc-headers-2.5
yum -y install kernel-headers-2.6.18
yum -y install ksh-20060214
yum -y install libaio-0.3.106
yum -y install libaio-devel-0.3.106
yum -y install libgcc-4.1.2
yum -y install libgomp-4.1.2
yum -y install libstdc++-4.1.2
yum -y install libstdc++-devel-4.1.2
yum -y install make-3.81
yum -y install sysstat-7.0.2
yum -y install unixODBC-2.2.11
yum -y install unixODBC-devel-2.2.11




创建组:
groupadd -g 1000 oinstall
groupadd -g 1100 dba
groupadd -g 1101 oper
groupadd -g 1200 asmadmin
groupadd -g 1300 asmdba
groupadd -g 1301 asmoper




创建用户:
useradd -u 1100 -g oinstall -G asmadmin,asmdba,asmoper grid
useradd -u 1101 -g oinstall -G dba,asmdba,oper oracle




设置shell资源限制
vi /etc/security/limits.conf
-------------------------------
grid soft nofile 1024
grid hard nofile 65536
grid soft nproc 2047
grid hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 2047
oracle hard nproc 16384




修改内核参数:
vi /etc/sysctl.conf
-------------------------------
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.shmall = 2097152
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576


使内核参数生效
/sbin/sysctl -p




配置网络:
vi /etc/sysconfig/network-scripts/ifcfg-eth0
-------------------------------------------------
DEVICE=eth0
BOOTPROTO=none
IPADDR=192.168.1.181
NETMASK=255.255.255.0
ONBOOT=yes
HWADDR=00:0c:29:1d:5e:63




编辑/etc/hosts 文件
cat /etc/hosts
-----------------------
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6


192.168.1.181     primary








建立相关目录:
mkdir -p /u01/app
mkdir /u01/app/grid
mkdir /u01/app/oracle
chown gridinstall /u01 -R
chown oracleinstall /u01/app/oracle -R
chmod -R g+w /u01


设置用户环境:
su - grid
cat .bash_profile
------------------------------------------# .bash_profile


# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi


# User specific environment and startup programs


PATH=$PATH:$HOME/bin


export PATH
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/grid/product/11.2.0/grid
export PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_SID=+ASM
export LANG=en_US


su - oracle
cat .bash_profile
---------------------------------------------------
# .bash_profile


# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi


# User specific environment and startup programs


PATH=$PATH:$HOME/bin


export PATH
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db
export ORACLE_SID=orcl11g
export PATH=$ORACLE_HOME/bin:$PATH


配置存储(使用ASMLIB,不使用裸设备):
1.下载软件包
oracleasm-2.6.18-308.el5-2.0.5-1.el5.i686.rpm    //这个软件包的下载要和操作系统内核,CPU架构一致
oracleasmlib-2.0.4-1.el5.i386.rpm
oracleasm-support-2.1.8-1.el5.i386.rpm


2. 安装软件包
rpm -ivh *.rpm


3. 准备好磁盘
只需分区,不需要格式化
/dev/sdb1    8G
/dev/sdb2    4G
/dev/sdb5    4G
/dev/sdb6    4G


4. 配置ASM:
# /etc/init.d/oracleasm configure
Configuring the Oracle ASM library driver.
This will configure the on-boot properties of the Oracle ASM library
driver. The following questions will determine whether the driver is
loaded on boot and what permissions it will have. The current values
will be shown in brackets ('[]'). Hitting without typing an
answer will keep that current value. Ctrl-C will abort.
Default user to own the driver interface [ ]:oracle
Default group to own the driver interface [ ]:oinstall
Start Oracle ASM library driver on boot (y/n) [y]:
Scan for Oracle ASM disks on boot (y/n) [y]:
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver:                    [ OK ]
Scanning the system for Oracle ASMLib disks:              [ OK ]


5、 系统添加磁盘:
/etc/init.d/oracleasm createdisk VOL1 /dev/sdb1
/etc/init.d/oracleasm createdisk VOL2 /dev/sdb2
/etc/init.d/oracleasm createdisk VOL3 /dev/sdb5
/etc/init.d/oracleasm createdisk VOL4 /dev/sdb6


6.查看创建后的磁盘
# oracleasm listdisks


7. 查看磁盘是否已挂载在oracleasm文件系统
[root@primary ~]# ll /dev/oracleasm/disks/
总计 0
brw-rw---- 1 oracle oinstall 8, 17 08-28 15:16 VOL1
brw-rw---- 1 oracle oinstall 8, 18 08-28 15:49 VOL2
brw-rw---- 1 oracle oinstall 8, 21 08-28 15:49 VOL3
brw-rw---- 1 oracle oinstall 8, 22 08-28 15:49 VOL4




安装grid软件(图略)


安装数据库软件(图略)


dbca创建数据库 (图略)

请使用浏览器的分享功能分享到微信等