环境:
OS:Red Hat Linux As 5
DB:11.2.0.1
1. 从oracle官网下载安装软件
linux_11gR2_database_1of2.zip
linux_11gR2_database_2of2.zip
同时cksum,看得到的值是否跟oracle官网的一致,若不一致说明下载或是传输过程中出现了问题,需要重新下载.
[oracle@stdby ftp]$ cksum linux_11gR2_database_1of2.zip
2237015228 1285396902 linux_11gR2_database_1of2.zip
[oracle@stdby ftp]$ cksum linux_11gR2_database_2of2.zip
2649514514 995359177 linux_11gR2_database_2of2.zip
2.上传到服务器上解压缩
unzip linux_11gR2_database_1of2.zip
unzip linux_11gR2_database_2of2.zip
3.创建oracle用户和组
[root@primary /]# groupadd oinstall
[root@primary /]# groupadd dba
[root@primary /]# mkdir -p/u01/export/home/
[root@primary /]# useradd -d /u01/export/home/oracle -g oinstall -G dba -s /bin/bash oracle -m
[root@primary /]# chown oracle:dba /u01/export/home/oracle /u01 /u02
[root@primary u01]# passwd oracle
Changing password for user oracle.
New UNIX password:
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
4.使用oracle账户登录
bash-3.1$ cd ~
bash-3.1$ ls -al
total 80
drwxr-xr-x 16 oracle dba 4096 Aug 24 09:19 .
drwxr-xr-x 3 root root 4096 Aug 24 09:17 ..
drwx------ 2 oracle oinstall 4096 Aug 24 09:19 .chewing
drwxr-xr-x 2 oracle oinstall 4096 Aug 24 09:19 Desktop
-rw------- 1 oracle oinstall 26 Aug 24 09:19 .dmrc
drwxr-x--- 2 oracle oinstall 4096 Aug 24 09:19 .eggcups
drwx------ 2 oracle oinstall 4096 Aug 24 09:19 .gconf
drwx------ 2 oracle oinstall 4096 Aug 24 09:19 .gconfd
drwxr-xr-x 3 oracle oinstall 4096 Aug 24 09:19 .gnome
drwx------ 6 oracle oinstall 4096 Aug 24 09:19 .gnome2
drwx------ 2 oracle oinstall 4096 Aug 24 09:19 .gnome2_private
drwxr-xr-x 2 oracle oinstall 4096 Aug 24 09:19 .gstreamer-0.10
-rw-r--r-- 1 oracle oinstall 99 Aug 24 09:19 .gtkrc-1.2-gnome2
-rw------- 1 oracle oinstall 161 Aug 24 09:19 .ICEauthority
drwx------ 3 oracle oinstall 4096 Aug 24 09:19 .metacity
drwxr-xr-x 3 oracle oinstall 4096 Aug 24 09:19 .nautilus
drwxr-xr-x 3 oracle oinstall 4096 Aug 24 09:19 .redhat
drwx------ 3 oracle oinstall 4096 Aug 24 09:19 .scim
drwx------ 2 oracle oinstall 4096 Aug 24 09:19 .Trash
-rw-r--r-- 1 oracle oinstall 2920 Aug 24 09:19 .xsession-errors
发现以上没有(.bash_history,.bash_logout,.bash_profile,.bashrc)这四个文件,可以从root用户的主目录中拷贝过来.
bash-3.1$ su
Password:
[root@primary oracle]# cp /root/.bash_history /u01/export/home/oracle
[root@primary oracle]# cp /root/.bash_logout /u01/export/home/oracle
[root@primary oracle]# cp /root/.bash_profile /u01/export/home/oracle
[root@primary oracle]# cp /root/.bashrc /u01/export/home/oracle
将拷贝过来的文件的属主修改为oracle
[root@primary oracle]# chown oracle:oinstall .bash_history
[root@primary oracle]# chown oracle:oinstall .bash_logout
[root@primary oracle]# chown oracle:oinstall .bash_profile
[root@primary oracle]# chown oracle:oinstall .bashrc
5.修改环境变量
vi .bash_profile
添加如下内容
export PS1="`/bin/hostname -s`-> "
export EDITOR=vi
export ORACLE_SID=oracl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin:/bin:/sbin
export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"
umask 022
stty erase ^h
使用oracle重新登录后发现
-> hostname
host1
-> hostname -s
hostname: Unknown host
原因是在/etc/hosts没有配置ip和主机名的对应关系.
192.168.50.24 primary.com primary
6.创建环境变量里定义的目录
[oracle@primary ~]$ mkdir -p $ORACLE_BASE/admin
[oracle@primary ~]$ mkdir -p $ORACLE_HOME
7.修改系统相应参数(root用户下执行)
Vi /etc/security/limits.conf
添加如下内容
# Oracle-Validated setting for nofile soft limit is 131072
oracle soft nofile 131072
# Oracle-Validated setting for nofile hard limit is 131072
oracle hard nofile 131072
# Oracle-Validated setting for nproc soft limit is 131072
oracle soft nproc 131072
# Oracle-Validated setting for nproc hard limit is 131072
oracle hard nproc 131072
# Oracle-Validated setting for core soft limit is unlimited
oracle soft core unlimited
# Oracle-Validated setting for core hard limit is unlimited
oracle hard core unlimited
# Oracle-Validated setting for memlock soft limit is 50000000
oracle soft memlock 50000000
# Oracle-Validated setting for memlock hard limit is 50000000
oracle hard memlock 50000000
vi /etc/sysctl.conf(root用户下执行)
添加如下内容:
# Kernel sysctl configuration file for Oracle Enterprise Linux
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
# sysctl.conf(5) for more details.
# Controls IP packet forwarding
net.ipv4.ip_forward = 0
# Controls source route verification
# See /usr/share/doc/kernel-doc-*/Documentation/networking/ip-sysctl.txt
net.ipv4.conf.default.rp_filter = 2
# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0
# Controls the System Request debugging functionality of the kernel
# Controls whether core dumps will append the PID to the core filename
# Useful for debugging multi-threaded applications
kernel.core_uses_pid = 1
# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1
# Controls the maximum size of a message, in bytes
# Controls the default maxmimum size of a mesage queue
# Controls the maximum shared segment size, in bytes
# Controls the maximum number of shared memory segments, in pages
# For 11g, Oracle-Validated setting for fs.file-max is 6815744
# For 10g, uncomment 'fs.file-max = 327679', and comment 'fs.file-max = 6553600' entry and re-run sysctl -p
# fs.file-max = 327679
fs.file-max = 6815744
# Oracle-Validated setting for kernel.msgmni is 2878
kernel.msgmni = 2878
# Oracle-Validated setting for kernel.msgmax is 8192
kernel.msgmax = 8192
# Oracle-Validated setting for kernel.msgmnb is 65536
kernel.msgmnb = 65536
# Oracle-Validated setting for kernel.sem is '250 32000 100 142'
kernel.sem = 250 32000 100 142
# Oracle-Validated setting for kernel.shmmni is 4096
kernel.shmmni = 4096
# Oracle-Validated setting for kernel.shmall is 1073741824
kernel.shmall = 1073741824
# Oracle-Validated setting for kernel.shmmax is 4398046511104 on x86_64 and 4294967295 on i386 architecture. Refer Note id 567506.1
kernel.shmmax = 4398046511104
# Oracle-Validated setting for kernel.sysrq is 1
kernel.sysrq = 1
# Oracle-Validated setting for net.core.rmem_default is 262144
net.core.rmem_default = 262144
# For 11g, Oracle-Validated setting for net.core.rmem_max is 4194304
# For 10g, uncomment 'net.core.rmem_max = 2097152', comment 'net.core.rmem_max = 4194304' entry and re-run sysctl -p
# net.core.rmem_max = 2097152
net.core.rmem_max = 4194304
# Oracle-Validated setting for net.core.wmem_default is 262144
net.core.wmem_default = 262144
# For 11g, Oracle-Validated setting for net.core.wmem_max is 1048576
# For 10g, uncomment 'net.core.wmem_max = 262144', comment 'net.core.wmem_max = 1048576' entry for this parameter and re-run sysctl -p
# net.core.wmem_max = 262144
net.core.wmem_max = 1048576
# Oracle-Validated setting for fs.aio-max-nr is 3145728
fs.aio-max-nr = 3145728
# For 11g, Oracle-Validated setting for net.ipv4.ip_local_port_range is 9000 65500
# For 10g, uncomment 'net.ipv4.ip_local_port_range = 1024 65000', comment 'net.ipv4.ip_local_port_range = 9000 65500' entry and re-run sysctl -p
# net.ipv4.ip_local_port_range = 1024 65000
net.ipv4.ip_local_port_range = 9000 65500
# Oracle-Validated setting for vm.min_free_kbytes is 51200 to avoid OOM killer
vm.min_free_kbytes = 51200
使用如下命令使其生效
/sbin/sysctl -p
8.进入到数据库安装目录(图形界面安装 可以使用vnc或是xmanager)
$./runInstaller
1.填写相应信息
这里可以不用填写,直接跳过.
2.选择仅安装软件
3.选择单节点安装
4.选择安装语言
5.选择安装企业版
6.指定安装目录,这里默认环境变量里定义的ORACLE_BASE,ORACLE_HOME
7.指定Inventory目录和组
8.指定OS组
9.安装前检查
逐一排查每个失败的检查项,若想忽略这些失败项,可以点击ignore all.
有些提示是没有安装相应的rpm,建议在安装系统的时候将所有的包全部选上,这样可以免去很多包依赖的麻烦.若是需要更新的软件包,需要去下载需要更新的软件包http://rpm.pbone.net/这里可以下载rpm包.
10.每项都通过后就可以安装了
安装完成后,就可以使用dbca创建数据库了,不过使用这里有个bug,具体可以参考:http://blog.chinaunix.net/space.php?uid=77311&do=blog&id=3325713