1822521 Members
2562 Online
109642 Solutions
New Discussion юеВ

fbackup script question

 
SOLVED
Go to solution
Michael Treacy
Advisor

fbackup script question

I recently started running out of disk space and need to change my oracle cold backup. I had been copying all the relevant files to disk and backuping them up to tape. Now that I am low on disk space I am trying to back them up in place, to tape while the database is down.
After the database has been shutdown, the fbackup command runs / executes and immediately (before the backup to tape is complete), then the db starts and a backup of my online database is put to tape.

Anyone have any idea how I can get the database start command to wait for fbackup to finish.. I tried "if" fbackup without sucess.

Thanks in advance for any scripting techniques / idea to accomplish this.

6 REPLIES 6
Bill Hassell
Honored Contributor

Re: fbackup script question

> Anyone have any idea how I can get the database start command to wait for fbackup to finish.. I tried "if" fbackup without sucess.

Not sure what you have tried. In simple code:

mydbscript shutdown
fbackup ...
mydbscript startup

fbackup will not return until it is finished, so mydbscript startup will run at the right time. Now the above will work correctly so I suspect that there is something different that you are doing.

> fbackup command runs / executes and immediately (before the backup to tape is complete)

This is very abnormal -- unless you run fbackup ... & where the & character runs fbackup in the background (never recommended). When you put a process into the background, the scheduling of fbackup returns immediately while fbackup continues to run. While you could write some monitoring code, why bother? Just run fbackup normally and run your

Your fbackup command line should look like this:

fbackup -g graph-file -v -c config-file -f /dev/rmt/some-tape

Your graph-file would contain i /dirpath1 and e /dirpath2, etc to define the actual backup path(s). Repeat i and e as required.

Your config file should look like this:

Contents of the config-file:
============================

blocksperrecord 4096
records 64
checkpointfreq 4096
readerprocesses 6
maxretries 5
retrylimit 5000000
maxvoluses 200
filesperfsm 2000


Bill Hassell, sysadmin
Michael Treacy
Advisor

Re: fbackup script question

Sorry if I wasn't clear. Thanks for the reply.

What you describe is what I expected, so I thought that maybe fbackup spawned a subprocess or something. Maybe the fbackup command just isn't executing so it goes to the next step..
The script looks like this.

su - oracle -c $ORABIN/stop_database.sh
/var/adm/fbackupfiles/daily_fbackup.sh >>$LOGFILE
su - oracle -c $ORABIN/start_database.sh >>$LOGFILE

# more daily_fbackup.sh
#!/usr/bin/sh
# HPM Daily FBACKUP Tape creation script
mt -f /dev/rmt/0m status
/usr/sbin/fbackup -v -g /var/adm/fbackupfiles/hpm_daily.graph -f /dev/rmt/0m


Sorry about the formatting. I gues there must be something about my fbackup command that keeps it from running. I never really used the config file, but find the graph files helpfull.
Bill Hassell
Honored Contributor
Solution

Re: fbackup script question

> /var/adm/fbackupfiles/daily_fbackup.sh >>$LOGFILE

That's is the problem. You are not running fbackup but a script. While the script seems to contain simply:

> mt -f /dev/rmt/0m status
> /usr/sbin/fbackup -v -g /var/adm/fbackupfiles/hpm_daily.graph -f /dev/rmt/0m

I would not use this extra script at all as it complicates the process without adding value. Change your primary script to use the mt and fbackup commands directly. And unless you are using (very old) reel to reel tapes, you need to use a config file. It will improve performance from 30-100%.

So your backup script would look like this:

su - oracle -c $ORABIN/stop_database.sh
mt -f /dev/rmt/0m status
/usr/sbin/fbackup -v -g /var/adm/fbackupfiles/hpm_daily.graph -f /dev/rmt/0m >> $LOGFILE
su - oracle -c $ORABIN/start_database.sh >>$LOGFILE


Bill Hassell, sysadmin
Michael Treacy
Advisor

Re: fbackup script question

Thanks Bill,

I pulled the fbackup command from the batch file and entered it directly into the script. I think it will work better that way. How did you decide on the parms for the config file ? especially the blocksperrecord and records.

the man page lists these as the defaults on this system as.

blocksperrecord 16
records 16
checkpointfreq 256
readerprocesses 2 (maximum of 6)
maxretries 5
retrylimit 5000000
maxvoluses 100 chgvol /var/adm/fbackupfiles/chgvol error /var/adm/fbackupfiles/error filesperfsm 200

Each value listed is also the default value, except chgvol and error, which default to null values.
Bill Hassell
Honored Contributor

Re: fbackup script question

The default values have not changed since fbackup was first written more than 15 years ago. At that time, reel-to-reel tape drives and cartridge tapes were the standard and there was no such thing as a DDS or DLT tape drive. Reel drives had very primitive electronics and recording technology with limited record sizes and very low throughput. This is due in part to the start-stop nature of the old drives.

Today's tape drives are very fast and require a constant stream of data to avoid resync cycles. Modern tape drives cannot stop and start instantly but instead are designed to run continuously. If the data is delayed due to competing activity on the disks, the drive stops, backs up and once more data arrives, takes a running start to resync and continue -- a very long cycle with zero throughput.

These values are the values needed for DDS, DLT, LTO and any modern tape drive.


Bill Hassell, sysadmin
Michael Treacy
Advisor

Re: fbackup script question

Thanks again, I think my tape backups will be running faster real soon.