不管怎么写, 只要能把Oracle 带起来就可以了. 另外我不赞成su - oracle后, 直接运行sqlplu来启动数据库, 如果oracle用户修改了ORACLE_SID环境变量, 脚本就不能正常运行了. 更好的写法是su后, 设置ORACLE_HOME和 ORACLE_SID环境变量, 然后使用绝对路径运行sqlplus, 启动数据库.
在 2010年5月4日 下午12:47,wolfman.wu <r6...@21cn.com>写道: > 谢谢各位的回复! > > 更改 /etc/pam.d/su后, root 下的 su -l oracle 不再报错。oracle也能在开机 > 时启动了 > > 请问你的 /etc/init.d下的 oracle 启动脚本怎样写? > > > 我的 /etc/init.d/oracle 是这样写的: > #!/bin/bash > # Run-level Startup script for the Oracle Instance and Listener > # > # chkconfig: 345 91 19 > # description: Startup/Shutdown Oracle listener and instance > > ORA_HOME="/opt/oracle/product/11.2.0/dbhome_1" > ORA_OWNR="oracle" > > # if the executables do not exist -- display error > > if [ ! -f $ORA_HOME/bin/dbstart -o ! -d $ORA_HOME ] > then > echo "Oracle startup: cannot start" > exit 1 > fi > > # depending on parameter -- startup, shutdown, restart > # of the instance and listener or usage display > > case "$1" in > start) > # Oracle listener and instance startup > echo -n "Starting Oracle:" > su - $ORA_OWNR -c "$ORA_HOME/bin/lsnrctl start LISTENER" > su - $ORA_OWNR -c "$ORA_HOME/bin/dbstart $ORA_HOME" > touch /var/lock/subsys/oracle > # su - $ORA_OWNR -c "$ORA_HOME/bin/emctl start dbconsole" > echo "$0 start was complete! > [OK]" > ;; > stop) > # Oracle listener and instance shutdown > echo -n "Shutdown Oracle:" > su - $ORA_OWNR -c "$ORA_HOME/bin/lsnrctl stop LISTENER" > su - $ORA_OWNR -c "$ORA_HOME/bin/dbshut $ORA_HOME" > rm -f /var/lock/subsys/oracle > # su - $ORA_OWNR -c "$ORA_HOME/bin/emctl stop dbconsole" > echo "$0 stop was complete! > [OK]" > ;; > reload|restart) > $0 stop > $0 start > ;; > *) > echo "Usage: $0 start|stop|restart|reload" > exit 1 > esac > exit 0 > > > > > On Tue, 2010-05-04 at 11:48 +0800, Dongsheng Song wrote: > > 不用那么麻烦,如果你很多服务都需要调用 pam_limits,那么就将它加到 > > /etc/pam.d/common-session 中好了。 > > > > session optional pam_limits.so > > > > 没有 > > 2010/5/4 Liang Guo <bluestonech...@gmail.com> > > /etc/pam.d/su也需要修改包含这行. 因为su的时候, 使用pam模块 > > 在/etc/pam.d/su中指定. > > 如果使用ssh, kdm, gdm等登录到系统中, 也需要修改/etc/pam.d/下对 > > 应的文件. > > > > > > 我装oracle时, 一般会把这一步忽略. > > > > > > -- > > Liang Guo > > http://bluestone.cublog.cn > > > > > -- > To UNSUBSCRIBE, email to debian-chinese-gb-requ...@lists.debian.org > with a subject of "unsubscribe". Trouble? Contact > listmas...@lists.debian.org > Archive: http://lists.debian.org/1272948427.6339.2.ca...@debian3 > > -- Liang Guo http://bluestone.cublog.cn