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

Centos5.3+oracle10g 安装

2010-04-21 12:19 260 查看
本人因为工作需要所以又开始接触oracle10g,虽然以前了解也简单的玩过oracle11g,但是对它并不熟悉,现在开始认真的接触它。一开始接触肯定是了解oracle10g的概念,然后就是安装。这里我简单的介绍一下它在centos5.3 32位上的安装。

一、安装软硬件环境介绍

1、用虚拟机软件vware
2、内存:512M
3、硬盘:80G
4、系统:centos 5.3 32位
5、oracle10g的安装文件10201_database_linux32.zip放在/home/tmp目录下
oracle10g的下载地址http://apps.hi.baidu.com/share/detail/1605442

二、安装系统是最后需要选定制安装包,需要安装的包有(这是我装的时候选择的包,如果你有别的需求可以选别的包):

GNOME Desktop Environment
Editors
Graphical Internet
Text-based Internet
Development Libraries
Development Tools
Server Configuration Tools
Administration Tools
Base
System Tools
X Window System
注意:在选包的时候,勾选了后下面有个包详细选项,需要点击这里继续添加包。

三、检查操作系统的rpm包是否完整
进入系统,用root用户登陆
#rpm -q gcc make binutils openmotif setarch compat-db compat-gcc compat-gcc-c++ compat-libstdc++
如果缺少以上的包,在安装光盘里就可以找到,然后在用rpm -Uvh 包装上就行了。
有一些包可能在你装系统的时候没有装上,你在安装光盘里找到,包有
compat-db*,libaio*,compat-libstdc++-*,compat-gcc*,openmotif*,gcc*,
glibc*
我装这些包用yum装的,yum工具方便,笔者建议用yum,可以解决包的依赖性

vi /etc/hosts,在文件里添加以下文件内容:
127.0.0.1 hxqm
192.168.81.1 hxqm

注意:oracle安装随在的服务器的IP最好是固定IP地址,这样可以避免以后必要的麻烦,还有主机名不要随便更改,因为oracle已经把当前的主机名写入到了自己的配置文件中,切忌!

四、建立用户和组

[root@test-server home]# groupadd oinstall
[root@test-server home]# groupadd dba
[root@test-server home]# useradd -m -g oinstall -G dba oracle
[root@test-server home]# id oracle
uid=500(oracle) gid=500(oinstall) groups=500(oinstall),501(dba)
[root@hxqm tmp]# 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.

五、 创建oracle10g数据存放目录:
mkdir -p /app/oracle/product/10.2.0/db_1
chown -R oracle.oinstall /app

六、配置LINUX内核参数
[root@yjsgl rc2.d]# vi /etc/sysctl.conf
添加以下内容
kernel.shmall = 2097152
kernel.shmmax = 6442450944
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或重新启动服务器

七、为ORACLE用户设置SHELL限制(Oracle 建议对每个 Linux 帐户可以使
用的进程数和打开的文件数设置限制)
[root@test-server home]# vi /etc/security/limits.conf
添加以下内容
* oracle soft nproc 2047
* oracle hard nproc 16384
* oracle soft nofile 1024
* oracle hard nofile 65536
解释:这步是为oracle用户设立sheel限制。一般出于性能上的考虑还需要进行以上设置,以便改进oracle有关的onfile(可打开文件描述符的最大数)和nproc(单个用户可用的最大进程数)。

八、修改/etc/pam.d/login文件,并在文件末尾添加以下内容

#user for oracle
seesion required pam_limist.so

查看/etc/selinux/config文件,确保selinux为disabled状态
SELINUX=disabled

至于操作系统的修改就到这里。

九、用oracle用户为安装文件解压缩

#chown -R oracle:oinstall /home/tmp
#su - oracle
#cd tmp
#unzip 10201_database_linux32.zip

十、设置oracle的环境变量,修改文件.bash_profile
用oracle用户登陆,编辑宿主目录下的.bash_profile文件,在尾部添加一下内容:
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_BASE=/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1; export ORACLE_HOME
ORACLE_SID=cadb #cadb是实例名,这个你可以根据自己的需求填写
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
stty erase ^h
DISPLAY=192.168.81.1:0; export DISPLAY

解释:“DISPLAY” 这是是一个监听参数,由于我选用了xmanage工具,需要添加了这个参数,这时就不用在centos的图像界面安装oracle了,这样可以为虚拟机节省资源。可以google一下xmanage下载,查看应用。应用过程先打看你安装好的xmanage passive,再执行图形界面安装的命令,如 ./runInstaller或netca或dbca

编辑完.bash_profile文件后,在当前目录下执行source .bash_profile,使当前配置的环境变量生效,如果不这样也可以重启系统。

十一、图形界面安装oracle10g

#su - oracle
#cd /tmp
#cd databases
#./runInstaller #然后xmanage会出现图形界面安装向导

安装图片我会作为附近给大家上传,请下载看

十二、

oracle解决启动问题
数据库创建完成后,修改/etc/oratab,把最后一行的N改成Y。
注意:如果你想把你装的数据库都启动了,你可以把最后几行的N都改成Y,然后重启系统,这是我系统的方式,呵呵。重启oracle也可以。
root@lc ~]# vi /app/oracle/product/10.2.0/db_1/bin/dbstart
# Set this to bring up Oracle Net Listener
ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle
if [ ! $ORACLE_HOME_LISTNER ] ; then
echo "ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener"
修改 ORACLE_HOME_LISTNER=$ORACLE_HOME
然后执行dbstart启动数据库
自启动:
添加自启动:
vi etc/rc.d/rc.local
添加:
su - oracle -c 'lsnrctl start'
su - oracle -c 'dbstart'
设置数据库自动关闭脚本
#vi /etc/rc.d/init.d/dbshutdown

写入内容:
su - oracle -c 'lsnrctl stop'
su - oracle -c 'dbshut'

保存退出。为文件加上执行权限
chmod +x /etc/rc.d/init.d/dbshutdown

设置数据库自动关闭服务
#ln -s /etc/rc.d/init.d/dbshutdown /etc/rc.d/rc3.d/K04dbshutdown

重新启动EM服务
cd $ORACLE_HOME/bin/
./emctl stop dbconsole
./emctl start dbconsole

[oracle@koalca bin]$ ./emctl start dbconsole
TZ set to PRC
Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0
Copyright (c) 1996, 2005 Oracle Corporation. All rights reserved.
http://192.168.81.1:1158/em/console/aboutApplication
Agent Version : 10.1.0.4.1
OMS Version : Unknown
Protocol Version : 10.1.0.2.0
Agent Home : /app/oracle/product/10.2/db_1/koalca_cadb
Agent binaries : /app/oracle/product/10.2/db_1
Agent Process ID : 3240
Parent Process ID : 1753
Agent URL : http://192.168.81.1:3938/emd/main
Started at : 2009-12-06 00:06:58
Started by user : oracle
Last Reload : 2009-12-06 00:06:58
Last successful upload : (none)
Last attempted upload : (none)
Total Megabytes of XML files uploaded so far : 0.00
Number of XML files pending upload : 10
Size of XML files pending upload(MB) : 0.04
Available disk space on upload filesystem : 23.22%
Agent is already started. Will restart the agent
Stopping agent ... stopped.
Starting Oracle Enterprise Manager 10g Database Control ................... started.
------------------------------------------------------------------
Logs are generated in directory /app/oracle/product/10.2/db_1/koalca_cadb/sysman/log
Oracle10g启用isqlplus
---------------------------------------------------------------
版本:
SQL> select * from v$version;
BANNER----------------------------------------------------------------Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - ProdPL/SQL Release 10.2.0.1.0 - ProductionCORE 10.2.0.1.0 ProductionTNS for 32-bit Windows: Version 10.2.0.1.0 - ProductionNLSRTL Version 10.2.0.1.0 - Production
通过以下命令启动和停止isqlplus服务:
isqlplusctl start
isqlplusctl stop
通过查看$ORACLE_HOME/install/portlist.ini 文件可以找到当前的isqlplus application server的监听端口,默认是5560.
然后打开浏览器,输入地址http://youserverip:5560/isqlplus就可以访问isqlplus了

因为写文档的时候可能有地方没有说明清楚或遗漏了什么,请大家原谅,谢谢
也可以一起谈论技术问题,
我的邮箱是ws_pap@126.com

本文出自 “分享技术快乐自我” 博客,请务必保留此出处http://xiaos0ng.blog.51cto.com/1036375/302014
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: