在Oracle Linux 6.5上安装Oracle 10gR2 的最佳实践【Maclean版】

 

本安装文档的脚本下载: 在Oracle Linux 6.5上安装Oracle 10gR2 的最佳实践【Maclean版】脚本

安装成功的OS的RPM列表下载

有很多同学来咨询如何顺利在ORACLE/REDHAT linux 6上安装ORACLE 10gR2,由于10gR2的初始版本10.2.0.1是在2005年发布的,而最早的Linux 6也是在2010年发布的(Red Hat Enterprise Linux 6 (Santiago), 10 November 2010 Uses Linux kernel 2.6.32-71[17]) ,所以 10.2.0.1 对redhat/oracle linux 6都是不支持的;  即便是2010年发布的10.2.0.5对linux 6的兼容性也不佳。

这里最主要需要解决的几个问题:

1、 对于ORACLE 10gR2而言编译LINK需要用到GCC 3.4,但是Linux 6默认用的是GCC 4.4,所以需要安装必要的gcc兼容包

2、需要安装必要的libX 32bit的包 libXp.i686 libXt.i686 libXtst.i686等,保证java图形化界面启动

3、Linux 6的Network eth0等网络接口默认不启动

4、Linux 6的Firewall和SELINUX 现在不会在FirstBoot时可以禁用,需要安装后手动禁用

 

下面是安装步骤:

 

首先下载和在Vbox上安装Linux 6,我们选择ORACLE Linux 6.5,介质下载地址:http://pan.baidu.com/s/1jG1DfM2 即V41362-01.iso

安装过程与之前的 【视频教学】Maclean教你用Vbox在Linux 6.3上安装Oracle 11gR2 RAC http://t.askmac.cn/thread-2007-1-1.html 是一样的,可以直接参考该视频

安装时指定Software包时选择Desktop即可

software

installing

 

 

Linux 6不能用root登录图形化界面,需要在Firstboot时创建一个用户并登录图形化界面,登录后点击右上角的网络图标,并启用默认的连接 connect automatically  并设置静态IP

 

 

 

 

 

network

 

 

edit connection eth0 connect automatically

 

enable networking

edit connection eth0 b

 

设置完IP 后注意/etc/hosts中的设置要正确:

 

[root@mac02 ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.1.109  mac02 mac02.oracle.com

[root@mac02 ~]# ping mac02
PING mac02 (192.168.1.109) 56(84) bytes of data.
64 bytes from mac02 (192.168.1.109): icmp_seq=1 ttl=64 time=0.026 ms
64 bytes from mac02 (192.168.1.109): icmp_seq=2 ttl=64 time=0.039 ms
^C
--- mac02 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1053ms
rtt min/avg/max/mdev = 0.026/0.032/0.039/0.008 ms
[root@mac02 ~]# ping mac02.oracle.com
PING mac02 (192.168.1.109) 56(84) bytes of data.
64 bytes from mac02 (192.168.1.109): icmp_seq=1 ttl=64 time=0.020 ms
64 bytes from mac02 (192.168.1.109): icmp_seq=2 ttl=64 time=0.041 ms
^C
www.askmac.cn
--- mac02 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1326ms
rtt min/avg/max/mdev = 0.020/0.030/0.041/0.011 ms

 

注意这里禁用FireWALL

firewall

 

firewall1

禁用FIREWALL ,后 还需要禁用SELINUX,修改/etc/selinux/config

将SELINUX=enforced 修改为SELINUX=disabled

之后init 6 重启OS

重启完成后 虚拟机再次加载之前下载的V41362-01.iso镜像,之后我们要安装一系列必要的rpm包

 

mount iso

 

以下配置YUM:

 

[root@mac02 ~]# mkdir  /media/disk

[root@mac02 ~]# mount /dev/cdrom /media/disk
mount: block device /dev/sr0 is write-protected, mounting read-only
[root@mac02 ~]# 
[root@mac02 ~]# cd /media/disk/

touch /etc/yum.repos.d/public-yum-el6.repo

vi /etc/yum.repos.d/public-yum-el6.repo

[oel6]
name = Enterprise Linux 6.5 DVD
baseurl=file:///media/disk/Server/
gpgcheck=0
enabled=1

 

 

并删除 默认的YUM文件:rm /etc/yum.repos.d/public-yum-ol6.repo

下面安装RPM包,必须安装如下的glibc.i686 libXp.i686 libXt.i686 libXtst.i686否则图形化界面起不来, 注意以下少了任意一个都可能导致编译出错:

 

 

 

su - root

 yum install oracle-rdbms-server-11gR2-preinstall
 yum install glibc.i686
 yum install libXp.i686
 yum install libXt.i686
 yum install libXtst.i686
 yum install glibc-devel.i686 
 yum install compat-libstdc++-296.i686
 yum install compat-libstdc++-33.i686 
 yum install libstdc++.i686  
 yum install libstdc++-devel.i686
 yum install compat-gcc-34.x86_64

 

 

上面安装完oracle-rdbms-server-11gR2-preinstall 后,已经拥有oracle用户,配置密码并创建目录:

 

 

[root@mac02 yum.repos.d]# passwd oracle

[root@mac02 yum.repos.d]# mkdir /s01
[root@mac02 yum.repos.d]# chown oracle:oinstall /s01

[root@mac02 yum.repos.d]# su - oracle
[oracle@mac02 ~]$ id
uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba)
[oracle@mac02 ~]$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 31449
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 2047
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

 

 

 

上传 ORACLE 10g介质 10.2.0.1 10201_database_linux_x86_64.cpio 和 10.2.0.5 patchset p8202632_10205_Linux-x86-64.zip 2个介质
(注意 在国内下载到这些介质是很容易的事,如果你找不到,那么只能说你不太适合这个行当。。。)

以Oracle用户登录 虚拟机图形化界面(必须是ORACLE用户登录图形化界面)

 

 

 

解压安装包
[oracle@mac02 ~]$ cpio -idvm < 10201_database_linux_x86_64.cpio 
[oracle@mac02 ~]$ unzip p8202632_10205_Linux-x86-64.zip 

[oracle@mac02 ~]$ cd database/
[oracle@mac02 database]$ ./runInstaller  -ignoreSysPrereqs

runInstaller  启动安装10.2.0.1 的安装界面

install 10.2.0.1 10gR2 1

 

install 10.2.0.1 10gR2 2

 

install 10.2.0.1 10gR2 3

install 10.2.0.1 10gR2 4
install 10.2.0.1 10gR2 5

install 10.2.0.1 10gR2 6
install 10.2.0.1 10gR2 7

install 10.2.0.1 10gR2 8

注意由于10.2.0.1 并不认证Linux 6 所以编译过程中出错很正常,直接点击continue继续即可,到10.2.0.5升级时我们保证升级的LINK全部顺利通过即可,无需在此处纠结
install 10.2.0.1 10gR2 9
安装最后一步需要 root 用户执行2个脚本,必须要执行:

 

[root@mac02 ~]# /s01/oraInventory/orainstRoot.sh 
Changing permissions of /s01/oraInventory to 770.
Changing groupname of /s01/oraInventory to oinstall.
The execution of the script is complete

[root@mac02 ~]# 
[root@mac02 ~]# /s01/oracle/product/10.2.0/db_1/root.sh
Running Oracle10 root.sh script...

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /s01/oracle/product/10.2.0/db_1

Enter the full pathname of the local bin directory: [/usr/local/bin]: 
   Copying dbhome to /usr/local/bin ...
   Copying oraenv to /usr/local/bin ...
   Copying coraenv to /usr/local/bin ...

Creating /etc/oratab file...
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.

 

 

返回oracle的虚拟机图形界面窗口 , 安装10.2.0.5 补丁:

[oracle@mac02 ~]$ cd Disk1/
[oracle@mac02 Disk1]$ ./runInstaller
install 10.2.0.5 1

install 10.2.0.5 2
install 10.2.0.5 3
install 10.2.0.5 4

install 10.2.0.5 5

install 10.2.0.5 6
最后切换到root 执行root.sh

[root@mac02 logs]# /s01/oracle/product/10.2.0/db_1/root.sh

 

完成上述步骤后 为oracle 用户设置环境变量

 

su - oracle
vi .bash_profile

export ORACLE_HOME=/s01/oracle/product/10.2.0/db_1
export ORACLE_BASE=/s01
export ORACLE_SID=MACLEAN
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export ORA_NLS10=$ORACLE_HOME/nls/data
export NLS_LANG=American_America.AL32UTF8

 

 

Oracle用户在图形化界面上LOGOUT 后再次登录 以便使profile生效
之后就可以用dbca建库了:

oracle用户登录图形化界面(必须!),打开terminal 输入dbca

 

dbca1
dbca2
dbca3

输入你之前指定的ORACLE_SID的信息,如上面的MACLEAN

dbca4
dbca5

dbca6

dbca7

dbca8

dbca9

dbca10

dbca11

dbca12

dbca13

dbca14

dbca15

dbca完成后,可以登录已创建的MACLEAN实例了:

 

SQL> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
PL/SQL Release 10.2.0.5.0 - Production
CORE    10.2.0.5.0      Production
TNS for Linux: Version 10.2.0.5.0 - Production
NLSRTL Version 10.2.0.5.0 - Production

SQL> 
SQL> !uname -a
Linux mac02.oracle.com 3.8.13-16.2.1.el6uek.x86_64 #1 SMP Thu Nov 7 17:01:44 PST 2013 x86_64 x86_64 x86_64 GNU/Linux

SQL> !cat /etc/issue 
Oracle Linux Server release 6.5
Kernel \r on an \m

SQL> !lsnrctl status

LSNRCTL for Linux: Version 10.2.0.5.0 - Production on 27-DEC-2013 01:54:03

Copyright (c) 1991, 2010, Oracle.  All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 10.2.0.5.0 - Production
Start Date                27-DEC-2013 01:52:06
Uptime                    0 days 0 hr. 1 min. 57 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /s01/oracle/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=mac02)(PORT=1521)))
The listener supports no services
The command completed successfully

SQL> alter system set local_listener='(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=mac02)(PORT=1521)))';

System altered.

SQL> alter system register;

System altered.

SQL> !lsnrctl status

LSNRCTL for Linux: Version 10.2.0.5.0 - Production on 27-DEC-2013 01:54:43

Copyright (c) 1991, 2010, Oracle.  All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 10.2.0.5.0 - Production
Start Date                27-DEC-2013 01:52:06
Uptime                    0 days 0 hr. 2 min. 37 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /s01/oracle/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=mac02)(PORT=1521)))
Services Summary...
Service "MACLEAN" has 1 instance(s).
  Instance "MACLEAN", status READY, has 1 handler(s) for this service...
Service "MACLEANXDB" has 1 instance(s).
  Instance "MACLEAN", status READY, has 1 handler(s) for this service...
Service "MACLEAN_XPT" has 1 instance(s).
  Instance "MACLEAN", status READY, has 1 handler(s) for this service...
The command completed successfully

远程登录

[oracle@mac02 ~]$ sqlplus system/oracle@mac02:1521/MACLEAN

SQL*Plus: Release 10.2.0.5.0 - Production on Fri Dec 27 01:55:14 2013

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

 


Posted

in

by

Tags:

Comments

3 responses to “在Oracle Linux 6.5上安装Oracle 10gR2 的最佳实践【Maclean版】”

  1. Cheng Xu Avatar

    非常感谢你的分享。我采用与你相同的环境,能够顺利安装好RDBMS。但是我在装完10.02.5补丁后,无法使用DBCA创建数据库。遇到ORA-01092错误。后来经过查询,发现Oracle bug ticket756617.1与我遇到的问题相似。不知道你否在新建数据库时也遇到了麻烦?

    1. Ask_Maclean_liu_Oracle Avatar

      [oracle@mlab2 ~]$ oerr ora 109201092, 00000, “ORACLE instance terminated. Disconnection forced”// *Cause: The instance this process was connected to was terminated// abnormally, probably via a shutdown abort. This process// was forced to disconnect from the instance.// *Action: Examine the alert log for more details. When the instance has been // restarted, retry action.这个报错需要具体分析alert.log

Leave a Reply

Your email address will not be published. Required fields are marked *