expdp userid='system/REP2012@REPDB' full=Y direct=Y
###############################################################
## Connect to database and create directory object
###############################################################
SQL> CREATE OR REPLACE DIRECTORY DMP_FILES AS '/backup/dmp';
SQL> GRANT read, write ON DIRECTORY DMP_FILES TO system;
SQL> col DIRECTORY_PATH for a40
SQL> col OWNER for a12
SQL> SELECT * FROM DBA_DIRECTORIES;
OWNER DIRECTORY_NAME DIRECTORY_PATH
-------- --------------- ---------------------
SYS DMP_FILES /backup/dmp
###############################################################
## From Linux command prompt, create backup script
###############################################################
[oracle@oradb1 ~]# cat /backup/dmp/dmp_backup.sh
### Export Data Pump Backup
expdp userid='system/REP2012@REPDB' full=Y direct=Y directory=DMP_FILES
dumpfile=REPDB_full_$(date +"%a").dmp
logfile=REPDB_full_$(date +"%a").log
### Send status Email
cat /backup/dmp/REPDB_full_$(date +"%a").log | grep -i 'successfully completed' | mailx -s "EXPDP Backup Status" itgroup@hsbc.com
### Compressing Backup + Log
tar -zcvf /backup/dmp/REPDB_full_$(date +"%a").dmp.tar.gz /backup/dmp/REPDB_full_$(date +"%a").dmp /backup/dmp/REPDB_full_$(date +"%a").log
### Deleting Backup
rm -f /backup/dmp/REPDB_full_$(date +"%a").dmp
###############################################################
## Connect to database and create directory object
###############################################################
SQL> CREATE OR REPLACE DIRECTORY DMP_FILES AS '/backup/dmp';
SQL> GRANT read, write ON DIRECTORY DMP_FILES TO system;
SQL> col DIRECTORY_PATH for a40
SQL> col OWNER for a12
SQL> SELECT * FROM DBA_DIRECTORIES;
OWNER DIRECTORY_NAME DIRECTORY_PATH
-------- --------------- ---------------------
SYS DMP_FILES /backup/dmp
###############################################################
## From Linux command prompt, create backup script
###############################################################
[oracle@oradb1 ~]# cat /backup/dmp/dmp_backup.sh
### Export Data Pump Backup
expdp userid='system/REP2012@REPDB' full=Y direct=Y directory=DMP_FILES
dumpfile=REPDB_full_$(date +"%a").dmp
logfile=REPDB_full_$(date +"%a").log
### Send status Email
cat /backup/dmp/REPDB_full_$(date +"%a").log | grep -i 'successfully completed' | mailx -s "EXPDP Backup Status" itgroup@hsbc.com
### Compressing Backup + Log
tar -zcvf /backup/dmp/REPDB_full_$(date +"%a").dmp.tar.gz /backup/dmp/REPDB_full_$(date +"%a").dmp /backup/dmp/REPDB_full_$(date +"%a").log
### Deleting Backup
rm -f /backup/dmp/REPDB_full_$(date +"%a").dmp
No comments:
Post a Comment