{"rsdb":{"rid":"395053","subhead":"","postdate":"0","aid":"272456","fid":"57","uid":"1","topic":"1","content":"

crontab \u914d\u7f6e<\/p>

\u5468\u672b\u5168\u91cf\u5907\u4efd\uff0c\u5176\u4ed6\u65e5\u671f\u589e\u91cf\u5907\u4efd,\u6e05\u966415\u5929\u4ee5\u524d\u6587\u4ef6
0 5 * * * find \/app\/oracle11g\/product\/11.2.0\/archdir\/ecudb\/* -mtime +6 |xargs  rm -fr<\/p>

#rmanbackup
30 4 * * 6  sh \/backup\/feikong\/scripts\/rman_backup_0.sh
30 4 * * 0,1,2,3,4,5  sh \/backup\/feikong\/scripts\/rman_backup_1.sh
30 4 * * * find \/backup\/data -ctime +15 -type f |grep -E "DB_0|DB_1|arch_" |xargs -L 1 rm -rf<\/p>


rman_backup_0.sh
#!\/bin\/bash
source ~\/.bash_profile
rq=`date +%Y%m%d`
rman target \/ log \/backup\/log\/rmanbackup_${rq}.log append<<EOF
set encryption on identified by "u9j04hkUvfRu" only;
run{
ALLOCATE CHANNEL ch1 TYPE disk;
ALLOCATE CHANNEL ch2 TYPE disk;
BACKUP INCREMENTAL LEVEL 0 TAG "DB0" DATABASE FORMAT "\/backup\/data\/DB_0_%T%U.bkp";
CROSSCHECK ARCHIVELOG ALL;
DELETE NOPROMPT EXPIRED ARCHIVELOG ALL;
sql "alter system archive log current";
backup archivelog all format "\/backup\/data\/arch_%T%U.arc";
delete noprompt backup of archivelog until time "sysdate-8";
backup current controlfile format "\/backup\/data\/ctl_%T%U.ctl";
CROSSCHECK BACKUP;
CROSSCHECK backupset;
DELETE NOPROMPT EXPIRED BACKUP;
DELETE NOPROMPT EXPIRED BACKUPSET;
REPORT OBSOLETE;
delete NOPROMPT obsolete device type disk;
RELEASE CHANNEL ch1;
RELEASE CHANNEL ch2;
}
exit
EOF<\/p>


rman_backup_1.sh
#!\/bin\/bash
source ~\/.bash_profile
rq=`date +%Y%m%d`
rman target \/ log \/backup\/log\/rmanbackup_${rq}.log append<<EOF
set encryption on identified by "u9j04hkUvfRu" only;
run{
ALLOCATE CHANNEL ch1 TYPE disk;
ALLOCATE CHANNEL ch2 TYPE disk;
BACKUP INCREMENTAL LEVEL 1 TAG "DB1" DATABASE FORMAT "\/backup\/data\/DB_1_%T%U.bkp";
CROSSCHECK ARCHIVELOG ALL;
DELETE NOPROMPT EXPIRED ARCHIVELOG ALL;
sql "alter system archive log current";
backup archivelog all format "\/backup\/data\/arch_%T%U.arc";
delete noprompt backup of archivelog until time "sysdate-8";
backup current controlfile format "\/backup\/data\/ctl_%T%U.ctl";
CROSSCHECK BACKUP;
CROSSCHECK backupset;
DELETE NOPROMPT EXPIRED BACKUP;
DELETE NOPROMPT EXPIRED BACKUPSET;
REPORT OBSOLETE;
delete NOPROMPT obsolete device type disk;
RELEASE CHANNEL ch1;
RELEASE CHANNEL ch2;
}
exit
EOF<\/p>","orderid":"0","title":"Oracle\u589e\u91cf\u548c\u5168\u91cf\u5907\u4efd\u65b9\u6848","smalltitle":"","mid":"0","fname":"\u6570\u636e\u5e93\u7f16\u7a0b","special_id":"0","bak_id":"0","info":"0","hits":"274","pages":"1","comments":"0","posttime":"2023-07-26 08:18:13","list":"1690330693","username":"admin","author":"","copyfrom":"","copyfromurl":"","titlecolor":"","fonttype":"0","titleicon":"0","picurl":"https:\/\/www.cppentry.com\/upload_files\/","ispic":"0","yz":"1","yzer":"","yztime":"0","levels":"0","levelstime":"0","keywords":"Oracle<\/A> \u5168\u91cf\u5907<\/A> \u65b9\u6848<\/A>","jumpurl":"","iframeurl":"","style":"","template":"a:3:{s:4:\"head\";s:0:\"\";s:4:\"foot\";s:0:\"\";s:8:\"bencandy\";s:0:\"\";}","target":"0","ip":"119.59.235.169","lastfid":"0","money":"0","buyuser":"","passwd":"","allowdown":"","allowview":"","editer":"","edittime":"0","begintime":"0","endtime":"0","description":"Oracle\u589e\u91cf\u548c\u5168\u91cf\u5907\u4efd\u65b9\u6848","lastview":"1715493413","digg_num":"0","digg_time":"0","forbidcomment":"0","ifvote":"0","heart":"","htmlname":"","city_id":"0"},"page":"1"}