在 Red Hat 5 下安装 Oracle 10g 实践

昨天是我入职新公司的第三天,领导给我安排了一个实践的小任务——在我一台 Dell 的 PC Server 上安装 Oracle 10g,同事先帮我把64位的 Oracle 安装文件通过 WinSCP 传递到了 Server 上,然后我就开始我的工作了,Google 了一篇网上的技术文档,觉得 Linux 下安装 Oracle 还真繁琐,之前做的工作比较多,虽然这篇文章是32位 Linux 系统的,而我要安装的 Dell 机器是64位的,但是步骤大同小异,现总结如下:
1.检查内核版本
要在 Linux 上安装 Oracle,所需内核版本:2.4.9-e.25(或更高版本)
通过运行以下命令检查内核版本:
# uname -r
2.6.18-128.e15
2.程序包安装和更新
在安装好 Linux 后,需验证安装是否具备 Oracle 10g 所需要的所有程序包和更新,按以下步骤验证安装,所需程序包的版本(或更高版本):
gcc-3.2.3-2
make-3.79
binutils-2.11
openmotif-2.2.2-16
setarch-1.3-1
compat-gcc-7.3-2.96.122
compat-gcc-c++-7.3-2.96.122
compat-libstdc++-7.3-2.96.122
compat-libstdc++-devel-7.3-2.96.122
compat-db-4.0.14.5
要查看系统上安装了这些程序包的哪些版本,以 root 用户身份运行以下命令:
# rpm -q gcc make binutils openmotif setarch compat-db compat-gcc openmotif compat-gcc-c++ compat-libstdc++ compat-libstdc++-devel compat-glibc
我的实践过程中遇到了好几个程序包都没有安装,所以只能自己配置一下yum源后,进行安装,如果不配置源的话,Linux程序包的依赖性简直是要人命,我配置的是文件系统源,简单说就是把Red Hat的ISO文件挂载到文件系统上,然后添加到yum的repos中去。具体做法如下:
[root@newtest media]# mkdir /redhat
[root@newtest media]# mount -o loop /media/RHEL-5.4_x86_64_DVD.iso /redhat
[root@newtest etc]# cd /etc
[root@newtest etc]# cd yum.repos.d/
[root@newtest yum.repos.d]# vi rhel-debuginfo.repo[Server]
name=Server
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
baseurl=file:///redhat/Server
~
“rhel-debuginfo.repo” 14L, 388C written[root@newtest yum.repos.d]# yum grouplist
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
Setting up Group Process
rhel-debuginfo | 1.3 kB 00:00
rhel-debuginfo/primary | 845 kB 00:00
rhel-debuginfo/group | 1.0 MB 00:00Installed Groups:
… …[root@newtest yum.repos.d]# yum install openmotif
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
rhel-debuginfo 3040/3040
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package openmotif.i386 0:2.3.1-2.el5 set to be updatedrhel-debuginfo/filelists | 2.7 MB 00:00
–> Processing Dependency: libXp.so.6 for package: openmotif
–> Processing Dependency: libXmu.so.6 for package: openmotif
—> Package openmotif.x86_64 0:2.3.1-2.el5 set to be updated
–> Processing Dependency: libXp.so.6()(64bit) for package: openmotif
–> Running transaction check
—> Package libXmu.i386 0:1.0.2-5 set to be updated
—> Package libXp.i386 0:1.0.0-8.1.el5 set to be updated
—> Package libXp.x86_64 0:1.0.0-8.1.el5 set to be updated
–> Finished Dependency ResolutionDependencies Resolved
===========================================
Package Arch Version Repository Size
===========================================
Installing:
openmotif i386 2.3.1-2.el5 rhel-debuginfo 1.5 M
openmotif x86_64 2.3.1-2.el5 rhel-debuginfo 1.5 MInstalling for dependencies:
libXmu i386 1.0.2-5 rhel-debuginfo 63 k
libXp i386 1.0.0-8.1.el5 rhel-debuginfo 22 k
libXp x86_64 1.0.0-8.1.el5 rhel-debuginfo 23 kTransaction Summary
===========================================
Install 5 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 3.2 M
Is this ok [y/N]: y
Downloading Packages:
——————————————————————————
Total 867 MB/s | 3.2 MB 00:00Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running TransactionInstalling : libXp 1/5
Installing : libXp 2/5
Installing : libXmu 3/5
Installing : openmotif 4/5
Installing : openmotif 5/5Installed:
openmotif.i386 0:2.3.1-2.el5 openmotif.x86_64 0:2.3.1-2.el5
Dependency Installed:
libXmu.i386 0:1.0.2-5 libXp.i386 0:1.0.0-8.1.el5 libXp.x86_64 0:1.0.0-8.1.el5Complete!
3.验证系统要求
要验证系统是否满足 Oracle 10g 数据库的最低要求,以 root 用户身份登录并运行一些命令。
要查看可用 RAM 和交换空间大小,运行以下命令:
# grep MemTotal /proc/meminfo
MemTotal:512236 kB# grep SwapTotal /proc/meminfo
SwapTotal:1574360 kB
所需最小 RAM 为 512MB,而所需最小交换空间为 1GB。对于 RAM 小于或等于 2GB 的系统,交换空间应为 RAM 数量的两倍;对于 RAM 大于 2GB 的系统,交换空间应为 RAM 数量的一到两倍。
Oracle 10g 软件还需要 2.5GB 的可用磁盘空间,而数据库则另需 1.2GB 的可用磁盘空间。/tmp 目录至少需要 400MB 的可用空间。要检查系统上的可用磁盘空间,运行以下命令:
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 6.8G 1.3G 5.2G 20% /
/dev/sda1 99M 17M 77M 18% /boot
4.创建 dba 组和 oracle 用户
Oracle数据库必须在Oracle用户下才能安装,所以需要建立相应的用户群组、用户,以及设置相应的目录属主、目录权限
# groupadd dba
# useradd -G dba oracle
# mkdir -p /app/oracle/product/10.2.0/db_1
# chown -R oracle:dba /app/oracle
# chmod -R 775 /app/oracle
# passwd oracle
5.修改 /etc/redhat-release 文件
获得 Oracle 10g 认证的 Redhat Linux 最高版本为redhat-4, 所以需要修改 redhat-release 文件。
# vi /etc/redhat-release
# Red Hat Enterprise Linux Server release 5.3 (Tikanga)
redhat-4
6.配置Linux内核参数
Linux 内核非常出色。与大多数其他 *NIX 系统不同,Linux 允许在系统启动和运行时修改大多数内核参数。完成内核参数更改后不必重新启动系统。Oracle 数据库 10g 需要以下所示的内核参数设置。其中给出的是最小值,因此如果您的系统使用的值较大,则不要更改它。以 root 用户身份登录后执行下命令:
# vi /etc/sysctl.conf
# For Oracle
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 262144
net.core.rmem_max = 262144
net.core.wmem_default = 262144
net.core.wmem_max = 262144
保存文件后执行以下命令激活更改:
# /sbin/sysctl -p
7.为oracle用户设置Shell限制
Oracle 建议对每个 Linux 帐户可以使用的进程数和打开的文件数设置限制。要进行这些更改,以 root 用户的身份执行
下列命令:
# vi /etc/security/limits.conf
# For Oracle
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536# vi /etc/pam.d/login
Session required /lib/security/pam_limits.so
以 oracle 用户身份运行以下命令:
# vi .bash_profile
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
umask 022
fi
以 root 用户身份运行以下命令:
# vi /etc/csh.login
if ( \$USER == “oracle” ) then
limit maxproc 16384
limit descriptors 65536
umask 022
endif
8.临时修改 Oracle 用户语言环境
$ LC_ALL=’us_EN’
9.配置 Oracle 用户环境变量
要使用 Oracle 产品,应该或必须设置几个环境变量。对于数据库服务器,建议设置以下环境变量:
- ORACLE_BASE
- ORACLE_HOME
- ORACLE_SID
- PATH
如果您在同一服务器上安装了多个 Oracle 产品或数据库,则 ORACLE_HOME、ORACLE_SID 和 PATH 变量可能会更改。ORACLE_BASE 变量不应更改,并可以在需要时在您的登录配置文件中设置它。Oracle 提供了一个称作 oraenv 的实用程序来设置其他变量。
以 oracle 身份登录,并通过在 .bash_profile 或 .profile(bash 或 ksh)中添加以下行,将 ORACLE_BASE 添加到登录配置文件:
$ vi .bash_profile
# For Oracle
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_BASE=/home/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1; export ORACLE_HOME
ORACLE_SID=orcl; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
10.安装 Oracle
$ unzip 10201_database_linux32.zip
$ cd database
$ ./runInstaller
进入图形安装界面,根据提示安装即可。
在安装的最后弹出一个“Setup Privileges”窗口,提示需要以 root 用户身份运行配置脚本。以 root 用户身份登录,切换到该窗口中指示的目录,然后执行 root.sh 脚本。该脚本提示输入本地 bin 目录的位置。按 Enter 键接受默认值。当脚本完成时,返回到 Setup Privileges 窗口并单击 OK。
$ su root
# /home/oracle/oralnventory/orainstRoot.sh
# /oracle/product/10.2.0/db_1/root.sh
11.恢复 /etc/redhat-release 文件。
# vi /etc/redhat-release
Red Hat Enterprise Linux Server release 5.3 (Tikanga)
12.启动 Lisencer
$ lsnrctl start
13.启动及关闭数据库
$ sqlplus /nolog
SQL> connect / as sysdba
Connected to an idle instance.
SQL> startup
SQL> shutdown
14.设置自启动
# vi /etc/oratab
TSH1:/oracle/product/10.2.0/db_1:Y
相关日志:
- 2012年05月11日 -- 了解 Oracle Ksplice (0)
- 2011年09月6日 -- 如何在 Linux 下完全卸载 Oracle 10g ? (0)
- 2011年10月25日 -- yum 命令出现“段错误”的解决方案 (0)
- 2011年10月16日 -- 在 RHEL 5.5 下应用 RHCS 实现 Oracle HA (0)
- 2011年10月11日 -- Oracle HA 脚本 (0)
- 2011年10月10日 -- 在 RHEL 5.5 下解决 MSA2312fc 的多路径问题 (0)
Categories
- 信息世界 | IT (95)
- Certification (1)
- Cloud Computing (1)
- Database (16)
- Google (10)
- Hardware (2)
- J2EE (4)
- Network (19)
- OS (18)
- Programming (11)
- Virtualization (1)
- Webmaster (11)
- 数码先锋 | Digital (17)
- 时事评论 | Event (5)
- 时光飞驰 | News (2)
- 杂七杂八 | Mix (2)
- 流金岁月 | Life (8)
- 游戏志 | Game (13)
- 看电影 | Movie (10)
- 红魔拥趸 | ManUtd (5)
- 读书频道 | Reading (1)
- 音乐无限 | Music (4)
- 信息世界 | IT (95)
Twitter
- I'm at 大连国美电器胜利新活馆 (大连市, 辽宁省) http://t.co/f7pxcNfg 17 小时前
- I'm at Xinghai Square | 星海广场 (Dalian, China) http://t.co/gKNqq2qV 23 小时前
- I'm at 壹品星海 (Dalian, China) http://t.co/o7SCCIrG 23 小时前
- 晚上和以前的同事喝了点酒,准备睡觉了,希望明天能把公司的电脑修好,没有电脑办公还真不方便,不知道明天印度那边有没有培训的消息。 2012-05-16
- 非常值得读的一本书! http://t.co/lV8ulDnV 2012-05-16
- I'm at 大连软件园15号楼 (大连市, 辽宁省) http://t.co/03DYYUKY 2012-05-16
- @yamiugly 好奇你做的是什么工作? 2012-05-16
- I'm at 壹品星海 (Dalian, China) http://t.co/frkQvlIn 2012-05-15
- I just ousted @fndhrt as the mayor of 大连软件园15号楼 on @foursquare! http://t.co/yn7fSLY6 2012-05-15
- I'm at 大连软件园15号楼 (大连市, 辽宁省) http://t.co/KH2m2Z4R 2012-05-15
- @terrysosi_chan 小日子过的太充实了! 2012-05-15
- RT @GossipSama: 玩diablo 2的时候我23岁,玩diablo 3的时候我34岁。暴雪是要等我不再2了才出3是么?那是不是要45岁才玩到4? 2012-05-15
- I'm at 中山广场 Zhongshan Circus (大连, 中国) http://t.co/fiD6vqHS 2012-05-14
- 英超还真他妈的好看。昨晚90分钟的比赛,跟坐过山车一样,如果不看直播,是体会不到这种刺激的,呵呵,英超第20年,今年的冠军真的很有戏剧性,恭喜曼城,明年的曼联面对的局势更难,曼城还会加大投入的,看看曼城现在的阵容,明年再买几个强援,大耳朵杯指日可待! 2012-05-14
- @Fatal1tyV 怎么弄? 2012-05-14
Latest Comments
Foursquare Checkins
标签




