ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Linux下Oracle 11g静默安装

Linux下Oracle 11g静默安装

原创 Linux操作系统 作者:perfychi 时间:2013-07-24 09:23:19 0 删除 编辑

LinuxOracle 11g静默安装

1 操作系统及Oracle版本

Linux版本:Red Hat Enterprise Linux 5 update 3

Oracle版本:Oracle Database 11g Release 2 (11.2.0.1.0) for Linux x86-64

2 硬件环境检查

2.1 内存要求

物理内存要求:

至少4G,查看物理内存命令:

# grep MemTotal /proc/meminfo

 

虚拟内存要求:

物理内存4-8G,要求虚拟内存为2倍物理内存;

物理内存8-32G,要求虚拟内存为1.5倍物理内存;

物理内存32G,要求虚拟内存为32G

 

查看虚拟内存命令:

# grep SwapTotal /proc/meminfo

 

增加虚拟内存示例:

# dd if=/dev/zero f=/swapadd bs=1024 count=2006424

# mkswap /swapadd

# swapon /swapadd

2.2 存储空间要求

/tmp目录下需至少1G空间

# df -h /tmp

 

如果不足1G需设置oracle用户的TMPTMPDIR环境变量。

 

对数据库安装目录,需至少4.35G空间,对数据文件目录,需至少1.68G空间。

3 软件环境检查

2.1 内核版本要求

需满足:2.6.18 or later

 

检查命令:

# uname -r

2.2 系统包要求

以下系统包或以上版本(32)必须满足:

binutils-2.17.50.0.6

compat-libstdc++-33-3.2.3

compat-libstdc++-33-3.2.3 (32 bit)

elfutils-libelf-0.125

elfutils-libelf-devel-0.125

gcc-4.1.2

gcc-c++-4.1.2

glibc-2.5-24

glibc-2.5-24 (32 bit)

glibc-common-2.5

glibc-devel-2.5

glibc-devel-2.5 (32 bit)

glibc-headers-2.5

ksh-20060214

libaio-0.3.106

libaio-0.3.106 (32 bit)

libaio-devel-0.3.106

libaio-devel-0.3.106 (32 bit)

libgcc-4.1.2

libgcc-4.1.2 (32 bit)

libstdc++-4.1.2

libstdc++-4.1.2 (32 bit)

libstdc++-devel 4.1.2

make-3.81

numactl-devel-0.9.8.x86_64

sysstat-7.0.2

unixODBC-2.2.11

unixODBC-2.2.11 (32 bit)

unixODBC-devel-2.2.11

elfutils-libelf-devel-static-0.125

kernel-headers-2.6.18

libgomp-4.1.2

 

检查命令:

# rpm -q package_name

 

安装包目录:

 

安装命令示例:

# rpm -ivh unixODBC-devel-2.2.11-7.1.i386.rpm

 

SCB UPRR check情况如下:

命令

结果

是否满足

rpm -q binutils

binutils-2.17.50.0.6-8.el5

满足

rpm -q compat-libstdc++-33

not installed

 

rpm -q compat-libstdc++-33

not installed

 

rpm -q elfutils-libelf

elfutils-libelf-0.137-3.el5

满足

rpm -q elfutils-libelf-devel

not installed

 

rpm -q gcc

not installed

 

rpm -q gcc-c++

not installed

 

rpm -q glibc

glibc-2.5-31

满足

rpm -q glibc

glibc-2.5-31

满足

rpm -q glibc-common

glibc-common-2.5-31

满足

rpm -q glibc-devel

not installed

 

rpm -q glibc-devel

not installed

 

rpm -q glibc-headers

not installed

 

rpm -q ksh

ksh-20080202-2.el5

满足

rpm -q libaio

libaio-0.3.106-3.2

满足

rpm -q libaio

libaio-0.3.106-3.2

满足

rpm -q libaio-devel

not installed

 

rpm -q libaio-devel

not installed

 

rpm -q libgcc

libgcc-4.1.2-44.el5

满足

rpm -q libgcc

libgcc-4.1.2-44.el5

满足

rpm -q libstdc++

libstdc++-4.1.2-44.el5

满足

rpm -q libstdc++

libstdc++-4.1.2-44.el5

满足

rpm -q libstdc++-devel

not installed

 

rpm -q make

make-3.81-3.el5

满足

rpm -q numactl-devel

not installed

 

rpm -q sysstat

not installed

 

rpm -q unixODBC

not installed

 

rpm -q unixODBC

not installed

 

rpm -q unixODBC-devel

not installed

 

rpm -q elfutils-libelf-devel-static

not installed

 

rpm -q kernel-headers

kernel-headers-2.6.18-120.el5

满足

rpm -q libgomp

not installed

 

 

经检查,SCB UPRR生产环境需安装以下补丁包:

# rpm -ivh compat-libstdc++-33-3.2.3-61.x86_64.rpm

# rpm -ivh compat-libstdc++-33-3.2.3-61.i386.rpm

# rpm -ivh elfutils-libelf-devel-static-0.137-3.el5.x86_64.rpm elfutils-libelf-devel-0.137-3.el5.x86_64.rpm

# rpm -ivh glibc-headers-2.5-34.x86_64.rpm  --nodeps --force

# rpm -ivh glibc-devel-2.5-34.x86_64.rpm --nodeps --force

# rpm -ivh glibc-devel-2.5-34.i386.rpm --nodeps --force

# rpm -ivh gcc-4.1.2-44.el5.x86_64.rpm libgomp-4.3.2-7.el5.x86_64.rpm

# rpm -ivh libaio-devel-0.3.106-3.2.x86_64.rpm

# rpm -ivh libaio-devel-0.3.106-3.2.i386.rpm

# rpm -ivh libstdc++-devel-4.1.2-44.el5.x86_64.rpm

# rpm -ivh numactl-devel-0.9.8-7.el5.x86_64.rpm

# rpm -ivh sysstat-7.0.2-3.el5.x86_64.rpm

# rpm -ivh unixODBC-2.2.11-7.1.x86_64.rpm

# rpm -ivh unixODBC-2.2.11-7.1.i386.rpm

# rpm -ivh unixODBC-devel-2.2.11-7.1.x86_64.rpm

# rpm -ivh gcc-c++-4.1.2-48.el5.x86_64.rpm --nodeps --force

4  创建组及用户

# /usr/sbin/groupadd oinstall

# /usr/sbin/groupadd dba

# /usr/sbin/useradd -g oinstall -G dba oracle

# passwd oracle

5 配置内核参数

5.1 检查内核参数

下表为需要检查的内核参数、最小值、检查命令、及参数文件路径:


 

 

参数

最小值

检查命令

文件路径

semmsl

250

# /sbin/sysctl -a | grep sem

/proc/sys/kernel/sem

semmns

32000

semopm

100

semmni

128

shmall

2097152

# /sbin/sysctl -a | grep shm

/proc/sys/kernel/shmall

shmmax

4GB-1byte或物理内存的一半,两者最小值.

Default: 536870912

/proc/sys/kernel/shmmax

shmmni

4096

/proc/sys/kernel/shmmni

file-max

6815744

# /sbin/sysctl -a | grep file-max

/proc/sys/fs/file-max

ip_local_port_range

Minimum: 9000

Maximum: 65500

# /sbin/sysctl -a | grep ip_local_port_range

/proc/sys/net/ipv4/ip_local_port_range

rmem_default

262144

# /sbin/sysctl -a | grep rmem_default

/proc/sys/net/core/rmem_default

rmem_max

4194304

# /sbin/sysctl -a | grep rmem_max

/proc/sys/net/core/rmem_max

wmem_default

262144

# /sbin/sysctl -a | grep wmem_default

/proc/sys/net/core/wmem_default

wmem_max

1048576

# /sbin/sysctl -a | grep wmem_max

/proc/sys/net/core/wmem_max

aio-max-nr

Maximum: 1048576

# cat /proc/sys/fs/aio-max-nr

/proc/sys/fs/aio-max-nr

 

对于需要修改的参数,要在/etc/sysctl.conf(如果没有该文件则创建)中修改。如果该文件中存在参数配置,直接修改,否则增加新行。

 

以下是对SCB UPRR生产环境的分析:

Oracle推荐设置                            /etc/sysctl.conf是否需修改,如何修改

kernel.sem = 250 32000 100 128              ##修改,增加本行

kernel.shmall = 2097152                     ##满足,无需增加或修改

kernel.shmmax = 536870912                   ##满足,无需增加或修改

kernel.shmmni = 4096                        ##满足,无需增加或修改

fs.file-max = 6815744                       ##修改,增加本行

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                 ##修改,增加本行

fs.aio-max-nr = 1048576                     ##修改,增加本行

5.2 修改内核参数

经上述分析,SCB UPRR生产环境在/etc/sysctl.conf中无参数修改,但有参数增加,增加内容如下:

# vi /etc/sysctl.conf

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.rmem_max = 4194304

net.core.wmem_default = 262144

net.core.wmem_max = 1048586

fs.aio-max-nr = 1048576

 

修改后,使设置生效:

# /sbin/sysctl -p

 

执行生效命令后,再次检查确认参数设置:

# /sbin/sysctl -a

6 用户限制设置

6.1用户文件限制检查

切换到安装用户oracle

# su - oracle

 

检查以下参数是否在推荐的范围内

 

Type

Item

Recommended Ranges

Command

soft

nofile

at least 1024

$ ulimit -Sn

hard

nofile

at least 65536

$ ulimit -Hn

soft

nproc

at least 2047

$ ulimit -Su

hard

nproc

at least 16384

$ ulimit -Hu

soft

stack

at least 10240 KB

$ ulimit -Ss

hard

stack

at least 10240 KB

at most 32768 KB

$ ulimit -Hs

 

6.2修改用户限制

$ su - root

 

在文件/etc/security/limits.conf中加入以下内容:

# vi /etc/security/limits.conf

oracle    soft    nofile    1024

oracle    hard    nofile    65536

oracle    soft    nproc     2047

oracle    hard    nproc     16384

 

/etc/pam.d/login中增加以下内容:

vi /etc/pam.d/login

session    required    /lib/security/pam_limits.so

session    required    pam_limits.so

 

/etc/profile中加入以下内容:

# vi /etc/profile

if [ $USER = "oracle" ]; then

         if [ $SHELL = "/bin/ksh" ]; then

                   ulimit -p 16384

                   ulimit -n 65536

         else

                   ulimit -u 16384 -n 65536

         fi

fi

7 关闭SELinux

# vi /etc/sysconfig/selinux

#SELINUX=enforcing

SELINUX=disabled

8 创建安装目录

# mkdir -p /u01/app/

# chown -R oracle:oinstall /u01/app/

# chmod -R 775 /u01/app/

9 设置环境变量

# su - oracle

 

$ vi ~/.bash_profile

umask 022

export ORACLE_BASE=/u01/app/oracle

export ORACLE_SID=uprr

 

$ source /home/oracle/.bash_profile

 

$ unset ORACLE_HOME

$ unset TNS_ADMIN

 

注意,除了ORACLE_BASEORACLE_SID,( /etc/profile.bash_profile)不设置任何oracle相关环境变量(ORACLE_HOME, PATH, LD_LIBRARY_PATH)

 

检查环境变量:

$ env | more

 

检查用户文件权限掩码:

$ umask

10 静默安装软件

10.1 创建oraInst.loc

$ su - root

# vi /etc/oraInst.loc

inventory_loc=/u01/app/oracle/oraInventory

inst_group=oinstall

 

# chown oracle:oinstall /etc/oraInst.loc

# chmod 664 /etc/oraInst.loc

10.2 创建响应文件

# su - oracle

 

仅安装Oracle软件的响应文件UPRR_INSTALL_DB_SWONLY.rsp

oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0

oracle.install.option=INSTALL_DB_SWONLY

ORACLE_HOSTNAME=build001

UNIX_GROUP_NAME=oinstall

INVENTORY_LOCATION=/u01/app/oracle/oraInventory

SELECTED_LANGUAGES=en,zh_CN,zh_TW

ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1

ORACLE_BASE=/u01/app/oracle

oracle.install.db.InstallEdition=EE

oracle.install.db.isCustomInstall=false

oracle.install.db.DBA_GROUP=dba

oracle.install.db.OPER_GROUP=dba

DECLINE_SECURITY_UPDATES=true

 

创建数据库的响应文件UPRR_DBCA.rsp

[GENERAL]

RESPONSEFILE_VERSION = "11.2.0"

OPERATION_TYPE = "createDatabase"

[CREATEDATABASE]

GDBNAME = "uprr"

SID = "uprr"

TEMPLATENAME = "General_Purpose.dbc"

SYSPASSWORD = "oracle"
SYSTEMPASSWORD = "oracle"

DATAFILEDESTINATION = "/u01/app/oracle/oradata"

RECOVERYAREADESTINATION= "/u01/app/oracle/flash_recovery_area"

CHARACTERSET = "ZHS16GBK"

NATIONALCHARACTERSET= "AL16UTF16"

 

NET配置的响应文件使用Oracle默认即可,无需修改,该文件在Oracle安装包的路径:

$cp database/response/netca.rsp /home/oracle/UPRR_NETCA.rsp

 

$ su - root

# chmod 700 /home/oracle/UPRR_INSTALL_DB_SWONLY.rsp

10.3 安装Oracle

安装:

# su - oracle

$ cd database

$ ./runInstaller -silent -debug -force -responseFile /home/oracle/UPRR_INSTALL_DB_SWONLY.rsp

 

备注:(可选参数-noconfig -IgnoreSysPreReqs)

 

出现类似如下提示表示安装完成:

#-------------------------------------------------------------------

...

/u01/app/oracle/oraInventory/orainstRoot.sh

/u01/app/oracle/product/11.2.0/dbhome_1/root.sh

To execute the configuration scripts:

         1. Open a terminal window

         2. Log in as "root"

         3. Run the scripts

         4. Return to this window and hit "Enter" key to continue 

 

Successfully Setup Software.

#-------------------------------------------------------------------

 

安装期间查看安装日志信息了解安装进度

$ cd $ORACLE_BASE/oraInventory/logs

$ tail -100f installActions*.log

 

root执行$ORACLE_HOME下的root.sh来建立oratab,dbhome,oraenv,coraenv文件, 如果提示则一直回车:

$ su - root

# /u01/app/oracle/product/11.2.0/dbhome_1/root.sh

# more /etc/oratab

 

设置环境变量

export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1

export TNS_ADMIN=$ORACLE_HOME/network/admin

export PATH=.:${PATH}:$HOME/bin:$ORACLE_HOME/bin

export PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/lib

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib

export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/JRE

export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/JRE/lib

export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib

export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib

export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib

export LIBPATH=${CLASSPATH}:$ORACLE_HOME/lib:$ORACLE_HOME/ctx/lib

export ORACLE_OWNER=oracle

export SPFILE_PATH=$ORACLE_HOME/dbs

export ORA_NLS10=$ORACLE_HOME/nls/data

 

source /home/oracle/.bash_profile

 

Sqlplus测试

$ sqlplus /nolog

11 静默配置网络

$ $ORACLE_HOME/bin/netca /silent /responseFile /home/oracle/UPRR_NETCA.rsp

 

/u01/app/oracle/product/11.2.0/dbhome_6/srvm/admin/getcrshome 没有可执行权限?

12 静默安装数据库

# su - oracle

$ $ORACLE_HOME/bin/dbca -silent -responseFile /home/oracle/UPRR_DBCA.rsp

 

安装期间查看日志信息了解进度:

$ tail -100f $ORACLE_BASE/cfgtoollogs/dbca/$ORACLE_SID/$ORACLE_SID.log

 

建库后实例检查

$ ps -ef | grep ora_ | grep -v grep | wc -l

$ ps -ef | grep ora_ | grep -v grep

 

建库后监听检查

$ lsnrctl status

 

如果使用归档日志

$ sqlplus / as sysdba

SQL> shutdown immediate;

SQL> startup mount;

SQL> alter database archivelog;

SQL> alter database flashback on; (如果要启用数据库闪回功能则执行)

SQL> alter database open;

SQL> execute utl_recomp.recomp_serial(); (重新编译所有可能失效对象)

SQL> alter system archive log current; (手工归档测试)

 

默认安装的数据库用户检查

SQL> set lines 256 pages 500

SQL> select USER_ID,USERNAME,ACCOUNT_STATUS,DEFAULT_TABLESPACE from dba_users order by 1;

Normal 0 7.8 磅 0 2 false false false EN-US ZH-CN X-NONE

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/27042095/viewspace-766965/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2012-06-06

最新文章