Linux平台Oracle 11g单实例 + ASM存储 安装部署 快速参考
Linux平台Oracle 11g单实例 + ASM存储 安装部署 快速参考
操作环境:Citrix虚拟化环境中申请一个Linux6.4主机(模板)
目标:创建单机11g + ASM存储 数据库
1.主机准备
--------------------------------------------------------------------------------
IP地址:
主机名:JY-DB
目录:/u01
磁盘:从主机本地磁盘资源划分50G硬盘1个,从磁阵资源划分10G硬盘3个
1.1 检查主机名和IP地址的映射:hostname -i
hostname
vi /etc/sysconfig/network
vi /etc/hosts
1.2 分配/u01目录为Oracle软件安装目录,lv_asm1,lv_asm2,lv_asm3为ASM磁盘
/dev/xvdb 50G 格式化后挂载到/u01目录
/dev/xvdc /dev/xvde /dev/xvdf 各10G,不用格式化,给ASM使用
pvcreate /dev/xvdc /dev/xvde /dev/xvdf
vgcreate ora_vg /dev/xvdc /dev/xvde /dev/xvdf
lvcreate -L 10g -n lv_asm1 ora_vg
lvcreate -L 10g -n lv_asm2 ora_vg
vgdisplay ora_vg
lvcreate -l 2557 -n lv_asm3 ora_vg
在后面创建grid用户后,创建ASM前,需要更改lv的磁盘权限
chown grid:asmadmin /dev/mapper/ora*
1.3 配置YUM,安装依赖包
yum配置参考:
配置EPEL YUM源
RedHat 本地yum源配置
yum的配置文件说明
RedHat 6.1下安装yum(图文)
YUM 安装及清理
CentOS 6.4上搭建yum本地源
yum install binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel glibc glibc-common glibc-devel gcc- gcc-c++ libaio-devel libaio libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel pdksh ksh compat-libcap1
若之前安装系统没有安装图形,需要安装图形界面和xterm
yum groupinstall "X Window System"
yum install xterm
1.4 关闭系统防火墙开机启动
service iptables stop
chkconfig iptables off
2.创建ORACLE 用户和组成员
--------------------------------------------------------------------------------
groupadd oinstall
groupadd dba
groupadd oper
groupadd asmadmin
groupadd asmdba
groupadd asmoper
useradd -g oinstall -G dba,asmdba,oper oracle
useradd -g oinstall -G dba,asmadmin,asmdba,asmoper grid
分别指定oracle、grid用户的密码
passwd oracle
passwd grid
3.创建以下目录并赋予对应权限
--------------------------------------------------------------------------------
mkdir -p /u01/app/11.2.0/grid
mkdir -p /u01/app/grid
mkdir -p /u01/app/oracle/product/11.2.0/db_1
chown -R oracle:oinstall /u01/app
chmod -R 775 /u01/app
4.设置oracle、grid用户的环境变量
--------------------------------------------------------------------------------
4.1 oracle用户登陆: vi ~/.bash_profile
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:.
export NLS_LANG=american_america.ZHS16GBK
export ORACLE_SID=jyzhao
export PATH=$PATH:$ORACLE_HOME/bin:.
4.2 grid用户登录:vi ~/.bash_profile
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/11.2.0/grid
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:.
export NLS_LANG=American_america.ZHS16GBK
export PATH=$PATH:$ORACLE_HOME/bin:.
export ORACLE_SID=+ASM
5.root用户更改系统参数
--------------------------------------------------------------------------------
5.1 vi /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4398046511104 //一般设置为系统内存75%单位是字节
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 = 1048586
使设置立即生效: /sbin/sysctl -p
5.2 vi /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
grid soft nproc 2047
grid hard nproc 16384
grid soft nofile 1024
grid hard nofile 65536
grid soft stack 1024
5.3 vi /etc/pam.d/login
#oracle
session required /lib64/security/pam_limits.so
session required pam_limits.so
6.上传Oracle安装介质到/u01/tmp目录下
--------------------------------------------------------------------------------
mkdir -p /u01/tmp
p13390677_112040_Linux-x86-64_1of7.zip
p13390677_112040_Linux-x86-64_2of7.zip
p13390677_112040_Linux-x86-64_3of7.zip
7.安装grid组件
--------------------------------------------------------------------------------
#cd /u01/tmp/
#unzip p10404530_112030_Linux-x86-64_3of7.zip
#chown -R grid:oinstall grid
Xmanager软件用grid用户登录
$cd /u01/tmp/grid
$./runInstaller
图形界面安装,最后root用户执行两个脚本,执行脚本的屏幕输出如下:
# /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.
# /u01/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= /u01/app/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.
To configure Grid Infrastructure for a Stand-Alone Server 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/roothas.pl
To configure Grid Infrastructure for a Cluster execute the following command:
/u01/app/11.2.0/grid/crs/config/config.sh
上一篇: 利用PHP SOAP扩展实现简单Web Services
下一篇: PHP构造方法问题