首页 > 数据库 > Oracle > 正文

Install Oracle10g On RedhatEL AS3 update2 Step-by-

2020-03-09 22:52:41
字体:
来源:转载
供稿:网友
  • 本文来源于网页设计爱好者web开发社区http://www.html.org.cn收集整理,欢迎访问。

  • 虽然 windows 平台下的 oracle 已经装过几回了,但是 linux 下没有试过。看网上的文档 , 好像比 windows 下装要复杂不少,更改系统参数,创建 user&group, 检查必要的软件包,设置环境变量等一大堆工作要做。于是趁周末在vmware中装了一回,记下具体步骤以供以后参考。

    os 版本 : red hat enterprise linux as release3 update2 kernel 2.4.21-15.el (安装好内核开发工具)
    oracle 版本 : oracle 10.1.0.2 for linux x86

    oracle10g 的的下载地址 : http://otn.oracle.com/software/products/database/oracle10g/htdocs/linuxsoft.html

    准备安装

    检查磁盘空间

    oracle universal installer 约需要 400m 左右的 /tmp 空间
    # df -k /tmp

    如果当前 /tmp 空间不够 , 你可以在其他空间足够的 filesystem 上创建新的临时目录
    # mkdir /<anotherfilesystem>/tmp
    # chown root.root /<anotherfilesystem>/tmp
    # chmod 1777 /<anotherfilesystem>/tmp
    # export temp=/<anotherfilesystem>
    # export tmpdir=/<anotherfilesystem>

    装好 oracle 后再恢复到原来的状态
    # rmdir /<anotherfilesystem>/tmp
    # unset temp
    # unset tmpdir

    oracle 大约需要 3g 左右的空间(默认安装且包括初始库),事先请规划好

    检查内存和交换区

     查看物理内存大小
    # grep memtotal /proc/meminfo

    查看交换区大小
    # grep swaptotal /proc/meminfo

     安装 oracle 需要足够大的内存和交换区 , 所以最好还是找台好点的机器。 oracle 推荐最好内存 512m 以上, swap 1g 以上。如果只是安装一个玩玩,实际上没那么多也没关系啦,我的虚拟机就只分了 384m 的内存和 768m 的 swap 。

    检查软件包

     使用指令
    # rpm –qa | grep packname // 其中 packname 是需要检查的软件包的名字

    保证以下的包(或者更高版本)已经安装好。没装的话到 redhat 的安装盘里都可以找到

    gcc-3.2.3-34
    make-3.79.1-17
    binutils-2.14.90.0.4-35
    openmotif-2.2.2-16
    setarch-1.3-1
    compat-db-4.0.14.5
    compat-gcc-7.3-2.96.128
    compat-gcc-c++-7.3-2.96.128
    compat-libstdc++-7.3-2.96.128
    compat-libstdc++-devel-7.3-2.96.128

    安装rpm包
    # rpm -uvh packname

    添加 group 和 user

    # /usr/sbin/groupadd oinstall
    # /usr/sbin/groupadd dba

    建立 oracle 用户,其默认组为 oinstall ,同时也是 dba 组的成员
    # /usr/sbin/useradd -g oinstall -g dba oracle

    修改 oracle 用户的 password
    # passwd oracle

    建好后可以检查一下
    # id oracle
    uid=500(oracle) gid=500(oinstall) groups=500(oinstall),501(dba)

     修改系统核心参数

    编辑 sysctl.conf
    # vi /etc/sysctl.conf

    添加以下内容
    kernel.shmall = 2097152
    kernel.shmmax = 2147483648
    kernel.shmmni = 4096
    kernel.sem = 250 32000 100 128
    fs.file-max = 65536
    net.ipv4.ip_local_port_range = 1024 65000

    保存退出后,执行以下命令使其生效 ( 当然重启也是可以的 ^-^)
    # sysctl –p

    检查一下上面的操作是否正确 :
    # /sbin/sysctl -a | grep sem
    # /sbin/sysctl -a | grep shm
    # /sbin/sysctl -a | grep file-max
    # /sbin/sysctl -a | grep ip_local_port_range

    这些参数也可以直接更改 /proc/sys/kernel 下相应文件来实现,详细请参考
    http://download-west.oracle.com/docs/html/a96167_01/pre.htm#chdhdabj

    如果是生产库,出于性能上的考虑 , 还需要进行如下的设定,以便改进 oracle 用户的有关 nofile( 可打开的文件描述符的最大数 ) 和 nproc( 单个用户可用的最大进程数量 ) 。如果仅仅是测试安装的话,也可以不用修改。

    # vi /etc/security/limits.conf

    添加如下的行
    *         soft nproc 2047
    *         hard nproc 16384
    *         soft nofile 1024
    *         hard nofile 65536

    # vi /etc/pam.d/login

    添加如下的行
    session required /lib/security/pam_limits.so

    # vi /etc/profile

    添加如下部分:
    if [ $user = "oracle" ]; then
    if [ $shell = "/bin/ksh" ]; then
    ulimit -p 16384
    ulimit -n 65536
    else
    ulimit -u 16384 -n 65536
    fi
    fi

    之后,验证一下
    # su oracle
    $ ulimit -a

    设置环境变量

    # su oracle
    $ cd ~
    $ vi .bach_profile

    添加以下内容
    export oracle_base=/opt/oracle
    export oracle_home=$oracle_base/product/10.1.0/
    export oracle_sid=db01
    export path=$path:$home/bin:$oracle_home/bin
    export ld_library_path=$oracle_home/lib:/usr/lib
    export lc_ctype=en_us.utf-8

    其中 /opt/oracle 请事先建好并给予相应的权限,简单一点可以将其 owner 设为 oracle ( chown –r oracle.oinstall /opt/oracle ),作为 oracle 的安装目录 ( 可以自己另外规划 )

    确认并是修改生效
    $ source .bash_profile

    开始安装

    由于我是用虚拟机装的 , 我把从网上下的 oracle10g(ship.db.cpio.gz)copy 到了硬盘上,目录为 /tmp, 先作一下 crc 验证,以免下载的 oracle 有问题。
    # cksum ship.db.cpio.gz

    解压缩
    # gzip –d ship.db.cpio.gz

    解包 ship.db.cpio
    # cpio -idmv < ship.db.cpio

    得到安装目录 /tmp/disk1 ,如果你有刻录机的话就可以把该目录刻到光盘上了。这里我从硬盘安装。

    # su oracle
    $ cd /tmp/disk1
    $ ./runinstaller

    如果出现如下错误
    xlib:connection to "localhost:0.0" refused by server
    xlib:client is not authorized to connect to server

    exception in thread "main" java.lang.internalerror:can't connect to x11 window server using "localhost:0.0"

    at .......

    解决方法:
    •  # xhost +
    access control disabled,clients can connect from any host.
    //xhost + 是使所有用户从任何一个终端都能访问 xserver(设置后可能有安全隐患);
    •  # xhost + yourip
    yourip being added to acces control list
    //xhost + yourip 使 ip 上的用户能够访问 xserver


    顺利的话,应该会出现 welcome 画面,点“ next ”继续。

    指定 inventory 目录和安装时使用的 group ,使用默认值即可,点“ next ”

    这时会弹出一个窗口,让你开启另外一个 terminal ,以 root 身份执行以下命令:
    # /home/oracle/orainventory/orainstroot.sh

    执行完后点“ continue ”继续

    接下来修改安装文件路径 , 按你的实际需要修改好后“ next ”

    选择安装内型,这里我选“ enterprise edition ”安装企业版,“ next ”继续下一步。

    这时会自动检查你的系统是否满足安装的需求(可以按“stop”跳过),结果如下:

    hecking operating system certification
    expected result: one of redhat-2.1,redhat-3,unitedlinux-1.0
    actual result: redhat-3
    check complete. the overall result of this check is: passed
    =======================================================================

    checking kernel parameters
    checking for version=2.4.9.25; found version=2.4.21. passed
    checking for shmall=2097152; found shmall=2097152. passed
    checking for shmseg=10; found shmseg=4096. passed
    checking for semmsl=250; found semmsl=250. passed
    checking for semmni=128; found semmni=128. passed
    checking for filemax=65536; found filemax=39321. passed
    checking for shmmni=4096; found shmmni=4096. passed
    checking for semmns=32000; found semmns=32000. passed
    checking for semopm=100; found semopm=32. passed
    checking for shmmin=1; found shmmin=1. passed
    checking for shmmax=2147483648; found shmmax=33554432. passed
    check complete. the overall result of this check is: passed

    =======================================================================

    checking recommended operating system packages
    checking for make-3.79; found make-3.79.1-17. passed
    checking for binutils-2.11.90.0.8-12; found binutils-2.14.90.0.4-35. passed
    checking for gcc-2.96; found gcc-3.2.3-34. passed
    checking for openmotif-2.1.30-11; found openmotif-2.2.2-16. passed
    check complete. the overall result of this check is: passed

    =======================================================================

    checking recommended glibc version
    expected result: 2.2.4.31.7
    actual result: 2.3.2.95.20
    check complete. the overall result of this check is: passed

    =======================================================================

    validating oracle_base location (if set)
    check complete. the overall result of this check is: passed

    =======================================================================

    如果全部 passed ,继续下一步。否则,请参照 准备安装 部分重新作相应修改,然后“ retry ”重新检测,直到 passed 到下一步。

    接下来选择建库的类型,这里我先不建库,待安装好后在利用 dbca 来建库或者手工建库(如何用 dbca 建库请到 http://www.google.com 搜索相应文章)。所以选择“ do not create a starter database ”后“ next ”。

    出现“ summary ”画面,确认后按“ install ”。

    最后还会弹出一个对话框,要求以root身份执行$oracle_home/root.sh
    # $oracle_home/root.sh

    友情提示

    安装过程中如果出现错误,请利用 google 搜索相应的解决方法。

    参考文章

    fenng 的 installing oracle 10g on rhel as 3 step-by-step
    http://www.dbanotes.net/oracle/install-oracle10g-rhel3.htm

    werner puschitz 的 10g 安装指南
    http://www.puschitz.com/installingoracle10g.shtml

    oracle database quick installation guide 10 g release 1 (10.1) for linux x86
    http://download-west.oracle.com/docs/html/b10813_01/toc.htm
    发表评论 共有条评论
    用户名: 密码:
    验证码: 匿名发表