Install Oracle10g On RedhatEL AS3 Update2 Step-by-Step


虽然 windows 平台下的 oracle 已经装过几回了,但是 linux 下没有试过。看网上的文档 , 好像比 windows 下装要复杂不少,更改系统参数,创建 user&group, 检查必要的软件包,设置环境变量等一大堆工作要做。 于是趁周末在VMWare中装了一回,记下具体步骤以供以后参考。

OS 版本 : Red Hat Enterprise Linux AS release3 Update2 Kernel 2.4.21-15.EL (安装好内核开发工具)
Oracle 版本 : Oracle 10.1.0.2 for linux x86

Oracle10g 的的下载地址 : http://otn.oracle.com/software/products/database/oracle10g/htdocs/linuxsoft.html

准备安装

检查磁盘空间

Oracle Universal Installer 约需要 400M 左右的 /tmp 空间

df -k /tmp

如果当前 /tmp 空间不够 , 你可以在其他空间足够的 filesystem 上创建新的临时目录

mkdir /

  1<anotherfilesystem>/tmp   
  2# chown root.root /<anotherfilesystem>/tmp   
  3# chmod 1777 /<anotherfilesystem>/tmp   
  4# export TEMP=/<anotherfilesystem>   
  5# export TMPDIR=/<anotherfilesystem>   
  6  
  7装好 oracle 后再恢复到原来的状态   
  8# rmdir /<anotherfilesystem>/tmp   
  9# unset TEMP   
 10# unset TMPDIR   
 11  
 12oracle 大约需要 3G 左右的空间(默认安装且包括初始库),事先请规划好   
 13  
 14检查内存和交换区   
 15  
 16查看物理内存大小   
 17# grep MemTotal /proc/meminfo   
 18  
 19查看交换区大小   
 20# grep SwapTotal /proc/meminfo   
 21  
 22安装 oracle 需要足够大的内存和交换区 , 所以最好还是找台好点的机器。 oracle 推荐最好内存 512M 以上, swap 1G 以上。如果只是安装一个玩玩,实际上没那么多也没关系啦,我的虚拟机就只分了 384M 的内存和 768M 的 swap 。   
 23  
 24检查软件包   
 25  
 26使用指令   
 27# rpm –qa | grep packname \ 其中 packname 是需要检查的软件包的名字   
 28  
 29保证以下的包(或者更高版本)已经安装好。没装的话到 redhat 的安装盘里都可以找到   
 30  
 31gcc-3.2.3-34   
 32make-3.79.1-17   
 33binutils-2.14.90.0.4-35   
 34openmotif-2.2.2-16   
 35setarch-1.3-1   
 36compat-db-4.0.14.5   
 37compat-gcc-7.3-2.96.128   
 38compat-gcc-c++-7.3-2.96.128   
 39compat-libstdc++-7.3-2.96.128   
 40compat-libstdc++-devel-7.3-2.96.128   
 41  
 42安装RPM包   
 43# rpm -Uvh packname   
 44  
 45添加 group 和 user   
 46  
 47# /usr/sbin/groupadd oinstall   
 48# /usr/sbin/groupadd dba   
 49  
 50建立 oracle 用户,其默认组为 oinstall ,同时也是 dba 组的成员   
 51# /usr/sbin/useradd -g oinstall -G dba oracle   
 52  
 53修改 oracle 用户的 password   
 54# passwd oracle   
 55  
 56建好后可以检查一下   
 57# id oracle   
 58uid=500(oracle) gid=500(oinstall) groups=500(oinstall),501(dba)   
 59  
 60修改系统核心参数   
 61  
 62编辑 sysctl.conf   
 63# vi /etc/sysctl.conf   
 64  
 65添加以下内容   
 66kernel.shmall = 2097152   
 67kernel.shmmax = 2147483648   
 68kernel.shmmni = 4096   
 69kernel.sem = 250 32000 100 128   
 70fs.file-max = 65536   
 71net.ipv4.ip_local_port_range = 1024 65000   
 72  
 73保存退出后,执行以下命令使其生效 ( 当然重启也是可以的 ^-^)   
 74# sysctl –p   
 75  
 76检查一下上面的操作是否正确 :   
 77# /sbin/sysctl -a | grep sem   
 78# /sbin/sysctl -a | grep shm   
 79# /sbin/sysctl -a | grep file-max   
 80# /sbin/sysctl -a | grep ip_local_port_range   
 81  
 82这些参数也可以直接更改 /proc/sys/kernel 下相应文件来实现,详细请参考   
 83http://download-west.oracle.com/docs/html/A96167_01/pre.htm#CHDHDABJ   
 84  
 85如果是生产库,出于性能上的考虑 , 还需要进行如下的设定,以便改进 Oracle 用户的有关 nofile( 可打开的文件描述符的最大数 ) 和 nproc( 单个用户可用的最大进程数量 ) 。如果仅仅是测试安装的话,也可以不用修改。   
 86  
 87# vi /etc/security/limits.conf   
 88  
 89添加如下的行   
 90* soft nproc 2047   
 91* hard nproc 16384   
 92* soft nofile 1024   
 93* hard nofile 65536   
 94  
 95# vi /etc/pam.d/login   
 96  
 97添加如下的行   
 98session required /lib/security/pam_limits.so   
 99  
100# vi /etc/profile   
101  
102添加如下部分:   
103if [ $USER = "oracle" ]; then   
104if [ $SHELL = "/bin/ksh" ]; then   
105ulimit -p 16384   
106ulimit -n 65536   
107else   
108ulimit -u 16384 -n 65536   
109fi   
110fi   
111  
112之后,验证一下   
113# su oracle   
114$ ulimit -a   
115  
116设置环境变量   
117  
118# su oracle   
119$ cd ~   
120$ vi .bach_profile   
121  
122添加以下内容   
123export ORACLE_BASE=/opt/oracle   
124export ORACLE_HOME=$ORACLE_BASE/product/10.1.0/   
125export ORACLE_SID=db01   
126export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin   
127export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib   
128export LC_CTYPE=en_US.UTF-8   
129  
130其中 /opt/oracle 请事先建好并给予相应的权限,简单一点可以将其 owner 设为 oracle ( chown –R oracle.oinstall /opt/oracle ),作为 oracle 的安装目录 ( 可以自己另外规划 )   
131  
132确认并是修改生效   
133$ source .bash_profile   
134  
135开始安装   
136  
137由于我是用虚拟机装的 , 我把从网上下的 oracle10g(ship.db.cpio.gz)copy 到了硬盘上,目录为 /tmp, 先作一下 CRC 验证,以免下载的 oracle 有问题。   
138# cksum ship.db.cpio.gz   
139  
140解压缩   
141# gzip –d ship.db.cpio.gz   
142  
143解包 ship.db.cpio   
144# cpio -idmv &lt; ship.db.cpio   
145  
146得到安装目录 /tmp/Disk1 ,如果你有刻录机的话就可以把该目录刻到光盘上了。这里我从硬盘安装。   
147  
148# su oracle   
149$ cd /tmp/Disk1   
150$ ./runInstaller   
151  
152如果出现如下错误   
153xlib:connection to "localhost:0.0" refused by server   
154xlib:client is not authorized to connect to server   
155  
156Exception in thread "main" java.lang.InternalError:can't connect to x11 window server using "localhost:0.0"   
157  
158at .......   
159  
160解决方法:   
161• # xhost +   
162access control disabled,clients can connect from any host.   
163\xhost + 是使所有用户从任何一个终端都能访问 Xserver(设置后可能有安全隐患);   
164• # xhost + yourip   
165yourip being added to acces control list   
166\xhost + yourip 使 ip 上的用户能够访问 Xserver   
167  
168  
169顺利的话,应该会出现 welcome 画面,点“ Next ”继续。   
170  
171指定 Inventory 目录和安装时使用的 group ,使用默认值即可,点“ Next ”   
172  
173这时会弹出一个窗口,让你开启另外一个 terminal ,以 root 身份执行以下命令:   
174# /home/oracle/oraInventory/orainstRoot.sh   
175  
176执行完后点“ Continue ”继续   
177  
178接下来修改安装文件路径 , 按你的实际需要修改好后“ Next ”   
179  
180选择安装内型,这里我选“ Enterprise Edition ”安装企业版,“ Next ”继续下一步。   
181  
182这时会自动检查你的系统是否满足安装的需求(可以按“stop”跳过),结果如下:   
183  
184hecking operating system certification   
185Expected result: One of redhat-2.1,redhat-3,UnitedLinux-1.0   
186Actual Result: redhat-3   
187Check complete. The overall result of this check is: Passed   
188=======================================================================   
189  
190Checking kernel parameters   
191Checking for VERSION=2.4.9.25; found VERSION=2.4.21. Passed   
192Checking for shmall=2097152; found shmall=2097152. Passed   
193Checking for shmseg=10; found shmseg=4096. Passed   
194Checking for semmsl=250; found semmsl=250. Passed   
195Checking for semmni=128; found semmni=128. Passed   
196Checking for filemax=65536; found filemax=39321. Passed   
197Checking for shmmni=4096; found shmmni=4096. Passed   
198Checking for semmns=32000; found semmns=32000. Passed   
199Checking for semopm=100; found semopm=32. passed   
200Checking for shmmin=1; found shmmin=1. Passed   
201Checking for shmmax=2147483648; found shmmax=33554432. passed   
202Check complete. The overall result of this check is: passed   
203  
204=======================================================================   
205  
206Checking recommended operating system packages   
207Checking for make-3.79; found make-3.79.1-17. Passed   
208Checking for binutils-2.11.90.0.8-12; found binutils-2.14.90.0.4-35. Passed   
209Checking for gcc-2.96; found gcc-3.2.3-34. Passed   
210Checking for openmotif-2.1.30-11; found openmotif-2.2.2-16. Passed   
211Check complete. The overall result of this check is: Passed   
212  
213=======================================================================   
214  
215Checking recommended glibc version   
216Expected result: 2.2.4.31.7   
217Actual Result: 2.3.2.95.20   
218Check complete. The overall result of this check is: Passed   
219  
220=======================================================================   
221  
222Validating ORACLE_BASE location (if set)   
223Check complete. The overall result of this check is: Passed   
224  
225=======================================================================   
226  
227如果全部 passed ,继续下一步。否则,请参照 准备安装 部分重新作相应修改,然后“ Retry ”重新检测,直到 passed 到下一步。   
228  
229接下来选择建库的类型,这里我先不建库,待安装好后在利用 dbca 来建库或者手工建库(如何用 dbca 建库请到 http://www.google.com 搜索相应文章)。所以选择“ Do not create a starter database ”后“ Next ”。   
230  
231出现“ Summary ”画面,确认后按“ Install ”。   
232  
233最后还会弹出一个对话框,要求以root身份执行$ORACLE_HOME/root.sh   
234# $ORACLE_HOME/root.sh   
235  
236友情提示   
237  
238安装过程中如果出现错误,请利用 google 搜索相应的解决方法。   
239  
240参考文章   
241  
242Fenng 的 Installing Oracle 10g on RHEL AS 3 Step-by-Step   
243http://www.dbanotes.net/Oracle/Install-Oracle10g-RHEL3.htm   
244  
245Werner Puschitz 的 10g 安装指南   
246http://www.puschitz.com/InstallingOracle10g.shtml   
247  
248Oracle Database Quick Installation Guide 10 g Release 1 (10.1) for Linux x86   
249http://download-west.oracle.com/docs/html/B10813_01/toc.htm</anotherfilesystem></anotherfilesystem></anotherfilesystem></anotherfilesystem></anotherfilesystem></anotherfilesystem>
Published At
Categories with 数据库类
comments powered by Disqus