在Solaris下自动启动oracle|Sybase

 Oracle

在/etc/init.d下面新建一个文件dbora,内容:
#!/bin/sh
ORA_HOME=/oracle/product/9.2.0
ORA_OWNER=oracle
su - $ORA_OWNER -c "lsnrctl start"
su - $ORA_OWNER -c "sqlplus /nolog @$ORA_HOME/dbstart.sql"

$ORA_HOME/dbstart.sql的内容:
conn / as sysdba
startup
exit

将dbora改成可执行
chmod 744 dbora

将dbstart.sql改成oracle所有
chown oracle /oracle/product/9.2.0/dbstart.sql

然后作一个连接
ln -s /etc/init.d/dbora /etc/rc2.d/S99dbora
ln -s /etc/init.d/dbora /etc/rc0.d/K10dbora

Sybase:

Before you set Adaptive Server or Backup Server to start automatically, make
sure that all network resources are available. Your server will not start if the
network is not up. Be sure that the entry for restarting the server follows any
commands in the rc directory for starting network operations. Slow start-up of
network operations may prevent servers from starting, even if commands are
in the correct order in the rc directory. You may want to designate a period of
time for your server to wait before starting by inserting a sleep command at the
beginning of the linked runserver file you created.
To configure your operating system for automatic restart of Adaptive Server
and Backup Server:
1 Create a start-up script file with contents like the following:
$SYBASE/$SYBASE_ASE/install/startserver
-f
$SYBASE/$SYBASE_ASE/install/RUN_servername
where $SYBASE/$SYBASE_ASE/install/startserver is the full path name
of the startserver utility, and
$SYBASE/$SYBASE_ASE/install/RUN_servername is the full path name
of the runserver file for the server.
2 Copy the script to the /etc/init.d directory, using syntax like the following:
cp script_name /etc/init.d/script_name
3 Review the contents of the /etc/inittab file to determine the default run
level for your operating system. The initdefault entry specifies the default
run level, which is usually 2 or 3.
4 Use the ln command to create a hard link from the runserver file to the
appropriate run control (rc) directory, rc#, where # is the default run level
obtained in step 2.
Use syntax like the following:
ln /etc/init.d/script_name
/etc/rc#.d/S##script_name
When you type the command to create this link, add an uppercase “S” and
a two-digit sequence number preceding the name of the script file. “S”
indicates a start-up file. The sequence number is necessary because files in
the rc directory are executed in order of their numbers. This file should be
executed last, so you should use a sequence number that follows all
existing numbers in ASCII order.
You can perform an ls command on the rc directory to view existing
sequence numbers. For example:
ls /etc/rc3.d/S*
returns:
/etc/rc3.d/S10syslog
/etc/rc3.d/S15nfs.server
/etc/rc3.d/S21rfs
If your script is named sybstart, type the following:
ln /etc/init.d/sybstart /etc/rc3.d/S77sybstart
In this example, you can use any number greater than 21 in place of 77.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值