ITPub博客

首页 > Linux操作系统 > Linux操作系统 > linux shell如何调用sqlplus关闭数据库

linux shell如何调用sqlplus关闭数据库

原创 Linux操作系统 作者:wisdomone1 时间:2013-06-26 00:12:36 0 删除 编辑

-bash-3.2$ more shutdown.sh
sqlplus '/as sysdba'<shutdown immediate
exit
EOF
proccnt=`ps -ef|grep ora_|grep -v ora|wc -l`
if [ ${proccnt} = 0 ]
then
 echo 'oracle have stopped'
fi

-bash-3.2$ sqlplus '/as sysdba'

SQL*Plus: Release 11.2.0.1.0 Production on Mon Jun 24 23:22:07 2013

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area  313860096 bytes
Fixed Size                  1336232 bytes
Variable Size             167775320 bytes
Database Buffers          138412032 bytes
Redo Buffers                6336512 bytes
Database mounted.
Database opened.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
-bash-3.2$ . ./shutdown.sh

SQL*Plus: Release 11.2.0.1.0 Production on Mon Jun 24 23:22:27 2013

Copyright (c) 1982, 2009, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
oracle have stopped
-bash-3.2$

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9240380/viewspace-764810/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
提供针对oracle初学者及进阶的数据库培训,欢迎大家咨询: 微信: wisdomone 微信公众号: lovedb qq: 305076427 微博: wisdomone9

注册时间:2008-04-04

  • 博文量
    2150
  • 访问量
    11859659