When backing up files on a UNIX system, it is always best if the system is quiet and no file changes are occurring. That’s why many system administrators choose to run their backups late at night.
On some busy UNIX systems, especially those with active database programs, file changes occur 24-hours a day. If files are changing, BRU will attempt to archive them, but errors may occur. If a file changes while BRU is reading it, a warning message will normally be issued. Other errors may occur if BRU is attempting to compress a file that is changing. In either case, the data that was archived may not be correct. In fact, it may contain serious errors.
BRU does not perform any file-locking, so there is no way for BRU to stop a file from changing during a backup. In most cases, file-locking would be worthless anyway, especially for database files. This is because BRU has no way of determining if a file is part of a changing database or of knowing which groups of database files should be locked. Theoretically, BRU could simply lock each file individually, but this would probably cause the database program to crash. Most database programs have complex locking schemes and do not expect anyone else to be locking their files.
Fortunately, some of the database vendors have recognized the problems in trying to do hot backups and furnish special commands that allow you to temporarily “freeze” the database files while a backup is done. Any changes made to the database during the backup will be written to a special temporary area. Once the backup is done, all the changes will be applied to the database files. The following example illustrates how to put an Oracle database into backup mode, perform the backup with BRU, and then return the database to normal.
First, issue SQL commands to “freeze” the Oracle database:
alter tablespace name begin backup
Now run BRU and back up the database files:
bru -cv /database
# After the backup is done, “unfreeze” the database:
alter tablespace name end backup
The above database commands are shown only as an example. They may not work correctly for your particular database. For additional information, refer to your database documentation or contact your database vendor.