Sponsored Content
Full Discussion: Script for Export backup!!
Top Forums Shell Programming and Scripting Script for Export backup!! Post 302605212 by Mohammed Fareed on Wednesday 7th of March 2012 02:08:41 AM
Old 03-07-2012
MySQL Script for Export backup!!

Dear Team,

Can you please help me to write the script for export backup.
I've written some of the part and stuck in "if" condition Apprecatied if you help me.

Requirement:- Export backup completion sent the email if it is success (sent backup success email)or if fails (sent backup fails email).

My Shell Script:-
------------

Code:
######################### START OF SCRIPT #########################
#!/bin/bash
#Backup script by Export backup.
export HOST_NAME=`uname -n`
CDATE=`date +%d%m%Y`
export CDATE
echo $CDATE
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/10.2.0
ORACLE_SID=icba
PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export ORACLE_BASE ORACLE_HOME PATH ORACLE_SID
ADMIN_EMAIL=xxxxx@email.id
LOGFILE=/home/oracle/dump/expdp_$CDATE.log
EXPORT_PATH=/home/oracle/dump/export_backup
DMP_FILE=expdp_$CDATE.dmp
LOG_FILE=expdp_$CDATE.log
export DMP_FILE LOG_FILE
echo Starting . > $LOGFILE
expdp system/password schemas=XXXXX directory=dump_dir DUMPFILE=$DMP_FILE LOGFILE=$LOG_FILE
#expdp mrmrs/mrmrs TABLES=resident,sejour DIRECTORY=EXPORT_BACKUP_DIR DUMPFILE=$DMP_FILE LOGFILE=$LOG_FILE
cat $EXPORT_PATH/$LOG_FILE >> $LOGFILE
echo Backup Completed. >> $LOGFILE
echo gzipping . >> $LOGFILE
gzip $EXPORT_PATH/$DMP_FILE >> $LOGFILE
echo gzipping Completed. >> $LOGFILE
#echo Deleting old files >> $LOGFILE
#find $EXPORT_PATH -type f -mtime +31 | xargs rm >> $LOGFILE
echo Delete Completed >> $LOGFILE
uuencode $LOGFILE expdb_$CDATE | mail -s "$HOST_NAME:$SID Export backup success on `CDATE`" $ADMIN_EMAIL
[oracle@testdb dump]$


Thank you,
Mohammed Fareed.

Last edited by Mohammed Fareed; 06-11-2012 at 07:39 AM..
Mohammed Fareed
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

export UNIX95=1 in a script??

Hi, I have following script. It has a line export UNIX95=1 What does UNIX95 suggest? If I donot export UNIX95=1 , I get error "illegale option -o" for ps command. man ps donot show -o option. Any pointers?? Thanks in advance, -Ashish (2 Replies)
Discussion started by: shriashishpatil
2 Replies

2. Shell Programming and Scripting

script to export variables

Hi, I am a newbie to unix as well as scripting. I need to write a script, which on execution sets the necessay oracle variables. Can someone help me out as to how to proceed? also can u suggest good tutorial for bash/shell scripting? thanks (1 Reply)
Discussion started by: aboxilica
1 Replies

3. UNIX for Dummies Questions & Answers

export script commands with xterm

I am attempting to write a shell script that runs a program which generates data and then runs another program to plot the data. The problem is that I need the plotting to take place in a different terminal window that stays open after the plotting has finished. I have experimented 'xterm -e '... (1 Reply)
Discussion started by: chris2051
1 Replies

4. Shell Programming and Scripting

How to export an array to perl script?

hi all...... i want to use an array ,declared in bash, in embedded perl script. is there any way to export whole array so that i can use it '$ENV{}' or something.. thanx in advance!! regards, prayush (1 Reply)
Discussion started by: tprayush
1 Replies

5. Shell Programming and Scripting

Use of export from a shell script..

Hi All, I am facing a problem while trying to export path variables from a script. Here's my situation 1. I have a script in which i have defined all the path variables to be exported: export ORACLE_HOME=/path/to/bin/ export NG_USER_HOME=/path/to/bin/ etc.... 2. I have another shell... (4 Replies)
Discussion started by: raghu_shekar
4 Replies

6. Shell Programming and Scripting

Export from perl script

Hi, Want to initaite the Oracle's Export utility from the perl script,but getting error as mentioned below: Script #!/usr/bin/perl -w my $username="system"; my $password = "manager"; my $tns = "DBLOCAL"; exp $username/$password@$tns Error $ ./testexp.pl Array found where... (4 Replies)
Discussion started by: milink
4 Replies

7. Shell Programming and Scripting

rsync backup mode(--backup) Are there any options to remove backup folders on successful deployment?

Hi Everyone, we are running rsync with --backup mode, Are there any rsync options to remove backup folders on successful deployment? Thanks in adv. (0 Replies)
Discussion started by: MVEERA
0 Replies

8. Shell Programming and Scripting

export repository shell script

Hi Forum, I have script to export he Siebel repository. My requirment is to have a shell script in place so when placed in it in a cron it should generate the repsoitory dat file on date basis. Script for export: repimexp /a E /c UCM_ES_DEV2_DSN /u sadmin /p SADMIN /d siebel /r... (4 Replies)
Discussion started by: nuthakki
4 Replies

9. Shell Programming and Scripting

Help with Backup Shell Script for Network Device Configuration backup

HI all, im new to shell scripting. need your guidence for my script. i wrote one script and is attached here Im explaining the requirement of script. AIM: Shell script to run automatically as per scheduled and backup few network devices configurations. Script will contain a set of commands... (4 Replies)
Discussion started by: saichand1985
4 Replies

10. Shell Programming and Scripting

Export Error in Shell script

All, While executing the bellow commnad after the sed, awk command to export the value to, i am getting the fallowing error. line="_AABBB.EEEEEEE.LOG4JDISPLAY.PATH_=/apps/opt/abcde/pdstdsd/esapp/apadsfasdf/logadsfasdf.xml" keystring=`echo $line | awk -F"=" '{ print $1 }'`... (1 Reply)
Discussion started by: jothi basu
1 Replies
DB2BAK(8)						      System Manager's Manual							 DB2BAK(8)

NAME
db2bak - Directory Server script for making a backup of the database SYNOPSIS
db2bak [archivedir] [-Z serverID] [-q] [-h] DESCRIPTION
Creates a backup of the database. This script can be executed while the server is running or stopped. OPTIONS
A summary of options is included below: archivedir The full path to the directory to store the backup. -Z Server Identifier The server ID of the Directory Server instance. If there is only one instance on the system, this option can be skipped. -q Quiet mode. Reduces output of task. -h Display the usage. EXAMPLE
db2bak -Z instance2 Makes a backup of the entire database for 'instance2', and stores it in the default server instance backup directory. db2bak /LDAP/backups/20130305 Creates a backup of the database and stores it in specified location. DIAGNOSTICS
Exit status is zero if no errors occur. Errors result in a non-zero exit status and a diagnostic message being written to standard error. AUTHOR
db2bak was written by the 389 Project. REPORTING BUGS
Report bugs to http://bugzilla.redhat.com. COPYRIGHT
Copyright (C) 2013 Red Hat, Inc. Mar 5, 2013 DB2BAK(8)
All times are GMT -4. The time now is 04:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy