RMAN Scripts
Execute a full backup and send the log by email
The script runner (or starter)
|
1 2 3 4 5 6 7 |
#!/bin/bash . ~/.bash_profile umask 077 rman target=/ log /u02/backup/RMAN_FULL.log @/home/oracle/Batches/Full/RmanFullBackupParameter #smtp-cli --verbose --host=smtp.gmail.com:587 --enable-auth --user username@gmail.com --password mail_password --from username@gmail.com --to mehmet at sydba.org --subject "test vt Rman log" --attach /u02/backup/RMAN_FULL.log #rman target=/ log /u02/backup/RMAN_FULL.log append @/home/oracle/Batches/RmanFullBackupParameter |
The name of the parameter file is RmanFullBackupParameter.
|
1 2 3 4 5 6 7 8 9 10 11 12 |
RUN { allocate channel c1 type disk MAXPIECESIZE 16G; BACKUP AS COMPRESSED BACKUPSET DATABASE FORMAT '/u02/Backup/dbf_%d_%t_%s' tag=dbf_full_backup; BACKUP ARCHIVELOG ALL FORMAT '/u02/Backup/arc_%d_%t_%s' tag=arc_full_backup; release channel c1; } crosscheck backup; crosscheck archivelog all; delete noprompt expired backup; delete noprompt archivelog until time "sysdate-7"; |
INCREMENTAL Backup INCREMENTAL LEVEL 0
Script starter
|
1 2 3 4 5 6 7 |
#!/bin/bash . ~/.bash_profile umask 077 rman target=/ log /u02/Backup/RMAN_L0.log @/home/oracle/Batches/Inc/L0_Parameter #smtp-cli --verbose --host=smtp.gmail.com:587 --enable-auth --user username@gmail.com --password mail_password --from username@gmail.com --to mehmet at sysdba.org --subject "test vt Rman L0 log" --attach /u02/Backup/RMAN_L0.log #rman target=/ log /u02/Backup/RMAN_FULL.log append @/home/oracle/Batches/RmanFullBackupParameter |
Parameter file “L0_Parameter”
|
1 2 3 4 5 6 7 8 9 10 11 |
RUN { allocate channel c1 type disk MAXPIECESIZE 15G; BACKUP AS COMPRESSED BACKUPSET INCREMENTAL LEVEL 0 tag DBF_Inc_L0 DATABASE FORMAT '/u02/Backup/Dbf_ INC0_%d_%T_%U'; BACKUP ARCHIVELOG ALL tag ARC_Inc_L0 FORMAT '/u02/Backup/Arc_INC0_%d_%T_%U'; release channel c1;} crosscheck backup; crosscheck archivelog all; delete noprompt expired backup; delete noprompt archivelog until time "sysdate-7"; |
INCREMENTAL Backup INCREMENTAL LEVEL 1
The script starter
|
1 2 3 4 5 6 |
#!/bin/bash . ~/.bash_profile umask 077 rman target=/ log /u02/Yedek/RMAN_L1.log @/home/oracle/Batches/Inc/L1_Parameter #smtp-cli --verbose --host=smtp.gmail.com:587 --enable-auth --user username@gmail.com --password mail_password --from username@gmail.com --to mehmet at sysdba.org --subject "test vt Rman L1 log" --attach /u02/Backup/RMAN_L1.log |
Parameter file “L1_Parameter”
|
1 2 3 4 5 6 7 8 9 10 11 |
RUN { allocate channel c1 type disk MAXPIECESIZE 15G; BACKUP AS COMPRESSED BACKUPSET INCREMENTAL LEVEL 1 tag DBF_INC_L1 CUMULATIVE DATABASE FORMAT '/u02/Backup/Dbf_L1_%d_%T_%U'; BACKUP ARCHIVELOG ALL tag ARC_Inc_L1 FORMAT '/u02/Backup/Arc_INC1_%d_%T_%U'; release channel c1; } crosscheck backup; crosscheck archivelog all; delete noprompt expired backup; |
Making a backup by compression
|
1 2 3 4 |
backup as compressed backupset database format '/u01/Rman/dbf_%d_%t_%s.rman' Tag='DBF_Manual_DDMMYYYY' plus archivelog format '/u01/Rman/arc_%d_%t_%s.rman' tag='Arc_Manual_DDMMYYYY' |
Starting a backup using Microsoft System BatchFiles
|
1 |
rman target=/ log E:BackUpRMAN.log append @E:BackUpDBF_ARC_FullBackup.txt |
Full backup
|
1 2 3 4 5 6 7 8 9 10 |
RUN { allocate channel c1 type disk MAXPIECESIZE 16G; backup as compressed backupset database format 'E:BackUpRmanDBF_%d_%t_%s.rman' Tag='Rman_DBF_FullBackup'; backup archivelog all format 'E:BackUpRmanARC_%d_%t_%s.rman' tag='Rman_Arc_FullBackup'; release channel c1; crosscheck backup; crosscheck archivelog all; delete noprompt expired backup; } |
Full backup
Once the backup has been completed, the archive logs get deleted.
It is recommended running this script on the 7th day of the week, for security reasons, as it would save the entire week’s archive logs.
|
1 2 3 4 5 6 7 8 9 10 11 |
RUN { allocate channel c1 type disk MAXPIECESIZE 16G; backup as compressed backupset database format 'E:BackUpRmanDBF_%d_%t_%s.rman' Tag='Rman_DBF_FullBackup'; backup archivelog all format 'E:BackUpRmanARC_%d_%t_%s.rman' tag='Rman_Arc_FullBackup'; release channel c1; crosscheck backup; crosscheck archivelog all; delete noprompt expired backup; BACKUP ARCHIVELOG ALL DELETE INPUT; } |
These script have been provided to give examples on how to use RMAN. They can be changed according to usage requirements.
Kategori seçin...
