Knowledgebase: General
Backing up Oracle

Here are step-by-step instructions, and modified script to back up Oracle using RBackup.

1) Select a drive which has enough room to store the backups of the Oracle locally (usually 2 or 3 times the Oracle database size). Create a folder called OracleBackup and inside that create a folder named Temp. (Example: E:\OracleBackup\Temp)

2) Inside the Temp folder, create 2 folders called log and temp. (Example: E:\OracleBackup\Temp\log and E:\OracleBackup\Temp\temp)

3) Extract and copy the attached file rman_incremental.bat to the Remote Backup (or Endpoint's application folder) folder.

4) If you are going to create a separate backup set for Oracle, create a pre-rbs.bat file with the name pre-[backupsetname].bat inside the Remote Backup (or application) folder. Or just edit the existing pre-rbs.bat file.

5) Include the command inside the pre-rbs.bat file: 

rman_incremental.bat sys password SUMMIT DB E:\Oraclebackup\%d_%p_%s_%t.bkp

(in the above command: replace the"sys" with Username, password with the password for Oracle and E:\Oraclebackup with the actual path where you have created the folder in step 1)

6) In Remote Backup Endpoint, select the backup set and include the folder E:\OracleBackup for backup.

When the backup runs, the Endpoint will execute the pre-rbs.bat (or pre-[backupsetname].bat) file and create a backup of Oracle DB in the folder E:\Oraclebackup folder that you specify.

The Endpoint then compresses, encrypts and transfers the file to the offsite backup server.

NOTE: After the first backup you have to edit the rman_incremental.bat file. Search for LEVEL 0 DATABASE in the batch file, and replace it with LEVEL 1 DATABASE. This will then do incremental backups of oracle.

Create a batch file called "rman_incremental.bat" containing the following code:


if (%1)==() goto USAGE
if (%2)==() goto USAGE
if (%3)==() goto USAGE

set ORALOG=E:\Oraclebackup\Temp\log
set ORATMP=E:\Oraclebackup\Temp\temp

if (%ORALOG%)==() goto ENV_VARIABLES
if (%ORATMP%)==() goto ENV_VARIABLES

set FILENAME=rman_backup_hot_full
set DB_USERNAME=%1%
set DB_PASSWORD=%2%
set TNS_ALIAS=%3%
set DB_BACK=%4%
set CMDFILE=%ORATMP%\%FILENAME%_%TNS_ALIAS%.rcv
set LOGFILE=%ORALOG%\%FILENAME%_%TNS_ALIAS%.log

del /q %CMDFILE%
del /q %LOGFILE%


REM +--------------------------------------------------------------------------+
REM | WRITE RMAN COMMAND SCRIPT. |
REM +--------------------------------------------------------------------------+

echo backup INCREMENTAL LEVEL 0 DATABASE plus archivelog format "%DB_BACK%" 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;>> %CMDFILE%
REM echo delete force noprompt expired backup of database; >> %CMDFILE%
REM echo delete force noprompt expired backup of controlfile; >> %CMDFILE%
REM echo delete force noprompt expired archivelog all; >> %CMDFILE%

echo exit; >> %CMDFILE%


rman target %DB_USERNAME%/%DB_PASSWORD%@%TNS_ALIAS% nocatalog cmdfile=%CMDFILE% msglog %LOGFILE%

findstr /i "error" %LOGFILE%
if errorlevel 0 if not errorlevel 1 echo WARNING %FILENAME% %TNS_ALIAS% %COMPUTERNAME% %DATE% %TIME% %LOGFILE%

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

goto END

:USAGE
echo Usage: rman_backup_hot_full.bat DBA_USERNAME DBA_PASSWORD TNS_ALIAS
echo DBA_USERNAME = Oracle DBA Username - (Requires SYSDBA Role)
echo DBA_PASSWORD = Oracle DBA Password
echo TNS_ALIAS = Connect String to connect to the database (ex. ORCL)
goto END

: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

 

(101 vote(s))
This article was helpful
This article was not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
Online Backup Software by Remote Backup Systems fusion