您的位置:首页 > 数据库 > Oracle

在RHEL6.1上安装Oracle 数据库10g

2012-04-24 19:26 696 查看
安装环境:VMware.Workstation.v8.0.2.591240

安装文件:10201_database_linux32

参考资料:

找rpm的网站:
http://rpmfind.net/linux/RPM/index.html
参考的文章:

/article/11256042.html

http://blog.sina.com.cn/s/blog_3f2ef1180100bsrq.html

http://blog.sina.com.cn/s/blog_3f2ef1180100bsuv.html
http://blog.sina.com.cn/s/blog_3f2ef1180100bsw2.html
安装时还参考了其他几位的博客,由于此文是事后写的所以没能记住。在此表示歉意。

一、安装Linux

这部分没有特殊需要介绍的,基本上Step by Step即可,并且之后如果有需要也可以在后面进行配置或者安装其他包。

二、针对 Oracle 配置 RHEL6.1

(1)

[root@LING Desktop]$uname -r

2.6.18-92.el5xen

2.2 Oracle 10g 所需程序包(root)

检查Oracle 10g安装所需要的内核版本:

[root@LING Desktop]$rpm -q gcc make binutils openmotif

gcc-4.1.2-42.el5

make-3.81-3.el5

binutils-2.17.50.0.6-6.el5

openmotif is not installed

查询其他包安装情况:

[root@LING Desktop]$rpm -q gcc make binutils openmotif setarch compat-db compat-gcc \

> compat-gcc-c++ compat-libstdc++ compat-libstdc++-devel

gcc-4.1.2-42.el5

make-3.81-3.el5

binutils-2.17.50.0.6-6.el5

openmotif-2.3.0-0.5.el5

setarch-2.0-1.1

compat-db-4.2.52-5.1

package compat-gcc is not installed

package compat-gcc-c++ is not installed

package compat-libstdc++ is not installed

package compat-libstdc++-devel is not installed

那么安装之。这些包在RHEL的DVD安装盘上的Package目录下都有,只要找到安装即可。

注意:[root@LING ~]# cd "cd /media/RHEL_6.1\ i386\ Disc\ 1/Packages/"

[root@LING Desktop]# rpm -Uvh setarch-2*

[root@LING Desktop]# rpm -Uvh setarch-2*

[root@LING Desktop]# rpm -Uvh make-3*

[root@LING Desktop]# rpm -Uvh glibc-2*

[root@LING Desktop]# rpm -Uvh libaio-0*

[root@LING Desktop]# rpm -Uvh compat-libstdc++-33-3*

[root@LING Desktop]# rpm -Uvh compat-gcc-34-3*

[root@LING Desktop]# rpm -Uvh compat-gcc-34-c++-3*

[root@LING Desktop]# rpm -Uvh gcc-4*

[root@LING Desktop]# rpm -Uvh libXp-1*

[root@LING Desktop]# rpm -Uvh openmotif-2*

[root@LING Desktop]# rpm -Uvh compat-db-4*

安装完成后,再次查询,可能发现如下包依然没有安装:

package compat-gcc is not installed

package compat-gcc-c++ is not installed

package compat-libstdc++ is not installed

package compat-libstdc++-devel is not installed

但是,如果再次安装的,又会提示already installed。后来也没管了,安装Oracle 10g会正常通过。

(2)创建 Oracle组和用户帐户(root)

[root@RHEL~]#/usr/sbin/groupadd oinstall

[root@RHEL~]#/usr/sbin/groupadd dba

[root@RHEL~]#/usr/sbin/useradd -m -g
oinstall -G dba oracle

[root@RHEL~]#/usr/sbin/useradd -m -g
oinstall -G dba oracle

[root@RHEL~]#id oracle

uid=500(oracle) gid=500(oinstall) groups=500(oinstall),501(dba)

[root@RHEL~]#passwd oracle

Changing password for user oracle.

New password:

Retype new password:

passwd:all authentication tokens updated successfully.

——实际上这一步我是通过图形界面完成的。

(3) 创建目录

# mkdir -p /u01/app/oracle

# chown -R oracle:oinstall /u01/app/oracle

# chmod -R 775 /u01/app/oracle

/u01/app/oracle为Oracle根目录,可以根据需要改成别的名字,如果不是很熟练,按照步骤照做就不会出错。

(4) 用oracle用户登录终端

#su - oracle

#vi .bash_profile

在现有文件的下面增加

umask 022

ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE

ORACLE_HOME=$ORACLE_BASE/product/10.2.0/client_1; export ORACLE_HOME

PATH=$ORACLE_HOME/bin:$PATH; export PATH

也可以写作

umask 022

export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/client_1

export PATH=$ORACLE_HOME/bin:$PATH

保存退出

注意,等号左右不能有空格

(5) 执行刚刚编辑的文件

$ . ./.bash_profile

或者source .bash_profile

(6)配置 oracle用户的环境变量(root)

有的提到需要修改/etc/hosts文件,将127.0.0.1修改成为你的实际IP地址,否则有可能导致安装Oracle的时候,检查网络配置异常。我也按照这个做了,但之后可能有麻烦,稍后再说。我是将其注释掉,具体修改如下:

# Do not remove the following line, or various programs

# that require network functionality will fail.

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4

::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.1.30 LING

(7)Oracle支持的RHEL版本(root)

Oracle安装自检时,列出了Oracle10g支持的版本是:must
be redhat-3, SuSE-9, redhat-4, UnitedLinux-1.0, asianux-1 or asianux-2。而我的系统是6.1。这里需要欺骗一下,具体的是修改文件/etc/redhat-release。

[root@LING Desktop]$ more /etc/redhat-release

Red Hat Enterprise Linux Server release4
(Tikanga)

将6.1修改成4即可。网上也有说$
./runInstaller -ignoreSysPrereqs方式来避免自检,但我实验过,安装界面出来了(而且和后面安装的界面不一样),但是自检那一步无论如何都无法通过。

也有的通过如下方式(没有试验):

[root@LING Desktop]$
gedit /usr/app/oracle/install/install/oraparam.ini

三、安装Oracle 10g

通过VMware.Workstation的工具Shared Folders共享Windows下面的文件:

VM——Virtual Machine Setting——Options——Shared Folders

[root@LING Desktop]$xhost +

[root@LING Desktop]$su - oralce

[oracle@LING Desktop]$ cd /mnt/hgfs/Sharefiles/10201_database_linux32/database/

[oracle@LING Desktop]$ ./runInstaller









到下图这里需要注意了,需要到用root身份运行下图中提示需要执行的两个脚本:

千万不要直接点OK,否则就前功尽弃,只能卸掉重装了。



(配置完成,需要执行上面两个脚本)

[oracle@LING Desktop]$su - root

Password:

[root@LING Desktop]$/usr/app/oracle/oraInventory/orainstRoot.sh

Changing permissions of /usr/app/oracle/oraInventory to 770.

Changing groupname of /usr/app/oracle/oraInventory to oinstall.

The execution of the script is complete

[root@LING Desktop]$/usr/app/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= /usr/app/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.



(至此,安装完毕...)

四、验证一下
#切换用户

[root@LING ~]# su – oracle

#启动监听

[oracle@LING ~]$ lsnrctl start

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 24-APR-2012 03:59:35

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

Starting /u01/app/oracle/product/10.2.0/client_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 10.2.0.1.0 - Production

System parameter file is /u01/app/oracle/product/10.2.0/client_1/network/admin/listener.ora

Log messages written to /u01/app/oracle/product/10.2.0/client_1/network/log/listener.log

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=LING)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))

STATUS of the LISTENER

------------------------

Alias LISTENER

Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production

Start Date 24-APR-2012 03:59:37

Uptime 0 days 0 hr. 0 min. 0 sec

Trace Level off

Security ON: Local OS Authentication

SNMP OFF

Listener Parameter File /u01/app/oracle/product/10.2.0/client_1/network/admin/listener.ora

Listener Log File /u01/app/oracle/product/10.2.0/client_1/network/log/listener.log

Listening Endpoints Summary...

(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=LING)(PORT=1521)))

Services Summary...

Service "PLSExtProc" has 1 instance(s).

Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...

The command completed successfully

#设置Oracle的SID

[oracle@LING ~]$ export ORACLE_SID=orcl

#检查是否设置正确

[oracle@LING ~]$ echo $ORACLE_SID

orcl

#进入sqlplus

[oracle@LING ~]$ sqlplus /nolog

SQL*Plus: Release 10.2.0.1.0 - Production on Tue Apr 24 04:03:14 2012

Copyright (c) 1982, 2005, Oracle. All rights reserved.

#连到数据库

SQL> conn / as sysdba

Connected to an idle instance.

#启动数据库

SQL> startup

ORACLE instance started.

Total System Global Area 603979776 bytes

Fixed Size 1220796 bytes

Variable Size 167776068 bytes

Database Buffers 427819008 bytes

Redo Buffers 7163904 bytes

Database mounted.

Database opened.

#退出sqlplus

SQL> exit

Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

#启动Oracle企业管理器

[oracle@LING ~]$ emctl start dbconsole

TZ set to US/Pacific

Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0

Copyright (c) 1996, 2005 Oracle Corporation. All rights reserved.
http://LING:1158/em/console/aboutApplication
Starting Oracle Enterprise Manager 10g Database Control ............................. started.

------------------------------------------------------------------

Logs are generated in directory /u01/app/oracle/product/10.2.0/client_1/LING_orcl/sysman/log







(第一次登录,有个协议)



(成功)

在RHEL6.1上安装Oracle 数据库10g至此结束。

附:

Oracle 10gR2 OEM按钮乱码的解决(OEM的中英文显示快速切换):

打开IE浏览器, 选择'工具"-->"Internet选项"-->"常规", 选择 "语言", 默认只有 "中文", 选择 " 添加 ", 加入 "英语(美国)" , 调整顺序, 把“英语(美国)”移动到最上面。

——当然还有其他方法,但是上面的方法是最快和最方便的。

——另外,RHE6.1默认安装是自动开启防火墙的,测试时可以关闭防火墙,也可以在防火墙里面开放需要的端口,如1158和1521。

安装前参阅了大量的资料,没有网上那么多高手的细致讲解我是无法完成这一测试。在此向各位前辈致敬。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: