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博客 ” ,链接:https://blog.itpub.net/25198367/viewspace-704259/
,如需转载,请注明出处,否则将追究法律责任。