Export Full Oracle Database & Remove The Old Backup Log File

PC & Tech Category

Oracle DBA - Export full oracle database & remove the old backup log fileIn this article we will see how to export full Oracle database and remove old backup log file. We will also see how mknod tool help us in taking a full backup.

Scenario

Every Day we have taken the full export backup of one our database. Normally Export dump file size is around 25 GB.

Steps

Daily we have followed the below steps

  1. Export the full database backup
  2. Validate the logfile whether backup is successful or not
  3. Compress the Dumpfile
  4. Remove the dumpfile & logfile greater than 5 days

Daily we have spend some time for this activity.Really we are not interested to do this activity regularly. So we have automated this activity using shell script.

Details

  1. Using mknod to compress the dumpfile during export
  2. Trigger the mail to user whether backup success or not
  3. If backup success to purge the dumpfile & logfile greater than 5 days

Note: We maintained last 5 days backup only.

Script 1

SCRIPT NAME: export_full_bkup.sh
DESCRIPTION: SCHEMA LEVEL EXPORT & DELETE THE MORE THAN 2 DAYS BACKUP DUMP. BEFORE DELETED THE OLD BACKUP VALIDATE THE CURRENT BACKUP DUMP.

##############################################################################
export_full_bkup.sh
CREATED BY RAJABASKAR THANGARAJ 18-NOV-2008
##############################################################################

#!/bin/sh
. $HOME/.bash_profile
RUNDATE=`date “+%d%m%y at %H:%M:%S”`
DBHOME=$ORACLE_HOME
BACKUP_PATH=/home/oracle/dbatest/raja/mknode/backup
cd $BACKUP_PATH
mknod export_pipe p
gzip -cNf $ORACLE_SID_$RUNDATE.dmp.gz &
exp parfile=$BACKUP_PATH/exp_param file=export_pipe
log=$BACKUP_PATH/export_$ORACLE_SID_$RUNDATE.log
cat $BACKUP_PATH/export_$ORACLE_SID_$RUNDATE.log | grep “EXP-” > $PATH/exp_$ORACLE_SID_$RUNDATE.err
mail -s “Status of $ORACLE_SID export backup on $RUNDATE ” [email protected] < $BACKUP_PATH/exp_$ORACLE_SID_RUNDATE.err
rm -f export_pipe p
WORDCOUNT=`wc $BACKUP_PATH/exp_$ORACLE_SID_$RUNDATE.err | awk ‘{print $1}’`
if [ $WORDCOUNT -ne 0 ]; then
exit 16;
else
find $BACKUP_PATH/*.gz -mtime +5 -exec rm {} ;
find $BACKUP_PATH/*.log -mtime +5 -exec rm {} ;
fi

Script 2

SCRIPT NAME: exp_param
DESCRIPTION: This exp_param file contains export parameter.
(SCRIPT 1 call this exp_param file during export)

##############################################################################
EXPORT PARAMETER PARFILE
CREATED BY RAJABASKAR THANGARAJ 18-NOV-2008
##############################################################################

userid=testpipe1/testpipe1 full=y buffer=10485667 statistics=none object_consistent=y

Why we are using mknod?

Instead of doing the export and zip separately, creating an interim dump file (or doing unzip and import), unix has the ability to pipe the output from one program (such as exp) as input to another program (such as gzip) as they both run in parallel, without having to run the programs sequentially and without having to create interim files.

More details about MKNOD

https://www.primeinspiration.com/programming/database/oracle/84-using-mknod-during-export.html

I Hope this article helped you to understand the automated full export database.Suggestions are welcome.

Tags:

Edward Ramamoorthy Avatar

Help Us Grow

If you like this post, please share it with your friends.

You are free to copy and redistribute this article in any medium or format, as long as you keep the links in the article or provide a link back to this page.

Subscribe to Newsletter




Privacy Settings

Privacy & Cookie Overview

Our website uses cookies to provide you with the best user experience possible. These cookies are stored in your browser and perform essential functions such as recognizing you when you return to our website, as well as helping us to understand which sections of the website you find most useful and engaging.

To learn more, you can read our Privacy & Cookie Policy or reach out through our Contact form.

Strictly Necessary Cookies

Strictly Necessary Cookies must always be enabled to ensure the proper functioning of this website and to allow us to provide you with excellent service. These cookies are also essential for saving your cookie preferences.

Google Adsense

We use Google AdSense to keep this site free by displaying relevant ads. AdSense requires essential cookies that cannot be disabled, but you can manage other cookies. We respect your privacy and provide options to control non-essential cookies.

For more details on how Google handles your data, visit Google's Data Usage Policy. Please review our Privacy Policy for more information on how we protect your data.

AddToAny

We use AddToAny for social sharing. It doesn’t store cookies, ensuring a privacy-friendly experience. AddToAny complies with GDPR and CCPA by default.

For more, see their Privacy Policy.

OneSignal

We use OneSignal to send notifications to users who opt in. OneSignal complies with GDPR and is certified under the EU-US and Swiss-US Privacy Shield frameworks.

For more, see their Privacy Policy.

3rd Party Cookies

This website utilizes third-party cookies, which can enhance your experience and support our ongoing efforts to improve our services.

Google Analytics

We use Google Analytics to collect anonymous data, such as visitor numbers and popular pages, to improve user experience and site performance. Keeping this cookie enabled helps us refine the site based on visitor activity.

For more information, see Google’s Privacy Policy.

Discover more from Prime Inspiration

Subscribe now to keep reading and get access to the full archive.

Continue reading