We all faced that situation when we have to make a logical backup/export and haven’t so much area to do that, right?
We know the export usually compress a lot on zip/gzip… It wouldn’t be great if we can export directly to compressed file?
This situation become much more common because of Datapump, that requires a directory accessible by database server. If you have not possibility to make a mounting point or any other area, this can help…
## BKP with MKNOD BKP_DEST=/just/example DATE=`date +%Y%m%d%H%M` cd $BKP_DEST mknod bkp_$DATE.dmp p gzip bkp_$DATE.dmp.gz & ### Uncomment and Ajust one of: ## MySQL: #mysqldump -u $user -p$password $database > bkp_$DATE.dmp ## Oracle (Datapump or EXP) expdp \"/ as sysdba\" dumpfile=bkp_$DATE.dmp full=y directory=DIRECTORY_EXAMPLE logfile=log_bkpzipped.log compress=y #expdp $user/$password dumpfile=bkp_$DATE.dmp full=y directory=DIRECTORY_EXAMPLE logfile=log_bkpzipped.log #exp \"/ as sysdba\" file=bkp_$DATE.dmp log=log_bkpzipped.log compress=y [tables=owner.table,..] [owner=schema1,..] [...]
exp scott/tiger file=>(gzip >emp.dmp.gz) tables=emp
>>rename emp to empx;
imp scott/tiger full=y file=<(gunzip <emp.dmp.gz)