`
caihorse
  • 浏览: 141101 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

在redhat下安装oracle10g 笔记

阅读更多
首先检查下安装的linux系统中是否有如下包
  make  binutils  openmotif  setarch  compat-db  compat-gcc        compat-gcc-c++  compat-libstdc++  compat-libstdc++-devel

1.用 root 用户身份运行以下命令:
     rpm -q gcc “包名”
   (由于附件超出30M,所以就没上传了,可以到网上下载)
  找到对应的包后 在终端运行
         rpm -Uvh compat-db-4*
        rpm -Uvh libaio-0*
        rpm -Uvh compat-libstdc++-33-3*
        rpm -Uvh glibc-headers-2.5-12.i386.rpm
        rpm -Uvh glibc-devel-2.5-12.i386.rpm
        rpm -Uvh compat-gcc-34-3*
        rpm -Uvh compat-gcc-34-c++-3*
        rpm -Uvh libXp-1*
        rpm -Uvh openmotif-2*
        rpm -Uvh gcc-4*
        rpm -Uvh glibc-2.5-12.i686.rpm
        rpm -Uvh libgomp-4.1.1-52.el5.i386.rpm
        rpm -Uvh gcc-4.1.1-52.el5.i386.rpm
2.要打安装oracle10g 要用到的补丁在附件中有

3.运行 vi /etc/sysctl.conf 在文件中添加如下内容:
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
# semaphores: semmsl, semmns, semopm, semmni
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

4.修改/etc/redhat-release文件 :获得Oracle10g认证的Redhat Linux最高版本为 redhat-4, 所以需要修改redhat-release文件 (跳过)

    # vi /etc/redhat-release
    # Red Hat Enterprise Linux Server release 5.3 (Tikanga)
     将5.3改为 4即可
5.为oracle用户设置Shell限制

# vi /etc/security/limits.conf
    # For Oracle
    oracle soft nproc   2047
    oracle hard nproc  16384
    oracle soft nofile  1024
    oracle hard nofile 65536
6.创建 Oracle 组和用户帐户  (可用)

    # groupadd oinstall
    # groupadd dba
    # mkdir -p /software/oracle/ 
    # useradd -d /u01/oracle -g oinstall -G dba oracle ---> 如失败,手动拷贝配置文件到/software/oracle

   cp /etc/skel/.bash_profile /software/oracle

   cp /etc/skel/.bashrc /software/oracle

   cp /etc/skel/.bash_logout /software/oracle

    # chown -R oracle.oinstall /software/oracle
    # chmod -R 775 /software/oracle
    # passwd oracle



7.转换 oracle用户    su - oracle  执行以下命令:
  vi .bash_profile
  在文件中添加如下内容:
# For Oracle
    TMP=/tmp; export TMP
    TMPDIR=$TMP; export TMPDIR
    ORACLE_BASE=/software/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
#LD_ASSUME_KERNEL=2.4.1; export LD_ASSUME_KERNEL

8.将 oracle安装文件拷贝到 software/oracle 目录下
9.做好上面的准备工作后就可以开始安装了。
  运行 /software/oracle/database/runInstaller
10.安装 过程中 碰到提示 安装
    # /home/oracle/oralnventory/orainstRoot.sh
    # /oracle/product/10.2.0/db_1/root.sh
这时切换到root用户下安装即可
$ su root
    # /home/oracle/oralnventory/orainstRoot.sh
    # /oracle/product/10.2.0/db_1/root.sh
11.安装完成后 运行dbca
   创建数据
   可能会碰到 提示command not found ,这个时候要去检查bash_profile
   文件 看环境变量 ORACLE_HOME 是否跟安装的路径不匹配。
  若配到 出现 xlib:connection to“0.0” not protocol specified
时候可以试下 su root  xhost +  然后再切换到 oracle 用户运行

测试Oracle 10g 数据库:
1. 启动Oracle10g 数据库sqlplus
$ sqlplus "scott/tiger as sysdba"
将出现如下连接数据库信息:
SQL*Plus: Release 10.1.0.2.0 - Production on 星期三 3月 24 16:23:27 2004
Copyright (c) 1982, 2004, Oracle. All rights reserved.
连接到:
Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL>
表明登录数据库系统成功,运行startup命令启动数据库。
SQL> startup
ORACLE instance started.
Total System Global Area 336356520 bytes
Fixed Size 279720 bytes
Variable Size 268435456 bytes
Database Buffers 67108864 bytes
Redo Buffers 532480 bytes
Database mounted.
Database opened.
SQL>
表示数据库正常启动。
2. 关闭Oracle10g 数据库
$ sqlplus "scott/tiger as sysdba" //以sysdba用户登录数据库
成功登录数据库系统后,运行shudown命令关闭数据库。
SQL> shutdown
3. 启动Oracle10g监听程序
Oracle的监听程序主要是为客户端的连接提供接口,在控制台窗口键入如下命令:
$ lsnrctl
将出现如下监听程序信息:
LSNRCTL for 32-bit Windows: Version 10.1.0.2.0 - Production on 24-3月 -2004 16
:59:51
Copyright (c) 1991, 2004, Oracle. All rights reserved.
欢迎来到LSNRCTL, 请键入"help"以获得信息。
LSNRCTL>
表明登录监听程序控制台成功,运行start命令启动监听程序。
LSNRCTL> start
将出现监听程序的一系列启动和配置情况信息列表。
信息行的最后一行是“The command completed successfully”字样时,监听程序启动成功。
4. 关闭Oracle10g监听程序
运行stop命令关闭监听程序。
LSNRCTL> stop

设置oracle自动启动与关闭
1、编辑 /etc/oratab,把所有的 instance 的重启动标志设置成 'Y',如:
fstest:/oracle/product/ 10.2.0:Y
2、做一个启动脚本 /etc/init.d/dbora ,如下所示:
#!/bin/sh
# description: Oracle auto start-stop script.


# chkconfig: - 20 80
#
# Set ORA_HOME to be equivalent to the $ORACLE_HOME
# from which you wish to execute dbstart and dbshut;
#
# Set ORA_OWNER to the user id of the owner of the
# Oracle database in ORA_HOME.
ORA_HOME=/oracle/product/10.2.0/
ORA_OWNER=oracle
if [ ! -f $ORA_HOME/bin/dbstart ]
then
echo "Oracle startup: cannot start"
exit
fi
case "$1" in
'start')
# Start the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
su - $ORA_OWNER -c $ORA_HOME/bin/dbstart
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"
;;
'stop')
# Stop the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"
su - $ORA_OWNER -c $ORA_HOME/bin/dbshut
;;
'restart')
$0 stop
$0 start
;;
esac
3、赋予执行权限
chmod 750 /etc/init.d/dbora
作成以下链接:
ln -s /etc/init.d/dbora /etc/rc0.d/K10dbora
ln -s /etc/init.d/dbora /etc/rc3.d/S99dbora
执行以下命令:
chkconfig --level 345 dbora on
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics