oracle 11g 单机安装
1. 用 root 登录你的 linux 系统图形环境 oracle 安装的时候需要图形接口,iptables ,selinux 关掉2. 硬件需求:
a. 至少 1G 的物理内存
b. swap 分区为 1.5~2 倍的物理内存
[*]RAM Swap Space
[*]Between 257 MB and 512 MB Double the size of RAM
[*]Between 513 MB and 2048 MB 1.5 times the size of RAM
[*]Between 2049 MB and 8192 MBEqual to the size of RAM
[*]More than 8192 MB 0.75 times the size of RAM
c. /tmp 要有 150~200M 的容量,并且磁盘上要有 1.5~3.5G 的容量来安装 oracle 软件
[*]Installation Type
[*]Requirement for Software Files (GB)
[*]Enterprise Edition3.47
[*]Standard Edition 3.22
[*]Custom (maximum) 3.45
软件需求
[*]a. 操作系统: Red Hat Enterprise Linux 6.0
[*]b. 内核需求: 2.6.32
[*]c. 软件包需求:
[*]binutils­2.17.50.0.6­2.el5
[*]compat­libstdc++­33­3.2.3­61
[*]elfutils­libelf­0.125­3.el5
[*]elfutils­libelf­devel­0.125
[*]glibc­2.5­12
[*]glibc­common­2.5­12
[*]glibc­devel­2.5­12
[*]gcc­4.1.1­52
[*]gcc­c++­4.1.1­52
[*]libaio­0.3.106
[*]libaio­devel­0.3.106
[*]libgcc­4.1.1­52
[*]libstdc++­4.1.1
[*]libstdc++­devel­4.1.1­52.e15
[*]make­3.81­1.1
[*]sysstat­7.0.0
[*]unixODBC­2.2.11
[*]unixODBC­devel­2.2.11
[*]yum install binutils compat-libstdc++ elfutils-libelf gcc gcc-c++ libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel elfutils-libelf-devel glibc glibc-common glibc-devel
[*]d.oracle安装包:
[*]linux.x64_11gR2_database_1of2.zip
[*]linux.x64_11gR2_database_2of2.zip
4. 创建 Oracle 安装所需的组和用户:
[*]groupadd oinstall
[*]groupadd dba
[*]groupadd oper
[*]useradd -g oinstall -G dba,oper oracle
[*]id oracle
[*]id=701(oracle) gid=701(oinstall) groups=701(oinstall),702(dba),703(oper)
5. 修改内核参数:
在/etc/sysctl.conf 中添加下列行
[*]vm.min_free_kbytes = 1024
[*]vm.swappiness = 10
[*]fs.file­max = 65536
[*]kernel.shmall = 2097152
[*]kernel.shmmax = 2147483648
[*]kernel.shmmni = 4096
[*]kernel.sem = 250 32000 100 128
[*]net.ipv4.ip_local_port_range = 1024 65000
[*]net.core.rmem_default = 4194304
[*]net.core.rmem_max = 4194304
[*]net.core.wmem_default =
[*] 262144
[*]net.core.wmem_max = 262144
[*](以上参数的值都是推荐值,如果你本机的值更大的话,就无需更改;其中 fs.file­max 取值为
[*]512*PROCESSES)
[*]运行: sysctl ­p (使以上定义的值生效)
注意,此处可以不用修改,因为在oracle安装的时候它会自动检测系统环境,如果步否和要求的话它会生成一个脚本,你只需要执行那个脚本就可以修改
6. 为 oracle 用户设定 shell 限制:
a. 在/etc/security/limits.conf 中添加下列行
[*]oraclesoft nproc 2047oraclehard nproc 16384oraclesoft nofile1024oraclehard nofile65536
b. 在/etc/pam.d/system­auth 中确保有下列行 (此处不用修改,默认即可)
[*]session required pam_limits.so
[*]session required pam_unix.so
c. 在/home/oralce/.bash_profile中添加如下,然后source使之生效
[*]ulimit -­u 16384 -­n 65536
[*]# source /home/oracle/.bash_profile
7. 创建 Oracle 安装目录并设制 oracle 用户的环境变量
a. 建立 Oracle 数据文件目录
[*]mkdir-m 775 /opt/oracle
[*]chown oracle:oinstall /opt/oracle
[*]mkdir -m 775 /opt/oraInventory
[*]chown oracle:oinstall /opt/oraInventory/
b. 在~oracle/.bash_profile中添加下列行,然后source使之生效
[*]export ORACLE_BASE=/opt/oracle
[*]# source /home/oracle/.bash_profile
8. 安装 Oracle Database 11g
首先用root用户将软件包解压到/mnt
[*]unzip linux.x64_11gR2_database_1of2.zip
[*]unzip linux.x64_11gR2_database_2of2.zip
a. 使用 Oracle Universal Installer.(注意:执行“xhost +”命令,否则 oracle 用户不能使用当
前图形接口;或者注销后使用 oracle 帐户登录)
[*]# xhost +
[*]access control disabled, clients can connect from any host
[*]# su - oracle
[*]$ cd /mnt/database/
[*]$ ./runInstaller
b.弹出图形化安装界面,安装开始
b1.去掉 i wish to recive..前的对号,点next
b2.因为使安装单机版,选择install database software only,next
b3.保持默认的安装单机版的软件,next
b4.选择语言,有简体中文,此处选择英文
b5.选择安装方式,保持选择第一个,安装企业版的,Enterprise Editon
b6.选择安装目录,上面设定过变量,所以此处直接显示/opt/oracle,如果不是的话,手动进行修改
b7.确认目录为/opt/oraInventory
b8.保持默认
b9.安装检测到内核信息和一些软件包的版本不符合安装要求,点击Fix & check again,运行弹出窗口中提示的脚本
[*]【root@desktop31 mnt]# /tmp/CVU_11.2.0.1.0_oracle/runfixup.sh
[*]# sysctl -p
[*]检测后发现还有一处内核参数没有修改成功,手动进行修改
[*]# vim /etc/sysctl.conf
[*]kernel.sem = 250 32000 100 128
[*]# sysctl -p
内核参数修改好以后软件包版本忽略掉就行,选择右边的ignore all
b10.选择finish, 开始 ,等待过后弹出窗口提示执行两个脚本
[*]# /opt/oraInventory/orainstRoot.sh
[*]# /opt/oracle/product/11.2.0/dbhome_1/root.sh
b11.将脚本路径添加到默认路径中:
[*]$ vim /home/oracle/.bash_profile
[*]PATH=$PATH:$HOME/bin:/opt/oracle/product/11.2.0/dbhome_1/bin
[*]$ source /home/oracle/.bash_profile
b12.创建数据库:
[*]$ dbca
执行后弹出图形界面
接下来的配置需要修改的地方如截图所示,没有截图的步骤直接点next
这一步选择 custom database
这里设置一个sid,后面的域名随意
这一部提示它需要一个监听器,没有的话无法安装,打开一个终端,执行代码
[*]# su - oracle
[*]$ netca
会弹出一个安装监听器的窗口,一路next直到点finish
接下来这个界面让你设置这些用户的密码,可以设置成不同的,也可以选择第二项设置为相同的密码
接下来这个地方点选第二项,类似于开启日志记录之类的功能
接下来这一步选择第三项,它会生成一个脚本,功能类似与kickstart,就是批量安装时使用的,记住这个位置
点击finish,安装开始,要很久
测试安装, 在浏览器中输入结束安装前显示的 URL,打开企业管理器登录界面,键入User Name 为 sys, Password为 westos, 选择 Connext As 为 SYSDBA,单击 Login.
b13. 设置 Oracle 开机自启动
[*]a. 修改/etc/oratab 文件
[*] orcl:/opt/oracle/product/11.1.0/db_1:Y
[*]b. 编辑/etc/init.d/oracled 启动和关闭脚本:
[*]#!/bin/bash
[*]#
[*]# Oracle This shell script takes care of starting and stopping the ORACLE subsystem .
[*]#
[*]# chkconfig: - 64 36
[*]# description: ORACLE database server.
[*]# processname: oracle
[*]ORACLE_HOME=/opt/oracle/product/11.1.0/db_1
[*]ORACLE_OWNER=oracle
[*]prog=Oracled
[*]# Source function library.
[*]. /etc/rc.d/init.d/functions
[*]# Source networking configuration.
[*]. /etc/sysconfig/network
[*]start(){
[*] if [ ­f "$ORACLE_HOME/bin/dbstart" ] ; then
[*] su - $ORACLE_OWNER ­c $ORACLE_HOME/bin/dbstart $ORACLE_HOME
[*] ret=$?
[*] if [ $ret ­eq 0 ] ; then
[*] action $"Starting $prog: " /bin/true
[*] else
[*] action $"Starting $prog: " /bin/false
[*] fi
[*] [ $ret -­eq 0 ] && touch /var/lock/subsys/oracled
[*] return $ret
[*] fi
[*]}
[*]stop(){
[*] if [ -­f "$ORACLE_HOME/bin/dbshut" ] ; then
[*] su ­- $ORACLE_OWNER ­-c $ORACLE_HOME/bin/dbshut $ORACLE_HOME
[*] ret=$?
[*] if [ $ret -­eq 0 ] ; then
[*] action $"Stoping $prog: " /bin/true
[*] else
[*] action $"Stoping $prog: " /bin/false
[*] fi
[*] [ $ret ­-eq 0 ] && rm -­f /var/lock/subsys/oracled
[*] return $ret
[*] fi
[*]}
[*]restart(){
[*] stop
[*] start
[*]}
[*]# See how we were called.
[*]case "$1" in
[*] start)
[*] start
[*] ;;
[*] stop)
[*] stop
[*] ;;
[*] restart)
[*] restart
[*] ;;
[*] *)
[*] echo $"Usage: $0 {start|st p|restart}"
[*]o
[*] exit 1
[*]esac
[*]exit $?
[*]c. 执行命令:chkconfig oracled on
第一次安装的时候 OEM 启动正常,但重启后不会自动启动,如想用 OEM 管理数据库,执行以下命令:
[*]$ emctl start dbconsole
页:
[1]