1.修改操作系统核心参数
在Root用户下执行以下步骤:
1)修改用户的SHELL的限制,修改/etc/security/limits.conf文件
输入命令:vi /etc/security/limits.conf,按i键进入编辑模式,将下列内容加入该文件。
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
编辑完成后按Esc键,输入“:wq”存盘退出
2)修改/etc/pam.d/login 文件,输入命令:vi /etc/pam.d/login,按i键进入编辑模式,将下列内容加入该文件。
session required /lib/security/pam_limits.so
session required pam_limits.so
编辑完成后按Esc键,输入“:wq”存盘退出
3)修改linux内核,修改/etc/sysctl.conf文件,输入命令: vi /etc/sysctl.conf ,按i键进入编辑模式,将下列内容加入该文件
fs.file-max = 6815744
fs.aio-max-nr = 1048576
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
编辑完成后按Esc键,输入“:wq”存盘退出
4)要使 /etc/sysctl.conf 更改立即生效,执行以下命令。 输入:sysctl -p 显示如下:
linux:~ # sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
error: "net.bridge.bridge-nf-call-ip6tables" is an unknown key
error: "net.bridge.bridge-nf-call-iptables" is an unknown key
error: "net.bridge.bridge-nf-call-arptables" is an unknown key
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
fs.file-max = 6815744
fs.aio-max-nr = 1048576
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
5)编辑 /etc/profile ,输入命令:vi /etc/profile,按i键进入编辑模式,将下列内容加入该文件。
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
编辑完成后按Esc键,输入“:wq”存盘退出
6)创建相关用户和组,作为软件安装和支持组的拥有者。
创建用户,输入命令:
groupadd oinstall
groupadd dba
创建Oracle用户和密码,输入命令:
useradd -g oinstall -g dba -m oracle
passwd oracle
然后会让你输入密码,密码任意输入2次,但必须保持一致,回车确认
此处密码123456
7)创建数据库软件目录和数据文件存放目录,目录的位置,根据自己的情况来定,注意磁盘空间即可,这里我把其放到oracle用户下,例如:
输入命令:
mkdir /home/oracle/app
mkdir /home/oracle/app/oracle
mkdir /home/oracle/app/oradata
mkdir /home/oracle/app/oracle/product
8)更改目录属主为Oracle用户所有,输入命令:
chown -R oracle:oinstall /home/oracle/app
9)配置oracle用户的环境变量,首先,切换到新创建的oracle用户下,
输入:su – oracle ,然后直接在输入 : vi .bash_profile
按i编辑 .bash_profile,进入编辑模式,增加以下内容:
umask 022
export ORACLE_BASE=/home/oracle/app
export ORACLE_HOME=$ORACLE_BASE/oracle/product/11.2.0/dbhome_1
export ORACLE_SID=orcl
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
编辑完成后按Esc键,输入“:wq”存盘退出
测试环境变量是否有效:
[@localhost ~]$ echo $ORACLE_HOME
发现为空。执行下面命令
[@localhost ~]$ . ./.bash_profile
再次测试,ok
[@localhost ~]$ echo $ORACLE_HOME
/home/oracle/app/oracle/product/11.2.0/dbhome_1
安装过程:
1) 当上述系统要求操作全部完成后,注销系统,在图形界面以Oracle用户登陆。
目录/opt/database
输入命令:
cd /opt/database
使用ls命令可以查看解压后database所包含的文件,如下:
[@localhost database]$ ls
doc install response rpm runInstaller sshsetup stage welcome.html
2) 执行安装,输入命令:./runInstaller
[oracle@localhost database]$ ./runInstaller
bash: ./runInstaller: Permission denied
解决办法:
[oracle@localhost database]$ su root
Password:
[root@localhost database]# chown -R gis:gis /opt/database
[root@localhost database]# chmod -R 777 /opt/database
[root@localhost database]# su oracle
然后:
Starting Oracle Universal Installer...
Checking Temp space: must be greater than 120 MB. Actual 25959 MB Passed
Checking swap space: must be greater than 150 MB. Actual 3999 MB Passed
Checking monitor: must be configured to display at least 256 colors. Actual 16777216 Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2014-03-24_06-36-50PM. Please wait ...
上一张图可以看到缺失很多的rpm包,上传到linux中
如不能安装,则root用户下使用rpm –ivh xxx.rpm --nodeps –force 来进行安装(其中加上--nodeps -- force 代表强制安装,是在直接使用rpm –ivh xxx.rpm安装不成功的情况下用的)安装过程略。如 rpm -ivh libaio-0.3.105-2.i386.rpm --nodeps –-force。
rpm -ivh compat-libstdc++-33-3.2.3-61.i386.rpm --nodeps --force
rpm -ivh gcc-c++-4.4.7-3.el6.x86_64.rpm --nodeps -force
rpm -ivh gettext-0.18.3.2-1.fc21.x86_64.rpm --nodeps --force
rpm -ivh glibc-2.3.4-2.54.i686.rpm --nodeps --force
rpm -ivh glibc-2.18-4.4.1.x86_64.rpm --nodeps --force
rpm -ivh libaio-0.3.105-2.i386.rpm --nodeps --force
rpm -ivh libaio-devel-0.3.107-10.el6.i686.rpm --nodeps --force
rpm -ivh libaio-devel-0.3.107-10.el6.x86_64.rpm --nodeps --force
rpm -ivh libgcc-3.4.6-3.i386.rpm --nodeps --force
rpm -ivh libstdc++-3.4.6-11.i386.rpm --nodeps --force
rpm -ivh pdksh-5.2.14-36.el5.i386.rpm --nodeps --force
rpm -ivh redhat-lsb-4.0-3.el6.x86_64.rpm --nodeps --force
rpm -ivh unixODBC-2.2.11-7.1.i386.rpm --nodeps --force
rpm -ivh unixODBC-2.2.14-12.el6_3.x86_64.rpm --nodeps --force
rpm -ivh unixODBC-devel-2.2.11-7.1.i386.rpm --nodeps --force
rpm -ivh unixODBC-devel-2.2.14-12.el6_3.x86_64.rpm --nodeps –force
root用户下执行以上语句,安装成功提示:
[root@localhost Downloads]# rpm -ivh unixODBC-2.2.11-7.1.i386.rpm --nodeps --force
warning: unixODBC-2.2.11-7.1.i386.rpm: Header V3 DSA/SHA1 Signature, key ID 37017186: NOKEY
Preparing... ########################################### [100%]
1:unixODBC ########################################### [100%]
安装完成后,系统会提示你需要用root权限执行2个shell脚本。按照其提示的路径,找到其所在的位置,如:我的就在/home/oracle/app/oracle/product/11.2.0/dbhome_1/root.sh
和 /home/oracle/app/oraInventory/orainstRoot.sh 新开启一个终端,输入命令:
su root cd /home/oracle/app/oracle/product/11.2.0/dbhome_1 sh root.sh cd /home/oracle/oraInventory sh orainstRoot.sh [oracle@localhost ~]$ su root Password: [root@localhost oracle]# cd /home/oracle/app/oracle/product/11.2.0/dbhome_1 [root@localhost dbhome_1]# sh 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]: The file "dbhome" already exists in /usr/local/bin. Overwrite it? (y/n) [n]: n The file "oraenv" already exists in /usr/local/bin. Overwrite it? (y/n) [n]: n The file "coraenv" already exists in /usr/local/bin. Overwrite it? (y/n) [n]: n Entries will be added to the /etc/oratab file as needed by Database Configuration Assistant when a database is created Finished running generic part of root.sh script. Now product-specific root actions will be performed. Finished product-specific root actions. [root@localhost dbhome_1]# cd /home/oracle/oraInventory [root@localhost oraInventory]# sh 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 to dba. The execution of the script is complete.