use*_*409 3 startup scripting centos
我正在运行 CentOS 6,我试图让我的 Oracle 数据库在启动时运行。我一直在执行以下步骤:
http://www.oracle-base.com/articles/linux/automating-database-startup-and-shutdown-on-linux.php(Oracle 11gR2 部分位于底部)
我创建了这个脚本并将其保存为 /etc/init.d/dbora:
#!/bin/bash
# chkconfig: 345 99 10
# description: Oracle auto start-stop script.
#
# Set ORA_OWNER to the user id of the owner of the
# Oracle database software.
ORA_OWNER=oracle
case "$1" in
'start')
# Start the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
# Remove "&" if you don't want startup as a background process.
su $ORA_OWNER -c "/home/oracle/scripts/startup.sh >> /home/oracle/scripts/startup_shutdown.log 2>&1" &
touch /var/lock/subsys/dbora
;;
'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 "/home/oracle/scripts/shutdown.sh >> /home/oracle/scripts/startup_shutdown.log 2>&1"
rm -f /var/lock/subsys/dbora
;;
esac
Run Code Online (Sandbox Code Playgroud)
接下来,我跑了:
chmod 750 /etc/init.d/dbora
Run Code Online (Sandbox Code Playgroud)
按照说明。
最后,我使用 chkconfig 添加了脚本。
chkconfig --add dbora
Run Code Online (Sandbox Code Playgroud)
我还添加了 dbora 文件调用的脚本。
我可以使用以下命令启动数据库:
/etc/init.d/dbora start
Run Code Online (Sandbox Code Playgroud)
然而,
service dbora start
Run Code Online (Sandbox Code Playgroud)
不起作用。
有任何想法吗?
/etc/init.d/foo start
runnning和,之间的主要区别service foo start
是service
在干净的环境中运行 init 脚本。如果您遇到直接运行 init 脚本有效但不能使用 的情况service
,则说明在启动时使用了环境变量,而您尚未在脚本内部手动初始化该环境变量。由于您的初始化脚本非常简单,因此环境变量的使用可能在/home/oracle/scripts/startup.sh
脚本中。
另请注意,如果它不以 运行service
,则它将无法在启动时正确启动。
归档时间: |
|
查看次数: |
8068 次 |
最近记录: |