在Oracle 1gR2或更高版本下使用RAC或ASM时,Oracle Clusterware会自动启动和停止Oracle数据库实例,因此下面的过程不是必需的,对于其他情况,你就可以使用下面描述的方法了。
◆su命令
下面的描述是Oracle建议采用的自动启动和关闭Oracle 9i实例的方法。
一旦实例创建好后,标记/etc/oratab文件设置每个实例的重启标志为“Y”:
| TSH1:/u01/app/oracle/product/9.2.0:Y |
接下来,作为root用户登陆创建一个叫做/etc/init.d/dbora的文件,包括下面的内容:
#!/bin/sh
# chkconfig: 345 99 10
# description: Oracle auto start-stop script.
#
# Set ORA_HOME to be equivalent to the $ORACLE_HOME
# from which you wish to execute dbstart and dbshut;
#
# Set ORA_OWNER to the user id of the owner of the
# Oracle database in ORA_HOME.
ORA_HOME=/u01/app/oracle/product/9.2.0
ORA_OWNER=oracle
if [ ! -f $ORA_HOME/bin/dbstart ]
then
echo "Oracle startup: cannot start"
exit
fi
case "$1" in
'start')
# Start the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"
su - $ORA_OWNER -c $ORA_HOME/bin/dbstart
;;
'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 $ORA_HOME/bin/dbshut
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"
;;
esac
使用chmod命令设置权限为750:
| chmod 750 /etc/init.d/dbora |
使用下面的命令配合适当的运行级别设置dbora服务自动启动:
| chkconfig --level 345 dbora on |
这样有关的实例就会随系统的启动而启动了。
这个方法仍然适用于Oracle10g和11g,使用正确的路径对ORA_HOME变量做一下改动,并将其添加到dbstart和dbshut末尾的行,在Oracle10gR2下可以移除启动和停止监听器的行了,因此dbstart命令包括启动监听器。
#!/bin/sh
# chkconfig: 345 99 10
# description: Oracle auto start-stop script.
#
# Set ORA_HOME to be equivalent to the $ORACLE_HOME
# from which you wish to execute dbstart and dbshut;
#
# Set ORA_OWNER to the user id of the owner of the
# Oracle database in ORA_HOME.
ORA_HOME=/u01/app/oracle/product/10.2.0/db_1
#ORA_HOME=/u01/app/oracle/product/11.1.0/db_1
ORA_OWNER=oracle
if [ ! -f $ORA_HOME/bin/dbstart ]
then
echo "Oracle startup: cannot start"
exit
fi
case "$1" in
'start')
# Start the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart $ORA_HOME"
;;
'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 "$ORA_HOME/bin/dbshut $ORA_HOME"
;;
esac
| 共2页: 1 [2] 下一页 | ||||
|
|
||||
| · 2008年4月全国计算机等.. · 龙芯要做中国的“奔腾” · Vista SP1对决XP SP3 · 2008年上半年全国软考.. · ARP攻击防范与解决方案 · NAC安全访问控制 · 网络布线测试仪器 · Windows Server 2008专.. |
· Windows远程桌面应用 · 网络故障排除宝典 · 运营商封堵ADSL共享 中.. · 解析35岁技术人的价值.. · 世纪枭雄比尔盖茨的王.. · 主流品牌防火墙配置 · ASP.NET开发教程 · 超级计算机TOP500专题 |
|||
|
||||
| · SOA 面向服务架构 · SQL Server 2008/2005.. · Apache技术专题 · 三层交换技术专题 · SQL Server入门到精通 · Windows远程桌面应用 · C#技术开发指南 · Apache技术专题 |
· Windows集群服务应用 · C#技术开发指南 · 国际文档格式标准开战 · 路由器设置与口令恢复 · Linux 集群技术专题 · PHP开发应用手册 · SOA 面向服务架构 · 企业数据恢复指南 |
|||
|
||||
| · SQL Server入门到精通 · SQL Server 2008/2005.. · SOA 面向服务架构 · Apache技术专题 · C#技术开发指南 · 三层交换技术专题 · Apache技术专题 · C#技术开发指南 |
· Windows远程桌面应用 · 企业数据恢复指南 · Windows集群服务应用 · 路由器设置与口令恢复 · Linux 集群技术专题 · SOA 面向服务架构 · 了解统一威胁管理(UTM).. · 反垃圾邮件技术应用 |
|||