Many times, we need to perform Oracle backup through the client, where we use automated tasks from Windows to automate Oracle backup and backup cleanup
The use of automatic tasks is slightly
1. Create an automatic backup script
@echo off @echo ================================================
Automated backup scripts for Oracle databases @echo Windows environment
@echo Description: When you start a backup, you need to configure the following variables
@echo 1, Backup_dir specify which directory to back up to
@echo 2, Oracle_username specify the ORACLE user name to use for the backup
@echo 3, Oracle_password specifies the ORACLE password used for the backup
@echo 4, oracle_db specifies the ORACLE connection name used for the backup
@echo 5, back_option backup option, can be empty, can be full=y, can be owner=a user, B user and so on .... @echo 6, Rar_cmd specifies the RAR command line compression tool In the Catalog
@echo ================================================
REM The following variables need to be configured according to the actual situation
Set Backup_dir=f:\database_bak\
Set Oracle_username=name
Set Oracle_password=pwd
Set Oracle_db=dbname
Set Back_option=full=y
Set rar_cmd= "C:progra~1winrarrar.exe"
for/f "tokens=1,2"%%a in (' date/t ') do set today=%%a set back_name=%oracle_db%_%today% (%time:~0,2% time%time:~3,2% min) _ Set BA Ck_full_name=%backup_dir%%back_name%
REM Start back up exp%oracle_username%/%oracle_password%@%oracle_db%%back_option% file= "%back_full_name%.dmp" log= "%BACK_" Full_name%exp.log "
2. Create a Delete script
RD/S/q F:\database_BAK
MD F:\database_BAK
3. Finally, we can set the time to clean up the backup by automatic task, so that the disk is not full.
How to use Windows Automated tasks for Oracle data backup and cleanup