ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Oracle開機關機腳本

Oracle開機關機腳本

原创 Linux操作系统 作者:golden_zhou 时间:2011-08-05 16:15:54 0 删除 编辑
Linux中開啟關閉數據庫的腳本:
位於/home/oracle/dba目錄下
Primary database:


#!/bin/sh

/u01/product/oracle/bin/lsnrctl <stop
exit
EOF

ORACLE_HOME=/u01/product/oracle;export ORACLE_HOME
ORACLE_SID=epodb;export ORACLE_SID

/u01/product/oracle/bin/sqlplus /nolog <connect / as sysdba;
alter system switch logfile;
/
/
shutdown immediate;
exit;
EOF



#!/bin/sh

ORACLE_HOME=/u01/product/oracle;export ORACLE_HOME
ORACLE_SID=epodb;export ORACLE_SID

/u01/product/oracle/bin/sqlplus /nolog <connect / as sysdba;
startup;
exit;
EOF

/u01/product/oracle/bin/lsnrctl <start
exit
EOF



Standby database:
位於/home/oracle/dba目錄下

#!/bin/sh

/u01/product/oracle/bin/lsnrctl <stop
exit
EOF

ORACLE_HOME=/u01/product/oracle;export ORACLE_HOME
ORACLE_SID=epodb;export ORACLE_SID

/u01/product/oracle/bin/sqlplus /nolog <connect / as sysdba;
shutdown immediate;
exit;
EOF


#!/bin/sh

ORACLE_HOME=/u01/product/oracle;export ORACLE_HOME
ORACLE_SID=epodb;export ORACLE_SID

/u01/product/oracle/bin/sqlplus /nolog <connect / as sysdba;
startup nomount;
alter database mount standby database;
exit;
EOF

/u01/product/oracle/bin/lsnrctl <start
exit
EOF




Windows中開啟關閉數據庫的腳本:
Primary database:
位於D:\dba下

startup的腳本:
connect / as sysdba
shutdown immediate;
startup;
exit;

startup.bat的腳本:
lsnrctl start

set ORACLE_SID=ynhrm

sqlplus /nolog @d:\dba\startup.bak >>d:\dba\startup_%ORACLE_SID%.log


Shutdown的腳本:

connect / as sysdba
alter system switch logfile;
/
/
shutdown immediate;
exit;

shutdown.bat的腳本:
lsnrctl stop

set ORACLE_SID=ynhrm

sqlplus /nolog @d:\dba\shutdown.bak >>d:\dba\shutdown_%ORACLE_SID%.log



Standby database:
位於D:\dba下

Startup的腳本:

conn / as sysdba
shutdown immediate;
startup nomount;
alter database mount standby database;
set autorecovery on
recover standby database;
exit;


startup.bat的腳本:

lsnrctl start

set ORACLE_SID=ynhrm

sqlplus /nolog @d:\dba\startup.bak >>d:\dba\startup_%ORACLE_SID%.log


shutdown的腳本:

connect / as sysdba
shutdown immediate;
exit;

shutdown.bat的腳本:
lsnrctl stop

set ORACLE_SID=ynhrm

sqlplus /nolog @d:\dba\shutdown.bak >>d:\dba\shutdown_%ORACLE_SID%.log

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

请登录后发表评论 登录
全部评论

注册时间:2011-03-09

  • 博文量
    238
  • 访问量
    308326