Create a backup directory to view the remaining space
[Email protected] ~]$DF-hDF: '/home/oratest/. Gvfs ': Permission deniedfilesystem Size used Avail use%mounted on/dev/mapper/centos-root 450G 27G 423G6% /Devtmpfs5.8G0 5.8G0% /Devtmpfs5.8G2.9G3.0G -%/dev/Shmtmpfs5.8G 34M5.8G1% /Runtmpfs5.8G0 5.8G0%/sys/fs/Cgroup/DEV/SDA1 497M 128M 370M -%/boot
Create the directory, and change the permissions for the database user
sudo mkdir-p /rman_backup/bak_data /rman_backup/scripts
[email protected] ~]$ sudo chgrp-r dba/rman_backup/
[email protected] ~]$ sudo chown-r oracle/rman_backup/
Rman parameter Configuration
7 days;
Fully prepared script backupfull.sh
# script.: Backupfull.SH# creater:wangshengzhuang#Date: ./ on/ to# desc:backup full database datafileincharchive with rman# connect Databaseexport oracle_base=/home/oratest/app/Oratestexport Oracle_home=/home/oratest/app/oratest/product/12.1.0/Dbhome_1export Oracle_sid=Cistestexport PATH= $ORACLE _home/bin: $PATHrman Target/<<eofrun{Allocate channel C1 type disk; Backup incremental level0Tag'db0'Format'/rman_backup/bak_data/db0_%d_%t_%s'database include current Controlfile plus archivelog filesperset -Format'/rman_backup/bak_data/arc0_%d_%t_%s' ; Delete noprompt obsolete; Release channel C1;} eof#
Incremental backup backupincr1.sh
# script.: Backupfull.SH# creater:wangshengzhuang#Date: ./ on/ to# desc:backup Incremental database datafileincharchive with rman# connect Databaseexport oracle_base=/home/oratest/app/Oratestexport Oracle_home=/home/oratest/app/oratest/product/12.1.0/Dbhome_1export Oracle_sid=Cistestexport PATH= $ORACLE _home/bin: $PATHrman Target/<<eofrun{Allocate channel C1 type disk; Backup incremental level1Tag'DB1'Format'/rman_backup/bak_data/db1_%d_%t_%s'database include current Controlfile plus archivelog filesperset -Format'/rman_backup/bak_data/arc1_%d_%t_%s' ; Delete noprompt obsolete; Release channel C1;} eof#
Configure scheduled scheduling
Sunday and Wednesday 1:00 perform a level 0 full-Library backup, 周一、二, 46 or five or six 1:00 perform a 1-level incremental backup
[Email protected] scripts]$ crontab-e0 1* *0/rman_backup/scripts/backupfull.SH>>/rman_backup/BackupFull.log0 1* *3/rman_backup/scripts/backupfull.SH>>/rman_backup/BackupFull.log0 1* *1-2/RMAN_BACKUP/SCRIPTS/BACKUPINCR1.SH>>/rman_backup/BackupIncr.log0 1* *4-6/RMAN_BACKUP/SCRIPTS/BACKUPINCR1.SH>>/rman_backup/backupincr.log
Reload scheduling
sudo /sbin//bin/systemctl Reload crond.service
Oracle 12c Rman Backup Documentation