5) LSNRCTL> stop
6) LSNRCTL>exit
验证:
与监听的启动验证一样。
3.1.6 自动启动和关闭 Oracle
可以配置系统,使得系统每次启动时自动启动 oracle 数据库,每次 shutdown 时自动关
闭 oracle 数据库;oracle 数据库的自动启动是可选的,但是推荐系统每次 shutdown 时自动
关闭 ORACLE 数据库,因为这样可以防止不正当的关闭 ORACLE 数据库。
ORACLE 提供了两个 shell 文件来支持数据库的 自 动 关 闭 和 启 动 ,他们 是 位 于
$ORACLE_HOME/bin 的 dbshut 和 dbstart。
dbshut 和 dbstart 涉及了 oratab 文件的相同实体,所以不可能自动启动 sid1、sid2、sid3
而只自动关闭 sid1、sid2,不过可以只用 dbshut 去自动关闭数据库而不用 dbstart,
自动启动和关闭 oracle 数据库。
1. 编辑/var/opt/oracle/oratab 文件
oratab 文件中数据库实体为以下格式:
ORACLE_SID:ORACLE_HOME:{Y|N}
最后一个 Y|N 域指定是否自动关闭和启动数据库,找到要自动启动的数据库(即
第一个域 ORACLE_SID),然后把最后一个域更改为 Y。
即:在该文件末尾,有一行为如上格式的具体实例.把后面的参数 N 修改:Y:Y
2. 使用超级用户在/etc/init.d/目录中建立 dbora 文件
3. dbora 文件的内容如下所示:
#!/bin/sh
# 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
#使用真实的ORACLE_HOME代替如下路径.和安装用户.
ORA_HOME=/<mount_point>/app/oracle/product/9.0.1.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