使用dbstart和dbshut命令启动和关闭数据库

版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明
http://blog.csdn.net/wenshuangzhu/article/details/43206089


Oracle提供了两个脚本dbstartdbshut用来启动和关闭数据库(包括数据库实例和监听)。

这两个脚本首先读取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

 

要使用dbstartdbshut启动和关闭数据库,需要把N改成Y

 

 

执行 dbstartdbshut会提示:

[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

 

错误原因是:dbstartdbshut脚本文件中没有设置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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章