版權聲明:轉載時請以超鏈接形式標明文章原始出處和作者信息及本聲明
http://blog.csdn.net/wenshuangzhu/article/details/43206089
Oracle提供了兩個腳本dbstart和dbshut用來啓動和關閉數據庫(包括數據庫實例和監聽)。
這兩個腳本首先讀取oratab(/etc/oratab)文件來決定哪些數據庫是需要自動啓動和關閉的,然後啓動和關閉那些數據庫。
[oracle@linux1 ~]$ vi /etc/oratab
#
# This file is used by ORACLE utilities. It is created by root.sh
# and updated by the Database Configuration Assistant when creating
# a database.
# A colon, ':', is used as the field terminator. A new line terminates
# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third filed indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
orcl:/home/database/oracle/product/11g:N
要使用dbstart和dbshut啓動和關閉數據庫,需要把N改成Y。
執行 dbstart和dbshut會提示:
[oracle@linux1 ~]$ dbstart
ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener
Usage: /home/database/oracle/product/11g/bin/dbstart ORACLE_HOME
錯誤原因是:dbstart和dbshut腳本文件中沒有設置ORACLE_HOME_LISTNER。
有兩種解決方式:
1、 運行命令時帶上$ORACLE_HOME參數:
[oracle@linux1 ~]$ dbstart $ORACLE_HOME
2、 分別打開兩個文件找到:ORACLE_HOME_LISTNER=$1,修改爲:
ORACLE_HOME_LISTNER=$ORACLE_HOME
命令如下:
[oracle@linux1 ~]$ vi $ORACLE_HOME/bin/dbstart
[oracle@linux1 ~]$ vi $ORACLE_HOME/bin/dbshut
啓動數據庫:
[oracle@linux1 ~]$ dbstart
Processing Database instance "orcl": log file /home/database/oracle/product/11g/startup.log
關閉數據庫:
[oracle@linux1 ~]$ dbshut
Processing Database instance "orcl": log file /home/database/oracle/product/11g/shutdown.log