Oracle Rman Backups From

  • Uploaded by: SHAHID FAROOQ
  • 0
  • 0
  • May 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Oracle Rman Backups From as PDF for free.

More details

  • Words: 529
  • Pages: 3
Oracle rman backups from Windows Script Oracle Tips by Burleson Consulting

Scheduling tasks such as an Oracle rman backup can be challenging in a Windows environment without a thirdparty approach such as SFU, JavaScript or Visual Basic. It's tricky, but you can write old-fashioned DOS bat files, a string of DOS prompt commands, to create an execute an Oracle rman backup Once tested, the bat file is invoked with the Windows AT scheduling command. For working examples of Oracle rman backups in Windows scripts, Jeff Hunter, author of "Conducting the Java Job Interview" has a great script to schedule an rman backup in a Windows environment. Lets examine Hunter's rman backup script. Note that he builds the exp parfile arguments into a DOS variable called %PARFILE%, just like you can invoke Oracle directly from the DOS prompt: e.g. rman target %DB_USERNAME%/%DB_PASSWORD%@%TNS_ALIAS%

Above, note that this is all on one line, an important consideration when doping DOS bat file scripting. Here is Jeff's code: REM +--------------------------------------------------------------------------+ REM | VALIDATE COMMAND-LINE PARAMETERS | REM +--------------------------------------------------------------------------+ if (%1)==() goto USAGE if (%2)==() goto USAGE if (%3)==() goto USAGE REM +--------------------------------------------------------------------------+ REM | VALIDATE ENVIRONMENT VARIABLES | REM +--------------------------------------------------------------------------+ REM REM

set ORALOG=C:\oracle\custom\oracle\log set ORATMP=C:\oracle\custom\oracle\temp

if (%ORALOG%)==() goto ENV_VARIABLES if (%ORATMP%)==() goto ENV_VARIABLES REM +--------------------------------------------------------------------------+ REM | DECLARE ALL GLOBAL VARIABLES. | REM +--------------------------------------------------------------------------+ set set set set set set

FILENAME=rman_backup_hot_full_9i DB_USERNAME=%1% DB_PASSWORD=%2% TNS_ALIAS=%3% CMDFILE=%ORATMP%\%FILENAME%_%TNS_ALIAS%.rcv LOGFILE=%ORALOG%\%FILENAME%_%TNS_ALIAS%.log

REM +--------------------------------------------------------------------------+ REM | REMOVE OLD LOG AND RMAN COMMAND FILES. | REM +--------------------------------------------------------------------------+

del /q %CMDFILE% del /q %LOGFILE% REM +--------------------------------------------------------------------------+ REM | WRITE RMAN COMMAND SCRIPT. | REM +--------------------------------------------------------------------------+ echo backup database plus archivelog delete input; > %CMDFILE% REM echo crosscheck backup of database; >> %CMDFILE% REM echo crosscheck backup of controlfile; >> %CMDFILE% REM echo crosscheck archivelog all; >> %CMDFILE% echo delete noprompt force obsolete;>> REM echo delete force noprompt expired REM echo delete force noprompt expired REM echo delete force noprompt expired

%CMDFILE% backup of database; >> %CMDFILE% backup of controlfile; >> %CMDFILE% archivelog all; >> %CMDFILE%

echo exit; >> %CMDFILE% REM +--------------------------------------------------------------------------+ REM | PERFORM RMAN BACKUP. | REM +--------------------------------------------------------------------------+ rman target %DB_USERNAME%/%DB_PASSWORD%@%TNS_ALIAS% nocatalog cmdfile=%CMDFILE% msglog %LOGFILE% REM +--------------------------------------------------------------------------+ REM | SCAN THE RMAN LOGFILE FOR ERRORS. | REM +--------------------------------------------------------------------------+ findstr /i "error" %LOGFILE% if errorlevel 0 if not errorlevel 1 echo WARNING %FILENAME% %TNS_ALIAS% %COMPUTERNAME% %DATE% %TIME% %LOGFILE% echo echo echo echo echo echo echo echo

... END OF FILE REPORT Filename : %FILENAME% Database : %TNS_ALIAS% Hostname : %COMPUTERNAME% Date : %DATE% Time : %TIME% RMAN Log File : %LOGFILE%

REM +--------------------------------------------------------------------------+ REM | END THIS SCRIPT. | REM +--------------------------------------------------------------------------+ goto END

REM +==========================================================================+ REM | *** END OF SCRIPT *** | REM +==========================================================================+ REM +--------------------------------------------------------------------------+

REM | LABEL DECLARATION SECTION. | REM +--------------------------------------------------------------------------+ :USAGE echo Usage: echo echo echo goto END

rman_backup_hot_full_9i.bat DBA_USERNAME DBA_PASSWORD TNS_ALIAS DBA_USERNAME = Oracle DBA Username - (Requires SYSDBA Role) DBA_PASSWORD = Oracle DBA Password TNS_ALIAS = Connect String to connect to the database (ex. ORCL)

:ENV_VARIABLES echo ERROR: You must set the following environment variables before echo running this script: echo ORALOG = Directory used to write logfile to echo ORATMP = Directory used to write temporary files to goto END :END @echo on

Related Documents

Oracle Rman
December 2019 14
Backups
October 2019 16
Apm For Oracle Rman
November 2019 26
Oracle Rman Backup
May 2020 16

More Documents from "SHAHID FAROOQ"