一、进行硬件检测
官方文档注明了每个Oracle版本对相应平台的最低硬件要求。
1.内存检测:
[oracle@localhost oraclefile]$ grep MemTotal /proc/meminfo
MemTotal: 1035324 kB
2.交换分区检测
[oracle@localhost oraclefile]$ grep SwapTotal /proc/meminfo
SwapTotal: 1028152 kB
3.查看可以的内存和交换分区
[oracle@localhost oraclefile]$ free
total used free shared buffers cached
Mem: 1035324 1018348 16976 0 47888 834836
-/+ buffers/cache: 135624 899700
Swap: 1028152 112 1028040
5.查看临时文件大小
[oracle@localhost oraclefile]$ df -h /tmp
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 8.5G 4.4G 3.7G 55% /
6.查看各个分区的大小:
[oracle@localhost oraclefile]$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 8.5G 4.4G 3.7G 55% /
/dev/sda1 289M 16M 259M 6% /boot
tmpfs 506M 0 506M 0% /dev/shm
7.Oracle依赖包的检测:
(此步骤可以暂时跳过,在安装Oracle过程中,会提示你确实哪些依赖包及其版本,然后再安装即可)
具体依赖哪些包是和操作系统相关的,我的操作系统是Redhat Enterprise 5
binutils-2.17.50.0.6-12.el5 (s390x)
compat-libstdc++-33-3.2.3-61 (s390)
compat-libstdc++-33-3.2.3-61 (s390x)
gcc-4.1.2-46.el5 (s390x)
gcc-c++-4.1.2-46.el5 (s390x)
glibc-2.5-42(s390)
glibc-2.5-42 (s390x)
glibc-devel-2.5-42 (s390)
glibc-devel-2.5-42 (s390x)
ksh
libaio-0.3.106-3.2 (s390)
libaio-0.3.106-3.2 (s390x)
libaio-devel-0.3.106-3.2 (s390)
libaio-devel-0.3.106-3.2 (s390x)
libgcc-4.1.2-46.el5 (s390)
libgcc-4.1.2-46.el5 (s390x)
libstdc++-4.1.2-46.el5 (s390)
libstdc++-4.1.2-46.el5 (s390x)
libstdc++-devel-4.1.2-46.el5 (s390x)
make-3.81
sysstat-7.0.2-3.el5 (s390x)
相关查询命令是:# rpm -q package_name 例如:
[oracle@localhost oraclefile]$ rpm -q binutils
binutils-2.17.50.0.6-5.el5
安装相关包时首先要将光盘挂载:
1) [root@localhost cdrom]# mount -t iso9660 /dev/cdrom /mnt/cdrom/
mount: block device /dev/cdrom is write-protected, mounting read-only
进入到挂载点开始安装:
2)[root@localhost Server]# rpm -ivh compat-libstdc++-33-3.2.3-61.i386.rpm
warning: compat-libstdc++-33-3.2.3-61.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
package compat-libstdc++-33-3.2.3-61 is already installed
如果光盘提供的Lib包不全可以从网上找:
http://linux1.fnal.gov/linux/slf52/i386/SL/repodata/repoview/G.group.html
查找LIB包几乎占了一半的时间。上面这个网站还是挺全的,可以收藏下
二、创建用户及目录
1.创建用户组:
[root@localhost /]# /usr/sbin/groupadd oinstall
[root@localhost /]# /usr/sbin/groupadd dba
2.创建用户Oracle
我的已经创建了,直接将Oracle 用户加入到oinstall和dba这两个组里
[root@localhost /]# /usr/sbin/usermod -g oinstall -G dba oracle
3.创建目录
[root@localhost /]# mkdir -p /u01/app/
[root@localhost /]# chown -R oracle:oinstall /u01/app/
[root@localhost /]# chmod -R 775 /u01/app/
三、配置参数
1.配置内核参数
编辑/etc/sysctl.conf文件
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
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
使参数生效:
[root@localhost /]# /sbin/sysctl –p
2.配置用户的环境变量
首先切换到Oracle用户下
[oracle@localhost /]$ vi ~/.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
ORACLE_BASE=/u01/app
ORACLE_HOME=$ORACLE_BASE/product/11.2/db_1
ORACLE_SID=angu
PATH=$ORACLE_HOME/bin:$PATH$:.
export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH
使环境变量立即生效:
[oracle@localhost /]$ source ~/.bash_profile
2.修改 /etc/security/limits.conf 文件,加上下面的参数
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
3.修改用户验证选项
修改/etc/pam.d/login文件加上如下参数
session required pam_limits.so
4.修改用户配置文件
修改/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
5.解压Oracle文件
6.安装
[oracle@localhost database]$ runInstaller
都是图形界面,安装的过程就和windows一样了。最后有两个脚本需要以root身份执行,按照提示执行就可以。
四、登录
安装完后实例和监听程序默认都是启动的,如果登录出现以下报错信息需要修改配置文件:
cannot restore segment prot after reloc: Permission denied
具体修改如下:
编辑/etc/selinux/config,找到这段:
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
SELINUX=enforcing
把 SELINUX=enforcing 注释掉:#SELINUX=enforcing ,然后新加一行为:
SELINUX=disabled
保存,关闭。
编辑/etc/sysconfig/selinux,找到:
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
SELINUX=enforcing
如果SELINUX已经是 SELINUX=disabled,那么就不用改了,否则就把SELINUX=enforcing 注释掉,新加一行:
SELINUX=disabled
保存,退出。
如何还是不行执行下面的基本上就没问题的:
chcon -t texrel_shlib_t
如: chcon -t texrel_shlib_t /路径/路径/名字.so (这个文件视具体执行文件.)
如果没问题了可以配置一下客户端的TNS
oracle11g =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.21.99)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = angu)
)
)
sqlplus sys/oracle@oracle11g as sysdba
登录成功:
原文地址:http://angu204.blog.163.com/blog/static/972538201372761313107/