Backup to Remote Tape Device Script
The below script will print the database SID and the current date, before changing to the root directory. The file is then compressed, stored on a remote tape device, and an error log is produced.#################################################
# Backup to Remote Tape Device Script
#################################################
(
ps –ef | grep pmon | grep $ORACLE_SID
echo Backup started at `date`
cd /
# On Linux gnu tar is run by default so it is not necessary to declare the path explicitly.
# On Solaris and HP, GNU tar needs to be copied to the path below and referenced
GZIP=--fast
Export GZIP
/usr/local/bin/tar zcvbf 128 [remote server]:[device name] ./[directories]
echo Backup finished at `date`
) > "[error log filename]" 2>&1 &
# End of the scriptGZIP=--fast
Sets the speed at which files are compressed. The faster a file is compressed, the lower the amount of compression performed. With the -# option, # can be any number between 1 and 9 where 1 is the fastest and 9 is the slowest. The --fast option is the equivalent to -1 whereas –best is the equivalent to -9. By default gzip performs compression as thought the -6 option was specified.tar zcvbf
tar compresses files into archive files.-z :- filter the archive through gzip
-c :- create a new archive
-v :- verbosely list files created
-b :- use record size of Nx512 bytes (default N=20)
-f :- use archive file or device
2>&1 &
The incantation 2>&1 means “Send errors (output stream number 2) to the same place ordinary output (output stream number 1) is going to”.Backup to Local Tape Script
######################################
# Backup to script for “$ORACLE_SID”
######################################
mt –t [device name] rewind
(
ps –fe | grep pmon | grep $ORACLE_SID
echo Backup started at `date`
cd /
tar cvbf 128 [device name] ./[directories]
echo Backup finished at `date`
) > “[error log filename]” 2>&1 &
# End of the scriptNote about Rewind devices and Norewind devices
The tape device drivers on Linux and Unix allow a tape device to be opened for “rewind on close” or “norewind on close”. You use a slightly different device name to choose one from another, for example:DLT rewind device: /dev/rmt/0u
DLT norewind device: /dev/rmt/0unIf you choose the rewind device, the driver will place two EOT markers at the end of the tape, and rewind the tape. You cannot get any more backups on the tape.If you choose the norewind device, the driver will place one EOT marker and then one BOT marker at the end of the tape, and will not rewind the tape. It is possible to add another backup onto the tape. The “mt” command can be used to move the tape forwards and backward between savesets
No comments:
Post a Comment
Please feel free to leave a comment