linux shell如何呼叫sqlplus關閉資料庫

wisdomone1發表於2013-06-26

-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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章