Install Oracle database 9i on RHEL5.10(Not Good)
由于过几天的操作会涉及到关于Oracle database 9i的相关细节,所以,打算在自己的实验环境里先过一遍。
在正式开始前,你需要做以下的准备:
首先,你需要准备安装介质:
然后,你需要准备一个装好的Linux虚拟机环境:
为Linux创建默认的路径以及配置诸如YUM的基础服务(包括主机名的基础设定,默认安装时主机名为:localhost.localdomain,这是不友好的、不易读):
基础配置)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
[root@localhost ~]# ifconfig eth0 Link encap:Ethernet HWaddr 00:0C:29:2D:3E:85 inet addr:192.168.195.128 Bcast:192.168.195.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fe2d:3e85/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:8315 errors:0 dropped:0 overruns:0 frame:0 TX packets:191 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:857136 (837.0 KiB) TX bytes:26514 (25.8 KiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:32 errors:0 dropped:0 overruns:0 frame:0 TX packets:32 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:3828 (3.7 KiB) TX bytes:3828 (3.7 KiB) [root@localhost ~]# [root@localhost ~]# vi /etc/hosts [root@localhost ~]# cat /etc/hosts # Do not remove the following line, or various programs # that require network functionality will fail. # Localhost 127.0.0.1 localhost # Public eth0 192.168.195.128 oracle-db [root@localhost ~]# [root@localhost ~]# vi /etc/sysconfig/network [root@localhost ~]# cat /etc/sysconfig/network NETWORKING=yes NETWORKING_IPV6=no HOSTNAME=oracle-db [root@localhost ~]# [root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0 [root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 # Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) DEVICE=eth0 BOOTPROTO=static IPADDR=192.168.195.128 NETMASK=255.255.255.0 GATEWAY=192.168.195.1 HWADDR=00:0C:29:2D:3E:85 ONBOOT=yes [root@localhost ~]# [root@localhost ~]# vi /etc/selinux/config [root@localhost ~]# cat /etc/selinux/config # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - SELinux is fully disabled. SELINUX=disabled # SELINUXTYPE= type of policy in use. Possible values are: # targeted - Only targeted network daemons are protected. # strict - Full SELinux protection. SELINUXTYPE=targeted [root@localhost ~]# [root@localhost ~]# vi /etc/fstab [root@localhost ~]# cat /etc/fstab LABEL=/ / ext3 defaults 1 1 LABEL=/boot /boot ext3 defaults 1 2 tmpfs /dev/shm tmpfs defaults 0 0 devpts /dev/pts devpts gid=5,mode=620 0 0 sysfs /sys sysfs defaults 0 0 proc /proc proc defaults 0 0 LABEL=SWAP-sda3 swap swap defaults 0 0 # Mount ISO media /dev/sr1 /iso iso9660 defaults 0 0 [root@localhost ~]# [root@localhost ~]# mkdir /iso [root@localhost ~]# mkdir /software [root@localhost ~]# mkdir /backup [root@localhost ~]# chkconfig sendmail off [root@localhost ~]# chkconfig iptables off [root@localhost ~]# [root@oracle-db ~]# chmod -R 777 /software [root@oracle-db ~]# chmod -R 777 /backup/ [root@localhost ~]# [root@localhost ~]# reboot Broadcast message from root (pts/1) (Thu Dec 4 17:07:35 2014): The system is going down for reboot NOW! [root@localhost ~]# |
YUM配置)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
[root@oracle-db ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda2 18G 2.5G 14G 16% / /dev/sda1 289M 17M 258M 7% /boot tmpfs 499M 0 499M 0% /dev/shm [root@oracle-db ~]# [root@oracle-db ~]# mount -a mount: block device /dev/sr1 is write-protected, mounting read-only [root@oracle-db ~]# [root@oracle-db ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda2 18G 2.5G 14G 16% / /dev/sda1 289M 17M 258M 7% /boot tmpfs 499M 0 499M 0% /dev/shm /dev/sr1 4.1G 4.1G 0 100% /iso [root@oracle-db ~]# [root@oracle-db ~]# vi /etc/yum.repos.d/iso.repo [root@oracle-db ~]# cat /etc/yum.repos.d/iso.repo [Server] name=Server baseurl=file:///iso/Server gpgcheck=0 [VT] name=VT baseurl=file:///iso/VT gpgcheck=0 [Cluster] name=Cluster baseurl=file:///iso/Cluster gpgcheck=0 [ClusterStorage] name=ClusterStorage baseurl=file:///iso/ClusterStorage gpgcheck=0 [root@oracle-db ~]# [root@oracle-db ~]# yum clean metadata Loaded plugins: product-id, security, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. 0 metadata files removed 0 sqlite files removed 0 metadata files removed [root@oracle-db ~]# yum clean all Loaded plugins: product-id, security, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. Cleaning up Everything [root@oracle-db ~]# [root@oracle-db ~]# yum repolist; Loaded plugins: product-id, security, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. Cluster | 1.5 kB 00:00 Cluster/primary | 6.1 kB 00:00 Cluster 32/32 ClusterStorage | 1.5 kB 00:00 ClusterStorage/primary | 8.6 kB 00:00 ClusterStorage 39/39 Server | 1.5 kB 00:00 Server/primary | 942 kB 00:00 Server 3358/3358 VT | 1.3 kB 00:00 VT/primary | 19 kB 00:00 VT 59/59 repo id repo name status Cluster Cluster 32 ClusterStorage ClusterStorage 39 Server Server 3,358 VT VT 59 repolist: 3,488 [root@oracle-db ~]# [root@oracle-db ~]# |
至此,正式开始针对Oracle的预配置前的准备就完成了。
下面的章节,正式开始。
————————————————————————————————————————————
1. YUM安装需要的系统软件包:
yum install -y binutils* compat-db setarch compat-libstdc++-* control-center elfutils-libelf-* elfutils-libelf-devel-* elfutils-libelf-devel-static-* gcc-* gcc-c++-* glibc-* glibc-common-* glibc-devel-* glibc-headers-* ksh libaio-* libaio-devel-* libgcc libstdc++-* libstdc++-devel make sysstat unixODBC unixODBC-devel compat-libstdc++-33.i386 compat-libstdc++-296.i386 glibc.i686 glibc-devel.i386 unixODBC.i386 unixODBC-devel.i386 libaio.i386 libaio-devel.i386 libgcc.i386 libstdc++.i386 libstdc++-devel.i386 libaio-devel.i386 libXp.i386 openmotif openmotif-devel tcl-devel
2. 新增用户组及用户:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
[root@oracle-db ~]# groupadd oinstall [root@oracle-db ~]# groupadd dba [root@oracle-db ~]# [root@oracle-db ~]# useradd -g oinstall -G dba oracle [root@oracle-db ~]# [root@oracle-db ~]# id oracle uid=501(oracle) gid=501(oinstall) groups=501(oinstall),502(dba) [root@oracle-db ~]# [root@oracle-db ~]# passwd oracle Changing password for user oracle. New UNIX password: BAD PASSWORD: it is based on a dictionary word Retype new UNIX password: passwd: all authentication tokens updated successfully. [root@oracle-db ~]# |
3. 创建需要的目录结构:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
[root@oracle-db ~]# mkdir -p /u01/app/oracle/product/9 [root@oracle-db ~]# [root@oracle-db ~]# ll -d /u01/ drwxr-xr-x 3 root root 4096 Dec 4 17:47 /u01/ [root@oracle-db ~]# [root@oracle-db ~]# chown -R oracle.oinstall /u01/ [root@oracle-db ~]# [root@oracle-db ~]# ll -d /u01/ drwxr-xr-x 3 oracle oinstall 4096 Dec 4 17:47 /u01/ [root@oracle-db ~]# [root@oracle-db ~]# chmod -R 775 /u01/ [root@oracle-db ~]# [root@oracle-db ~]# ll -d /u01/ drwxrwxr-x 3 oracle oinstall 4096 Dec 4 17:47 /u01/ [root@oracle-db ~]# |
4. 配置用户(User: oracle)的环境变量:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
[root@oracle-db ~]# cat /home/oracle/.bash_profile # .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs PATH=$PATH:$HOME/bin export PATH # for Oracle database 9i export ORACLE_SID=allby export ORACLE_UNQNAME=dallby export JAVA_HOME=/usr/local/java export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=$ORACLE_BASE/product/9/dbhome_1 export ORACLE_PATH=/u01/app/common/oracle/sql export ORACLE_TERM=xterm export NLS_DATE_FORMAT="DD-MON-YYYY HH24:MI:SS" export TNS_ADMIN=$ORACLE_HOME/network/admin export ORA_NLS11=$ORACLE_HOME/nls/data export PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin:/u01/app/common/oracle/bin export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/oracm/lib:/lib:/usr/lib:/usr/local/lib export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib:$ORACLE_HOME/network/jlib export THREADS_FLAG=native export TEMP=/tmp export TMPDIR=/tmp [root@oracle-db ~]# |
5. 文件:/etc/sysctl.conf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
[root@oracle-db ~]# tail -n 8 /etc/sysctl.conf # for Oracle database 9i kernel.sem=250 32000 100 128 kernel.shmmax=4294967295 kernel.shmmni=128 kernel.msgmnb=65536 kernel.msgmni=2878 fs.file-max=65536 net.ipv4.ip_local_port_range=1024 65000 [root@oracle-db ~]# [root@oracle-db ~]# 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 kernel.msgmnb = 65536 kernel.msgmax = 65536 kernel.shmmax = 68719476736 kernel.shmall = 4294967296 kernel.sem = 250 32000 100 128 kernel.shmmax = 4294967295 kernel.shmmni = 128 kernel.msgmnb = 65536 kernel.msgmni = 2878 fs.file-max = 65536 net.ipv4.ip_local_port_range = 1024 65000 [root@oracle-db ~]# |
6. 文件:/etc/security/limits.conf
1 2 3 4 5 6 7 8 |
[root@oracle-db ~]# tail -n 6 /etc/security/limits.conf # for Oracle database 9i oracle soft nofile 65536 oracle hard nofile 65536 oracle soft nproc 16384 oracle hard nproc 16384 [root@oracle-db ~]# |
7. 设置环境变量:DISPLAY
1 2 3 4 5 6 |
[root@oracle-db ~]# env | grep DISPLAY DISPLAY=localhost:10.0 [root@oracle-db ~]# export DISPLAY=192.168.195.1:0.0 [root@oracle-db ~]# xhost + access control disabled, clients can connect from any host [root@oracle-db ~]# |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
[root@oracle-db software]# unzip p3006854_9204_LINUX.zip Archive: p3006854_9204_LINUX.zip creating: 3006854/ inflating: 3006854/rhel3_pre_install.sh inflating: 3006854/README.txt [root@oracle-db software]# cd 3006854/ [root@oracle-db 3006854]# ls README.txt rhel3_pre_install.sh [root@oracle-db 3006854]# [root@oracle-db 3006854]# sh rhel3_pre_install.sh Applying patch... Ensuring permissions are correctly set... Done. Patch successfully applied [root@oracle-db 3006854]# |
二、9i的安装。
1. 上传软件介质:
用oralce用户执行解压:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
[oracle@oracle-db software]$ pwd /software [oracle@oracle-db software]$ mkdir disk1 [oracle@oracle-db software]$ mkdir disk2 [oracle@oracle-db software]$ mkdir disk3 [oracle@oracle-db software]$ [oracle@oracle-db software]$ ls -altr total 1309176 drwxr-xr-x 28 root root 4096 Dec 4 17:47 .. drwxr-xr-x 2 oracle oinstall 4096 Dec 4 18:36 disk1 drwxr-xr-x 2 oracle oinstall 4096 Dec 4 18:36 disk2 -rw-r--r-- 1 root root 424978211 Dec 4 18:36 amd64_9204_linux_disk1.zip drwxr-xr-x 2 oracle oinstall 4096 Dec 4 18:36 disk3 drwxrwxrwx 5 root root 4096 Dec 4 18:36 . -rw-r--r-- 1 root root 579234220 Dec 4 18:36 amd64_9204_linux_disk2.zip -rw-r--r-- 1 root root 335021201 Dec 4 18:37 amd64_9204_linux_disk3.zip [oracle@oracle-db software]$ [oracle@oracle-db software]$ cd disk1/ [oracle@oracle-db disk1]$ unzip ../amd64_9204_linux_disk1.zip (... ...etc) [oracle@oracle-db disk1]$ ls doc index.htm install response runInstaller stage [oracle@oracle-db disk1]$ cd ../disk2/ [oracle@oracle-db disk2]$ unzip ../amd64_9204_linux_disk2.zip (... ...etc) [oracle@oracle-db disk2]$ ls stage [oracle@oracle-db disk2]$ cd ../disk3/ [oracle@oracle-db disk3]$ unzip ../amd64_9204_linux_disk3.zip (... ...etc) [oracle@oracle-db disk3]$ ls stage [oracle@oracle-db disk3]$ |
运行OUI(disk 1):
1 2 3 4 5 6 7 |
[oracle@oracle-db disk3]$ cd ../disk1 [oracle@oracle-db disk1]$ ls doc index.htm install response runInstaller stage [oracle@oracle-db disk1]$ [oracle@oracle-db disk1]$ ./runInstaller & [1] 26909 [oracle@oracle-db disk1]$ |
1 2 3 4 5 6 |
[oracle@oracle-db disk1]$ su - root Password: [root@oracle-db ~]# sh /tmp/orainstRoot.sh Creating Oracle Inventory pointer file (/etc/oraInst.loc) Changing groupname of /u01/app/oracle/oraInventory to oinstall. [root@oracle-db ~]# |
————————————
… 事实上,装到最后,会发现在高版本的Linux上,通过正常的安装的方式是无法成功的安装9i的。
除非通过直接拷贝文件的方式,才可以部署成功。
2014年12月9日21:44:26