The archive of the main database transfer to the alternate database We use scripts to periodically delete, early scripts are; #! / Bin / shexport oracle_base = / opt / oracleExport Oracle_Home = $ Oracle_Base / Product / 9.2export Oracle_SID = TBDB1in1Export bdump = / OPT / Oracle / Admin / TBDB1 / BDUMPEXPORT Home = / Home / OracleExport Path = $ PATH: $ ORACLE_HOME / BIN: / SBIN: / USR / SBINGREP "Media Recovery Log" $ bdump / alert _ $ {oracle_sid} .log | awk '{print $ 4} '| SED -E' S / ^ / RM / '> $ HOME / WORKSH / RMARCHLOG.SH CHMOD X $ HOME / WORKSH / RMARCHLOG.SH
$ Homen / worksh / rmarchlog.sh cd $ bdump
Cat Alert _ $ {oracle_sid} .log >> Alert _ $ {oracle_sid} .log.bak> alert _ $ {oracle_sid} .log
RM -F $ homen / worksh / rmarchlog.sh
However, I immediately found the problem, 1, if a log begins to recover, but when I haven't resumed it, I have already recorded the information of Media Recovery Log in the Alert log. If this time, I open (Open read only) To query the database, this log actually has not returned, but because there is information in the Alert log, the log delete program will accidentally delete this log. 2, if deleted successfully, run this script immediately will generate an error, because the Alert log does not have something, although this error does not affect what, but it is not good.
Because the previous few deleted logs, the main library also backed up and deleted, and finally, the log is to be restored from the backup, so the log deletion program script is rewritten. ! # / Bin / shexport ORACLE_BASE = / opt / oracleexport ORACLE_HOME = $ ORACLE_BASE / product / 9.2export ORACLE_SID = tbdb2in1export BDUMP = / opt / oracle / admin / tbdb2 / bdumpexport HOME = / home / oracleexport PATH = $ PATH: $ ORACLE_HOME / BIN: / SBIN: / USR / SBINGREP "Media Recovery Log" $ bdump / alert _ $ {oracle_sid} .log | GREP 1_ | SED '$ D' | awk '{print $ 4}' | SED -E 'S / ^ / RM / '> $ home / worksh / rmarchlog.sh grep "Media Recovery log" $ bdump / alert _ $ {oracle_sid} .log | grep 1_ | sed -n' $ p '> $ home / logs / logtmp.loggrep "Media Recovery log "$ bdump / alert _ $ {oracle_sid} .log | GREP 2_ | SED '$ d' | awk '{print $ 4}' | SED -E 'S / ^ / RM /' >> $ homen / Worksh / RMarchLog .shgrep "Media Recovery Log" $ bdump / alert _ $ {oracle_sid} .log | GREP 2_ | SED -N '$ P' >> $ homen / logs / logtmp.logchmod x $ homen / worksh / rmarchlog.sh
$ Homen / worksh / rmarchlog.sh cd $ bdump
Cat alert _ $ {oracle_sid} .log >> Alert _ $ {oracle_sid} .log.bak cat $ homen / logs / logtmp.log> alert _ $ {oracle_sid} .log
RM -F $ homen / worksh / rmarchlog.sh
After rewritten, the last log in each thread is not deleted, and return to the Alert log, leave the next deletion, release the delete error (more delete one) and the runtime running this script immediately generates an error.