Get the App
SLTechnology News&Howtos  ›  Servers  › 

Rman backup script under windows2008

Shulou Source: shulou.com Published: 2022-06-02 06:52:34 10月03日 Update

In general, the production environment is archived, but some companies have been using non-archiving.

First of all, let's take a look at how db is archived.

SQL > archive log list

If it is archived, you can use rman for backup.

Platform: server 2008

Database:oracle 10g

Backup strategy refer to chapter 3 of the workshop II documentation in ocp (Differential Versus Cumulative section)

Full backup on Sunday, cumulative incremental backup on Wednesday and Friday, and differential incremental backup on other days

Here is a backup scheme based on nocatlog

1: make a level 0 backup on Sunday. The script is called run0-orcl.txt.

Save policy: the resulting backup is kept on disk for 14 days and the archive log is kept for 6 days.

The script run0-orcl.txt contains the following

Run {

Configure retention policy to recovery window of 14 days

Backup incremental level=0 database include current controlfile format'C:\ db_bak\ fullback0_%d_%T_%s' plus archivelog format'C:\ archive_bak\ arch0_%d_%T_%s' delete all input

}

Report obsolete

Crosscheck backup

Delete noprompt expired backup

Delete noprompt obsolete recovery window of 14 days

Delete noprompt archivelog until time 'SYSDAY-1'

Note: if it is windows2003,sysday, it should be changed to sysdate

Then make a batch file of run0-orcl.bat, which is as follows

C:

Cd C:\ backup script

Set ORACLE_SID=ORCL

Rman target / cmdfile='C:\ backup script\ run0-orcl.txt' log='C:\ backup script\ run0-orcl_%date:~0,10%.log'

2: do level 1 differential incremental backups on Monday, Tuesday, Thursday and Saturday. The script is called run1d-orcl.txt.

Save policy: the resulting backup is kept on disk for 14 days and the archive log is kept for 6 days.

The script run1d-orcl.txt contains the following

Run {

Configure retention policy to recovery window of 14 days

Backup incremental level=1 database include current controlfile format'C:\ db_bak\ fullback1d_%d_%T_%s' plus archivelog format'C:\ archive_bak\ arch2d_%d_%T_%s' delete all input

}

Report obsolete

Crosscheck backup

Delete noprompt expired backup

Delete noprompt obsolete recovery window of 14 days

Delete noprompt archivelog until time 'SYSDAY-1'

Then make a batch file of run1d-orcl.bat, which is as follows

C:

Cd C:\ backup script

Set ORACLE_SID=ORCL

Rman target / cmdfile='C:\ backup script\ run1d-orcl.txt' log='C:\ backup script\ run1d-orcl_%date:~0,10%.log'

3: do level 1 cumulative incremental backups on Wednesday and Friday, and the script name is run1c-orcl.txt

The script run1c-orcl.txt contains the following

Run {

Configure retention policy to recovery window of 14 days

Backup incremental level=1 cumulative database include current controlfile format'C:\ db_bak\ fullback1c_%d_%T_%s' plus archivelog format'C:\ archive_bak\ arch2c_%d_%T_%s' delete all input

}

Report obsolete

Crosscheck backup

Delete noprompt expired backup

Delete noprompt obsolete recovery window of 14 days

Delete noprompt archivelog until time 'SYSDAY-1'

Then make a batch file of run1c-orcl.bat, which is as follows

C:

Cd C:\ backup script

Set ORACLE_SID=ORCL

Rman target / cmdfile='C:\ backup script\ run1c-orcl.txt' log='C:\ backup script\ run1c-orcl_%date:~0,10%.log'

4: set the execution task

Start-Administrative tools-Task Scheduler

Then follow the script above to create a new task plan

Increment. Jpg

Tags: Backups scripts content increments methods tasks files policies differences logs disks companies names tools platforms situations documents scenarios right and wrong patterns Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology OPPO Reno Redmi Docker NVidia