日期:2014-05-16  浏览次数:20993 次

Scientific Linux 6(x86_64) 安装oracle 11g r2
我在Scientific Linux 6(x86_64)上安装。使用GNOME图形界面,安装的时候把Development Tools里的开发包都安装上,我的机器为4G物理内存。

修改系统参数

step1: vi /etc/sysctl.conf,添加如下参数:
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 2147483648
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

注意: kernel.shmmax's的值是物理内存的一半。我的是4G内存,所以是2147483648


step2: vi /etc/security/limits.conf,添加:
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536


step3: vi /etc/pam.d/login,添加参数:
session required pam_limits.so


step4: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


step4: vi /etc/csh.login:
if( $USER == "oracle" ) then
limit maxproc 16384
limit descriptors 65536
umask 022
endif


step5: vi /etc/redhat-release,修改为如下值,成功安装数据库后在修改回来:
Red Hat Enterprise Linux Server release 5.0 (Tikanga)


step6:添加相关用户及用户组:
/usr/sbin/groupadd oinstall
/usr/sbin/groupadd dba
/usr/sbin/groupadd oper
/usr/sbin/groupadd asmadmin
/usr/sbin/useradd -g oinstall -G dba,oper,asmadmin oracle
passwd oracle


Step 6:创建安装路径及修改权限:
[root@abc oracle]# mkdir -p /u01/app/oracle/product/11.2.0/db_1
[root@abc oracle]# chown -R oracle:oinstall /u01
[root@abc oracle]# chmod -R 775 /u01


Step 7: vi /home/oracle/.bash_profile,其中ORACLE_SID的值可以自己定,我的设为orcl
# oracle
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_HOSTNAME=abc.yttco.com;export ORACLE_HOSTNAME
ORACLE_UNQNAME=orcl;export ORACLE_UNQNAME
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1; export ORACLE_HOME
ORACLE_SID=orcl; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=/usr/sbin:$PATH;export PATH
PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH; export PATH

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;export CLASSPATH


if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi

使环境变量生效:
source ~/.bash_profile

step 8:切换到oracle解压11G的安装包,这样就不用再修改权限了。

step 9:重启后以oracle登录安装。


以下是安装过程
[oracle@localhost database]$ ./runInstaller
Starting Oracle Universal Installer...
检查时会有些包缺失,都是一些32位包,忽略就行,
安装时先不要创建数据库,安装完成后再创建.
不然OEM就会启动失败.

切换到root,命令完成最后安装。

[oracle@localhost ~]$ su -
Password:
[root@localhost 11g]# sh /opt/11g/oraInventory/orainstRoot.sh
Changing permissions of /opt/11g/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /opt/11g/oraInventory to oinstall.
The execution of the script is complete.
[root@localhost 11g]# sh /opt/11g/oracle/product/11.2.0/dbhome_1/root.sh
Running Oracle 11g root.sh script...

The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /opt/11g/oracle/product/11.2.0/dbhome_1

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