[Back To HomePage and Script Library]

Disclaimer: Use these scripts and/or any recommendations they may contain at your own risk. These scripts may or may not have been tested.

Title: Tricks for Faster Database Export to Tape on UNIX

Author: Kimmy Chan, an IT Manager, for Vickers Ballas HK Ltd., in Hong Kong.

I use the Unix dd utility to speed up database export to tape (slow but large capacity offline backup device).

I tried the trick in a Oracle 7.2.3 database running on HP-UX 10.20 of size 6.5G (total data segment size) to a 4mm DDS-2
tape (export dump file is about 2.5G in size). The normal time required for exporting without using "dd" is 8 hours as compare
to only 4 hours when using "dd".

The use of dd can provide additional information of the export dump file size which is not possible when directly exporting to
tape.
Source/Text/Comments



#!/bin/sh

# Setup correct Oracle environment
export ORACLE_SID=test
export ORAENV_ASK=NO
. /usr/local/bin/oraenv

# 1. Log the start time.
date
echo "---"

# 2. Create a named pipe for the export.
echo "Creating named pipe"
/etc/mknod /tmp/exp.p p

# 3. Copy export byte stream to tape.
#    bs is the block size and it is set to 1024 byte
#    the last "&" sign is important to make this process run in
#    background
echo "Put dd in background to copy export dump to tape"
/usr/bin/dd bs=1024 if=/tmp/exp.p of=/dev/rmt/1m &

# 4. Export the database to the named pipe.
echo "Exporting database"
exp system/manager file=/tmp/exp.p full=y compress=y

# the "wait" command is important to wait for the background "dd"
# process to complete and the processed record count will be shown
# afterward
wait

# 5. Log finish time.
date
echo "---"

# 6. Clean up.
echo "Cleaning up the named pipe"
rm /tmp/exp.p

===================== Script ended here ===========================

======================== Sample Output ============================
Sat Aug 29 03:30:00 EAT 1998
---
Creating named pipe
Put dd in background to copy export dump to tape
Exporting database
Export: Release 7.2.3.0.0 - Production on Sat Aug 29 03:30:00 1998
...
...
...
Export terminated successfully without warnings.
4974490+0 records in
4974490+0 records out
Sat Aug 29 07:22:24 EAT 1998
---
Cleaning up the named pipe