Share a script EXP that backs up ORACLE to local disk under LINUX, and keep it for 7 days
Please do not put the backup script under backup_dir, add it to crontab and run it regularly.
#! / bin/sh
Export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
Export ORACLE_SID=orcl
Export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
Export PATH=/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/oracle/bin:/u01/app/oracle/product/10.2.0/db_1/bin
Export BACKUP_DIR=/orabackup
Export NOW=$ (date'+% Y% d% m')
Exp system/system@ORACLE_SID file=$BACKUP_DIR/system$NOW.dmp log=$BACKUP_DIR/system$NOW.log full=y
Cd $BACKUP_DIR
Tar zcvf system$NOW.tar.gz system$NOW.dmp system$NOW.log-remove-files
Find / orabackup/-mtime + 7-exec / bin/rm-rf'{}'\
This script backs up the system user data, then compresses it into a TAR package, and then deletes files in the backup directory that are longer than 7 days.