Centos5.7x64 上部署 oracle11R2 重点概要

      上一次我们为单实例oracle11gR2筹备了一个OS环境,今天来重点回顾一下部署Oracle11gR2时需要注意的内容。

先声明两点:

1. 本文属个人总结,并非操作手册性质。 希望得到详细部署细节的同学们,建议参考最新的oracle11r2官方文档,光盘附带的文档可能有纰漏。

    我们可以在这里得到最新版文档:http://www.oracle.com/technetwork/database/enterprise-edition/documentation/index.html

   例如:E11882-01 zip (825.70 MB) 

2. 本次仅针对容易疏忽与需要重点关注的环节进行记录。已经较熟悉的部分,没有必要再反复。

 

    官方文档写的很长,是为了严谨。但oracle11gR2单实例常见的部署过程,无外乎下面几个阶段:

1 .核实rpm包情况,不够的补齐

2. 创建用户,用户组

3. 并配置系统配额及目录权限、环境变量

4. 如果ASM需求,则需要单独配置UDEV。反之这一步可略过

5. 上传介质,解压。使用oracle用户进行安装

6. 建立并启用监听,创建数据库

 

   部署过程:

一.核实RPM包

   Database Installation Guide for Linux 已经明确告诉我们需要安装的rpm包,这里有一种比较快捷的核实办法: (如果末尾有组连字符与数字,从右起第一个即可)


#rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n' \
binutils \
compat-libstdc++-33 \
elfutils-libelf \
elfutils-libelf-devel \
gcc \
gcc-c++ \
glibc-2.5 \
glibc-common \
glibc-devel \
glibc-headers \
ksh \
libaio \
libaio-devel \
libgcc \
libstdc++ \
libstdc++-devel  \
make \
sysstat \

 

得到输出(仅保留了未安装的条目,即便如此,最后还是要以正式安装时验证结果为准,如果有warning,必须逐个排除)
package compat-libstdc++ is not installed
package libaio-devel is not installed
根据包名,去centos介质中寻找,并使用SSH上传至虚拟机,安装。

 

二.创建用户及用户组(摘自安装文档)
# /usr/sbin/groupadd oinstall
# /usr/sbin/groupadd -g 502 dba
# /usr/sbin/groupadd -g 503 oper
# /usr/sbin/groupadd -g 504 asmadmin
# /usr/sbin/groupadd -g 506 asmdba
# /usr/sbin/groupadd -g 505 asmoper
# /usr/sbin/useradd -u 502 -g oinstall -G dba,asmdba oracle
# passwd oracle

 

 三.配置limits
/etc/security/limits.conf
#for oracle 11.2.0.3
oracle              soft    nproc   2047
oracle              hard    nproc   16384
oracle              soft    nofile  1024
oracle              hard    nofile  65536
oracle              soft    stack   10240

   配置内核参数

 这里关于shmmax需要提一点:通常我们说为了SGA不被分段,shmmax要尽可能大。其实这是不严谨的。根据My Oracle Support Note 567506.1的信息。在64位系统中,通常我们的内存已经超过4g甚至更大。最好将其设置为物理内存的一半。

原文如下:

The maximum size of a shared memory segment is limited by the size of the available user address space. On 64-bit systems, this is a theoretical 2^64bytes. So the "theoretical limit" for SHMMAX is the amount of physical RAM that you have. However, to actually attempt to use such a value could potentially lead to a situation where no system memory is available for anything else. Therefore a more realistic "physical limit" for SHMMAX would probably be "physical RAM - 2Gb".

In an Oracle RDBMS application, this "physical limit" still leaves inadequate system memory for other necessary functions. Therefore, the common "Oracle maximum" for SHMMAX that you will often see is "1/2 of physical RAM". Many Oracle customers chose a higher fraction, at their discretion. ”

 

/etc/sysctl.conf
#for oracle 11.2.0.3
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
    #shmmax must be half the physical memory on x64   but  at least  4G. (4294967295)      CHECK THE PORD ENV!!!!!!
kernel.shmmax = 12884901888      
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

# /sbin/sysctl -p


注意编辑/etc/sysconfig/selinux配置文件, 把SELINUX=enforcing 改为 SELINUX=disabled。

 

创建好相应的目录,并调整所有者与权限,这里与OS分区规划紧密相关


# chown -R oracle:oinstall /u01 /u02 /u03
# chmod -R 775 /u01 /u02 /u03

 注:不需要手动为oraInventory建立目录,它会随ORACLE_BASE自动配置

为oracle配置好环境变量

#for oracle 11.2.0.3
stty erase ^h          (这个是为了在sqlplus中能使用Backspace键,其余的都没什么好说的)
EDITOR=vim
ORACLE_BASE=/u01/app/oracle     (注意文档中的描述,这里的oracle是osuser,如果按此配置ORACLE_BASE,那么inventory将自动为$ORACLE_BASE/oraInventory)
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1   (出于今后可能升级考虑,在这里最好不要将小版本写出,否则....你懂的)
PATH=$ORACLE_HOME/bin:$PATH
SQLPATH=$ORACLE_HOME/sqlplus/admin/:$ORACLE_HOME/rdbms/admin/        (为了可以自动执行login.sql 且能快捷执行awrrpt.sql等脚本)
export EDITOR  ORACLE_BASE ORACLE_HOME PATH SQLPATH


关于Inventory,这里补全一下官方文档的解释,可以解解惑:    -----------------------------------------------------------------------------

The Oracle Inventory directory (oraInventory) stores an inventory of all software installed on the system. It is required and shared by all Oracle software installations on a single system. If you have an existing Oracle Inventory path, then Oracle Universal Installer continues to use that Oracle Inventory.

The first time you install Oracle software on a system, Oracle Universal Installer provides an Optimal Flexible Architecture-compliant path in the format/u[01-09]/app, such as/u01/app. The user running the installation has permissions to write to that path. If this is true, then Oracle Universal Installer creates the Oracle Inventory directory in the path/u[01-09]/app/oraInventory. For example:

/u01/app/oraInventory

If you have set ORACLE_BASE for the oracle user during installation, then Oracle Universal Installer creates the Oracle Inventory directory in the pathORACLE_BASE/../oraInventory. For example, ifORACLE_BASE is set to/u01/app/oracle, then the Oracle Inventory directory is created in the path/u01/app/oracle/oraInventory.

If you have neither created an OFA-compliant path nor set ORACLE_BASE, then the Oracle Inventory directory is placed in the home directory of the user that is performing the installation. For example:

/home/oracle/oraInventory

Oracle Universal Installer creates the directory that you specify and sets the correct owner, group, and permissions for it. You do not have to create it.

Note:

  • All Oracle software installations rely on the Oracle Inventory directory. Ensure that you back it up regularly.

  • Do not delete this directory unless you have completely removed all Oracle software from the system.

  • By default, the Oracle Inventory directory is not installed under the Oracle Base directory. This is because all Oracle software installations share a common Oracle Inventory, so there is only one Oracle Inventory for all users. Whereas, there is a separate Oracle Base for each user.

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


 

四.配置UDV,以使用ASM。(此次使用一般文件系统,具体udev配置将在RAC配置时详细展开

五.使用oracle账户安装
[oracle@centos2 ~]$ /upload/database/runInstaller

 

六.先创建监听,再创建数据库
 1. 服务器至少需要安装gnome

 2. xshell使用oracle登录即可直接启用Xdisplay。不要先root,后切换至oracle。这一点上,我们不用纠结太久。

 3. 再次提醒,OS规划期间SWAP一定要给够,否则会有warning!具体尺寸参看文档。

 4. 创建数据库时,先考虑好我们需要使用什么字符集。

      因为centos使用的英文环境,则通常国内的系统需要选择SIMPLIFIED CHINESE  ZHS16GBK与AL16UTF16,否则database保存不了中文字符。

 5.创建期间需要调整日志文件与控制文件的多路复用配置;日志文件不建议使用默认的50m,我调整到了300m

 5. 创建完数据库后,我们使用sqlplus查询中文会出现乱码。 只要 $ export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK  即可。

    字符集始终是一个不可能绕过的问题,针对??出现的原因及解决办法,以后将做专门的总结

 

 

 

 

 以上完成了oracle11gR2单实例的典型配置

 红字部分的内容将做单独的总结。

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值