从上面可以看出,oracle是通过rc.local来自启动的,启动的过程中会检测/etc/oratab来决定启动哪个实例。废话少说,动起来先,配置 rc.local文件如下
[root@yue rc.d]# cat rc.local #!/bin/bash su - oraele -c "/home/app/oraele/product/11.2.0/db_1/bin/dbstart $ORACLE_HOME"配置/etc/oratab文件如下
[root@yue rc.d]# cat /etc/oratab
#
# This file is used by ORACLE utilities. It is created by root.sh
# and updated by the Database Configuration Assistant when creating
# a database.
# A colon, ':', is used as the field terminator. A new line terminates
# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME::
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third filed indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
oraten:/home/app/oraten/product/10.2.0/db_1:Y
oraele:/home/app/oraele/product/11.2.0/db_1:Y
oraten和oraele分别属于用户oraten 和oraele,用户属性如下:
[root@yue rc.d]# id oraten uid=1001(oraten) gid=1002(oinstall) 组=1002(oinstall),1001(dba) [root@yue rc.d]# id oraele uid=1522(oraele) gid=1002(oinstall) 组=1002(oinstall),1001(dba)
手工测试dbstart脚本能否正常执行,
[oraele@yue ~]$ dbstart $ORACLE_HOME问题出现了,只有oraele实例启动,初步估计是用户权限的问题,在oraele用户下,设置oraten用户的环境变量,然后启动sqlplus,报如下错误:
oraele@yue db_1]$ ./bin/sqlplus /nolog SQL*Plus: Release 10.2.0.5.0 - Production on 星期四 12月 4 14:13:30 2014 Copyright (c) 1982, 2010, Oracle. All Rights Reserved. SQL> conn / as sysdba ERROR: ORA-12547: TNS:lost contact网络搜集资料如下:
1:缺少必要安装包,glibc glibc-devel libaio libaio-devel
2:$ORACLE_HOME/bin/oracle文件的权限不对
3:系统内核配置不正确,如文件数量限制等
4:环境变量设置不正确
5:检查$ORACLE_HOME/bin/oracle 和 $ORACLE_HOME/rdbms/lib/config.o 的文件大小是否为0,若为0需要重新编译
经查看oacle文件的权限不对,当前设置为:
[oraele@yue bin]$ ll oracle -rwxrwxr-x 1 oraten oinstall 125155528 8月 19 21:07 oracle修改如下:
[root@yue bin]# chmod 6751 oracle [root@yue bin]# ll oracle -rwsr-s--x 1 oraten oinstall 125155528 8月 19 21:07 oracle文件权限的详细说明如下:
u:User,即文件或目录的拥有者。 g:Group,即文件或目录的所属群组。 o:Other,除了文件或目录拥有者或所属群组之外,其他用户皆属于这个范围。 a:All,即全部的用户,包含拥有者,所属群组以及其他用户。 有关权限代号的部分,列表于下: r:读取权限,数字代号为"4"。 w:写入权限,数字代号为"2"。 x:执行或切换权限,数字代号为"1"。 -:不具任何权限,数字代号为"0"。 s:当文件被执行时,根据who参数指定的用户类型设置文件的setuid或者setgid权限。看来oracle文件的默认权限是具有s的,而我们手工对其进行了修改,看来在安装完数据库后,即使我们执行chmod -R 777 $ORACLE_HOME的操作也可能是有问题的,
修改权限后,重启系统,一切正常