一,下载地址
http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html
Oracle 11g 联机文档:
http://www.oracle.com/pls/db112/homepage
二,系统要求
内存:1G(官方最低要求1G)
硬盘:40G(企业版安装所需4.29G和1.7G数据文件)
检查的命令
内存
# grep MemTotal /proc/meminfo
交换空间
# grep SwapTotal /proc/meminfo
磁盘空间
# df -ah
三,安装前系统准备
1、添加主机名与IP对应记录(root用户下)
#vim /etc/hosts
192.168.1.254 Admin-PC
2、关闭Selinux(root用户下)
# sed -i "s/SELINUX=enforcing/SELINUX=disabled/" /etc/selinux/config
# setenforce 0
3、创建用户和组(root用户:创建Oracle安装组oinstall,数据库管理员组dba,及oracle用户)
# groupadd -g 200 oinstall
# groupadd -g 201 dba
# useradd -u 440 -g oinstall -G dba oracle (主组oinstall,其它组:dba)
# passwd oracle
4、修改内核参数(root用户:修改 /etc/sysctl.conf 文件,加上如下参数)
# vim /etc/sysctl.conf
net.ipv4.ip_local_port_range= 9000 65500
fs.file-max = 6815744
kernel.shmall = 10523004
kernel.shmmax = 6465333657
kernel.shmmni = 4096
kernel.sem = 250 32000 100128
net.core.rmem_default=262144
net.core.wmem_default=262144
net.core.rmem_max=4194304
net.core.wmem_max=1048576
fs.aio-max-nr = 1048576
#modprobe bridge
#lsmod|grep bridge
# sysctl -p
5、修改系统资源限制(root用户:修改 /etc/security/limits.conf 文件,加上下面的参数)
# vim /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
6、修改用户验证选项(root用户下:修改/etc/pam.d/login文件加上如下参数)
# vim /etc/pam.d/login
session required pam_limits.so
7、创建安装目录及设置权限(root用户下)
# mkdir -p /app/oracle/
# chmod 755 /app/oracle/
# chown oracle.oinstall -R /app/oracle/
8、设置环境变量(root用户下:修改/etc/profile文件加上如下参数)
# vim /etc/profile
export ORACLE_BASE=/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export ORACLE_SID=ORCL
export ROACLE_PID=ORCL
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
完成后执行:
#source /etc/profile #环境变量修改生效
#env | grep ORA #查看环境变量是否完成
ORACLE_SID=ORCL
ORACLE_BASE=/app/oracle
ORACLE_HOME=/app/oracle/product/11.2.0/db_1
四、安装Oracle
1.安装依赖包(root用户下)
#yum install binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel elfutils-libelf-devel-static gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers kernel-headers ksh libaio libaio-devel libgcc libgomp libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel
2.字符界面下安装oracle(root用户下)
在/opt目录下 解压oracle软件
# unzip -o linux.x64_11gR2_database_1of2.zip
# unzip -o linux.x64_11gR2_database_2of2.zip
#chown -R oracle:oinstall /opt/database/
解压后得到database目录,其中包含response目录,该目录中有三个rsp文件,用来作为静默安装时的应答文件的模板。
三个文件作用分别是:
db_install.rsp:安装应答
dbca.rsp:创建数据库应答
netca.rsp:建立监听、本地服务名等网络设置的应答
3.编辑安装应答脚本(root用户下)
#vim /opt/database/response/db_install.rsp
Starting Oracle Universal Installer...
Checking Temp space: must be greater than 120 MB. Actual 165908 MB Passed
Checking swap space: must be greater than 150 MB. Actual 16383 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2015-01-29_03-35-32PM. Please wait ...[oracle@oracledb database]$ [WARNING] [INS-32055] The Central Inventory is located in the Oracle base.
CAUSE: The Central Inventory is located in the Oracle base.
ACTION: Oracle recommends placing this Central Inventory in a location outside the Oracle base directory.
[WARNING] [INS-13014] Target environment do not meet some optional requirements.
CAUSE: Some of the optional prerequisites are not met. See logs for details. /tmp/OraInstall2015-01-29_03-35-32PM/installActions2015-01-29_03-35-32PM.log
ACTION: Identify the list of failed prerequisite checks from the log: /tmp/OraInstall2015-01-29_03-35-32PM/installActions2015-01-29_03-35-32PM.log. Then either from the log file or from installation manual find the appropriate configuration to meet the prerequisites and fix it manually.
[WARNING] [INS-32055] The Central Inventory is located in the Oracle base.
CAUSE: The Central Inventory is located in the Oracle base.
ACTION: Oracle recommends placing this Central Inventory in a location outside the Oracle base directory.
[WARNING] [INS-13014] Target environment do not meet some optional requirements.
CAUSE: Some of the optional prerequisites are not met. See logs for details. /tmp/OraInstall2015-01-29_03-35-32PM/installActions2015-01-29_03-35-32PM.log
ACTION: Identify the list of failed prerequisite checks from the log: /tmp/OraInstall2015-01-29_03-35-32PM/installActions2015-01-29_03-35-32PM.log. Then either from the log file or from installation manual find the appropriate configuration to meet the prerequisites and fix it manually.
You can find the log of this install session at:
/opt/app/oracle/oraInventory/logs/installActions2015-01-29_03-35-32PM.log
The following configuration scripts need to be executed as the "root" user.
#!/bin/sh
#Root scripts to run
/app/oracle/oraInventory/orainstRoot.sh
/app/oracle/product/11.2.0/db_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.
然后回车,使用root用户执行root.sh
$ su root
#/app/oracle/product/11.2.0/db_1/root.sh
5.静默配置网络(oracle用户下)
$ $ORACLE_HOME/bin/netca /silent /responseFile /opt/database/response/netca.rsp
Parsing command line arguments:
Parameter "silent" = true
Parameter "responsefile" = /opt/database/response/netca.rsp
Done parsing command line arguments.
Oracle Net Services Configuration:
Profile configuration complete.
Listener "LISTENER" already exists.
Oracle Net Services configuration successful. The exit code is 0
6.修改脚本dbca.rsp(root用户下)
#vim /opt/database/response/dbca.rsp
Copying database files
1% complete
3% complete
11% complete安装完成...
8.修改oracle配置(root用户下)
#vim $ORACLE_HOME/bin/dbstart
ORACLE_HOME_LISTNER=$ORACLE_HOME
#vim $ORACLE_HOME/bin/dbshut
ORACLE_HOME_LISTNER=$ORACLE_HOME
9.Linux启动时自动启动Oracle监听和实例(root用户下)
#vim /etc/oratab
ORCL:/app/oracle/product/11.2.0/db_1:Y
#vim /etc/rc.d/rc.local
su - oracle -c "lsnrctl start"
su - oracle -c dbstart
10.基本命令
登录数据库: sqlplus / as sysdba
启动监听:lsnrctl start 或 $ORACLE_HOME/bin/lsnrctl start
查看监听:lsnrctl status 或 $ORACLE_HOME/bin/lsnrctl status
停止监听:lsnrctl stop