1、在安装Oracle之前,用命令检查必需的RPM软件包有没有安装,检查的命令如下:
rpm -q binutils compat-libstdc++-33 elfutils-libelfelfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel glibc-headerskernel-headers ksh libaio  libaio-devel libgcc libgomp libstdc++libstdc++-devel make numactl-devel sysstat unixODBC unixODBC-devel
、在安装Oracle之前,安装一些lib。
yum -y install  gccgcc-c++ make binutilscompat-libstdc++-33 elfutils-libelf elfutils-libelf-develglibc glibc-commonglibc-devel  libaiolibaio-devel libgcclibstdc++ libstdc++-devel unixODBC unixODBC-devel
 
yum install -y libstdc++.i686
yum install -y libaio-devel.i686
yum install -y compat-libstdc++-33.x86_64
yum install unixODBC.i686 -y
yum install unixODBC-devel.i686 -y
yum install libaio.i686 -y
yum install ksh.x86_64 -y
yum install package numactl-devel

3、 vi /etc/sysctl.conf 在末尾处添加下面的信息
net.ipv4.ip_local_port_range= 9000 65500
fs.file-max = 6815744
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
 
     要使 /etc/sysctl.conf 更改立即生效,执行以下命令: > sysctl -p
 
     可能出现如下错误:
     error:"net.bridge.bridge-nf-call-ip6tables" is an unknown key
      error: "net.bridge.bridge-nf-call-iptables" is anunknown key
      error: "net.bridge.bridge-nf-call-arptables" isan unknown key     解决方法:
     >lsmod | grep bridge
     >modprobe bridge
     >lsmod | grep bridge
4、vi /etc/security/limits.conf在末尾处添加
oracle   soft     nproc    4096
oracle   hard    nproc   16384
oracle   soft     nofile    4096
oracle   hard    nofile    65536
oracle   soft     stack    10240
5、vi  /etc/pam.d/login在末尾处添加
session  required   /lib64/security/pam_limits.so
session   required    pam_limits.so
6、vi /etc/profile在末尾处添加
if [ $USER ="oracle" ]; then
      if [ $SHELL ="/bin/ksh" ];then
          ulimit -p16384
          ulimit -n65536
      else
          ulimit -u16384 -n 65536
      fi
fi
 
  
7、创建Oracle用户和安装目录。
[root@localhost ~]# groupadd  oinstall            //创建Oracle Inventory 组
[root@localhost ~]# groupadd  dba                                   //创建组群DBA 组
[root@localhost ~]# useradd -g oinstall -G dba oracle       //创建Oracle软件拥有者(-g表示辅助组,-G表示主组)(还可以在后面接-d dir,表示用户的家目录的位置,默认普通用户的家目录在/home下)
[root@localhost ~]# passwd oracle                                     //修改oracle用户的密码
     创建安装目录:
[root@localhost ~]# mkdir -p  /home/oracle/app                        #基目录
[root@localhost ~]# mkdir /home/oracle/app/oraInventory       #该目录就像Windows下的注册表文件,每当有软件安装,就会向里面写一些注册表
[root@localhost ~]# mkdir /home/oracle/app/oracle                  #oracle数据库目录
 [root@localhost ~]# mkdir /home/oracle/app/oracle/product    #oracle实例目录     更改目录属主为Oracle用户所有(防止安装过程中发生权限不够的问题),输入命令:
[root@localhost ~]# chown -R oracle:oinstall  /home/oracle/app
[root@localhost ~]# chmod -R 775  /home/oracle/app/

8、配置oracle用户的环境变量,要在oracle用户下进行操作,输入:(在oracle用户下操作)
 >su oracle      (进入oracle命令)
 >vi  /home/oracle/.bash_profile     在末尾处添加
 
export  EDITOR=vi
export ORACLE_SID=orcl
export ORACLE_BASE=/home/oracle/app
export ORACLE_HOME=$ORACLE_BASE/oracle/product/11.2.0/dbhome_1
export INVENTORY_LOCATION=/home/oracle/app/oraInventory
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin
umask 022
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK

9,将oracle安装包导入,解压安装包(在root用户下)
[oracle@localhost root]$ su - root
[root@localhost ~]# cd /
[root@localhost /]# ls
[root@localhost /]# unzip linux.x64_11gR2_database_1of2.zip
[root@localhost /]# unzip linux.x64_11gR2_database_2of2.zip

10.在linux 服务器系统上操作安装数据库,(到服务器显示界面操作,不要ssh远程)
[root@localhost /]# su - oracle
-bash: [: oracle: unary operator expected
[oracle@localhost ~]$ cd /database/
[oracle@localhost database]$ su - root
[root@localhost ~]# xhost +
[root@localhost ~]# su - oracle
 
  [oracle@localhost database]$ ./runInstaller 
  
界面的安装步骤百度有详细,


11,启动oracle的.sh文件。(安着步骤来)

[oracle@localhost database]$ su - root
[root@localhost ~]# cd /home/oracle/oraInventory
[root@localhost oraInventory]# ./orainstRoot.sh
Changing permissions of /home/oracle/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
 
Changing groupname of /home/oracle/oraInventory tooinstall.
The execution of the script is complete.
[root@localhost oraInventory]#
[root@localhost oraInventory]# cd/home/oracle/app/oracle/product/11.2.0/dbhome_1
[root@localhost dbhome_1]# ./root.sh
Running Oracle 11g root.sh script...
 
The following environment variables are set as:
   ORACLE_OWNER= oracle
   ORACLE_HOME= /home/oracle/app/oracle/product/11.2.0/dbhome_1
 
Enter the full pathname of the local bin directory:[/usr/local/bin]:
   Copyingdbhome to /usr/local/bin ...
   Copyingoraenv to /usr/local/bin ...
   Copyingcoraenv to /usr/local/bin ...
 
 
Creating /etc/oratab file...
Entries will be added to the /etc/oratab file asneeded by
Database Configuration Assistant when a database iscreated
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
Finished product-specific root actions.
中间直接回车

二,数据库导入
1、防火墙配置
[root@localhost ~]# service iptables stop
[root@localhost ~]# vi /etc/sysconfig/iptables
# Manual customization of this file is notrecommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -jACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22-j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport1521 -j ACCEPT     (这个是数据库默认端口,一般填写这个)
-A INPUT -m state --state NEW -m tcp -p tcp --dport8080 -j ACCEPT        (这个是tomcat端口)
 
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-withicmp-host-prohibited
COMMIT
~
~
~
~
"/etc/sysconfig/iptables" 16L, 611C written
[root@localhost ~]# service iptables start
iptables: Applying firewall rules:                         [  OK  ]
[root@localhost ~]# 
 
  
 
   
 
  
 
   
 
  
 
  2.使用plsql软件管理数据库,连接数据库。根据备份数据库备份的说明来创建数据库的用户和密码。 
  
3.上传数据备份文件到/home/oracle
[root@localhost ~]# cd /home/oracle
[root@localhost oracle]# ****.dmp.gz
[root@localhost ~]# su - oracle
 
[oracle@localhost ~]$ cd /home/oracle/
[oracle@localhost ~]$ imp 用户/密码@orcl file=/home/oracle/****.dmp  fromuser=用户  touser=用户