一、Linux上安装Oracle DataBase 11gR2
1. 安装Linux操作系统
使用Oracle Linux 5 Update 2
查看官方文档,支持的操作系统: http://docs.oracle.com/cd/E11882_01/install.112/e47689/pre_install.htm#LADBI1106 省略
2. 配置Linux操作系统
- 配置RPM包
http://docs.oracle.com/cd/E11882_01/install.112/e47689/pre_install.htm#BABIAHCA
挂载安装ISO
[root@oracledemo ~]# cd /media/Enterprise\ Linux\ dvd\ 20080528/ [root@oracledemo Enterprise Linux dvd 20080528]# cd Server/ [root@oracledemo Server]# ls binutils* binutils-2.17.50.0.6-6.el5.i386.rpm binutils-devel-2.17.50.0.6-6.el5.i386.rpm
安装所需要的rpm包
[root@oracledemo Server]# vim ~/rpm.sh [root@oracledemo Server]# chmod 777 ~/rpm.sh [root@oracledemo Server]# ~/rpm.sh rpm -ivh binutils-2.17.50.0.6-6.el5.i386.rpm rpm -ivh compat-libstdc++-33-3.2.3-61.i386.rpm rpm -ivh elfutils-libelf-0.125-3.el5.i386.rpm rpm -ivh elfutils-libelf-devel-0.125-3.el5.i386.rpm elfutils-libelf-devel-static-0.125-3.el5.i386.rpm rpm -ivh kernel-headers-2.6.18-92.el5.i386.rpm rpm -ivh glibc-headers-2.5-24.i386.rpm rpm -ivh glibc-devel-2.5-24.i386.rpm rpm -ivh libgomp-4.1.2-42.el5.i386.rpm rpm -ivh gcc-4.1.2-42.el5.i386.rpm rpm -ivh libstdc++-devel-4.1.2-42.el5.i386.rpm rpm -ivh gcc-c++-4.1.2-42.el5.i386.rpm rpm -ivh glibc-common-2.5-24.i386.rpm rpm -ivh glibc-devel-2.5-24.i386.rpm rpm -ivh glibc-headers-2.5-24.i386.rpm rpm -ivh kernel-headers-2.6.18-92.el5.i386.rpm rpm -ivh ksh-20060214-1.7.i386.rpm rpm -ivh libaio-0.3.106-3.2.i386.rpm rpm -ivh libaio-devel-0.3.106-3.2.i386.rpm rpm -ivh libgcc-4.1.2-42.el5.i386.rpm rpm -ivh libgomp-4.1.2-42.el5.i386.rpm rpm -ivh libstdc++-4.1.2-42.el5.i386.rpm rpm -ivh libstdc++-devel-4.1.2-42.el5.i386.rpm rpm -ivh make-3.81-3.el5.i386.rpm rpm -ivh sysstat-7.0.2-1.el5.i386.rpm rpm -ivh unixODBC-2.2.11-7.1.i386.rpm unixODBC-devel-2.2.11-7.1.i386.rpm
- 修改Linux的配置文件
http://docs.oracle.com/cd/E11882_01/install.112/e47689/pre_install.htm#LADBI1187
a、修改/etc/sysctl.conf
fs.aio-max-nr = 1048576 fs.file-max = 6815744 kernel.shmall = 2097152 kernel.shmmax = 536870912 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 net.ipv4.ip_local_port_range = 9000 65500 net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 1048576
b、修改/etc/security/limits.conf
#<domain> <type> <item> <value> oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 oracle soft stack 10240
c、修改/home/oracle/.bash_profile
umask 022 export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1 export ORACLE_SID=orcl export PATH=$PATH:$ORACLE_HOME/bin
d、修改/etc/pam.d/login
session required /lib/security/pam_limits.so session required pam_limits.so
e、修改/etc/profile
if [ $USER = "oracle" ]; then if [ $SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fi fi
- 创建目录和组
创建用户和组
groupadd oinstall groupadd dba usermod -g oinstall -G dba oracle
创建安装目录(使用oracle用户安装数据库)
mkdir -p /u01/app/ chown -R oracle:oinstall /u01/app/ chmod -R 775 /u01/app/
创建安装介质目录
mkdir -p /stage/11.2.0 chown -R oracle:oinstall /stage/11.2.0/ chmod -R 777 /stage/
修改Swap值(oracle安装时有要求3G的swap)
[root@oracledemo ~]# cd /usr/ [root@oracledemo usr]# mkdir swap [root@oracledemo usr]# cd swap/ [root@oracledemo swap]# dd if=/dev/zero of=swapfile bs=1G count=2 #创建虚拟文件,2个数据块,每个1G 2+0 records in 2+0 records out 2147483648 bytes (2.1 GB) copied, 36.5858 seconds, 58.7 MB/s [root@oracledemo swap]# mkswap swapfile Setting up swapspace version 1, size = 2147479 kB [root@oracledemo swap]# swapon swapfile 激活swap文件 [root@oracledemo swap]# free -m 检查Swap的值 total used free shared buffers cached Mem: 3523 3366 156 0 11 3096 -/+ buffers/cache: 257 3265 Swap: 4031 0 4031
- 重启(让配置生效,去掉挂载的ISO)
reboot
3. Oracle11gR2的安装
http://www.oracle.com/technetwork/database/enterprise-edition/downloads/112010-linuxsoft-085393.html
使用winscp577setup.exe上传安装包:oracle用户
解压zip包
[oracle@oracledemo ~]$ cd /stage/11.2.0/ [oracle@oracledemo 11.2.0]$ unzip linux_11gR2_database_1of2.zip [oracle@oracledemo 11.2.0]$ unzip linux_11gR2_database_2of2.zip [oracle@oracledemo database]$ ls #runInstaller可以使用图形界面 doc install response rpm runInstaller sshsetup stage welcome.html
使用VNC来安装(iso中默认有vnc的server)
[oracle@oracledemo ~]$ vncserver You will require a password to access your desktops. #第一次启动要设置密码,如果不好使可以使用vncpasswd设置下 Password: password Verify: password New 'oracledemo:1 (oracle)' desktop is oracledemo:1 Creating default startup script /home/oracle/.vnc/xstartup #默认是命令行,使用图形界面需要修改配置文件 Starting applications specified in /home/oracle/.vnc/xstartup Log file is /home/oracle/.vnc/oracledemo:1.log
配置vnc使用图形界面
[oracle@oracledemo ~]$ vim /home/oracle/.vnc/xstartup #twm & gnome-session &
重启vncserver
[oracle@oracledemo ~]$ vncserver -kill oracledemo:1 Killing Xvnc process ID 14608 [oracle@oracledemo ~]$ vncserver -geometry 1280x800 #指窗口大小
启动客户端:VNC-Viewer-5.2.3-Windows-64bit.exe(windows上)
vnc server: 192.168.56.90:1 password : password
在vnc下安装oracle
[oracle@oracledemo ~]$ cd /stage/11.2.0/database/ [oracle@oracledemo database]$ ls doc install response rpm runInstaller sshsetup stage welcome.html [oracle@oracledemo database]$ ./runInstaller