0529-0531

Previous Table of Contents Next

Page 529

Shutting Down the Instance

To accomplish a cold backup, you must first shut down the database instance. There are three shutdown methods for an Oracle database: normal, immediate, and abort. Here is a sample shutdown:

 % svrmgrl SVRMGR> connect internal Connected. SVRMGR> shutdown Database closed. Database dismounted. ORACLE instance shut down. 

shutdown normal
When you issue a shutdown, also called a shutdown normal, from within Oracle Server*Manager, the Oracle RDBMS is very patient. In this mode, the database instance ignores further attempts to log into the database and waits for all the currently active sessions to disconnect from the database.

Using shutdown normal is not always the best option for a backup, even though it provides for the cleanest type of shutdown. If a user leaves the office with his workstation still logged in, the backup must wait until he logs out. The next morning, no one can log into the database because Oracle is still waiting to perform a shutdown, and the backup has not yet occurred.

shutdown immediate
A shutdown in the immediate mode is almost identical to a shutdown in the normal mode, with one exception: Oracle has no patience. When you issue a shutdown immediate command, Oracle immediately terminates all the database connections and performs rollback operations on all the outstanding transactions. Checkpoints and buffer flushing are done, and the database is brought down.

For backup operations, shutdown immediate works best, because it deals with users who fail to log off their workstations. Because Oracle performs all the rollback and checkpointing, the database is in a consistent, stable state when the termination occurs.

shutdown abort
The shutdown abort command should be used only as a last resort, and then only when all the other shutdown options have failed. When you use the shutdown abort command, the DBA immediately terminates all the background processes that make up the Oracle database instance, but no rollback, checkpoint, or buffer flushing operations occur before the shutdown. In rare cases, this can lead to corruption of some of the data within the database.

A shutdown abort should not be used to stop the database before backup operations. If shutdown abort is required, the database should be restarted and shut down again in either immediate or normal mode to ensure a stable, consistent view of the database that is acceptable for backup operations.

Page 530

TIP
Two utilities that come with the Oracle RDBMS are dbshut and dbstart. They are generally located in $ORACLE_HOME/bin. The dbstart utility starts all the database instances specified in the /etc/oratab file. The dbshut utility performs a shutdown normal operation on all the instances specified in the /etc/oratab file. These utilities are shell scripts in UNIX. You can copy and edit them to create dbshut.immediate and dbshut.abort utilities to use with backup operations.

Steps in Performing a Cold Backup

A cold backup is the simplest of all backup operations. The steps required are

  1. Shut down the Oracle database instance ”either normal or immediate mode.
  2. Copy all the physical files associated with the database ”control files, redo log files, and database files.
  3. Restart the database when you are done.

Hot Backups

Whereas a cold backup takes a backup of a database in a shutdown state, a hot backup enables you to take a backup of a database that has not been shut down. Hot backups are also referred to as online backups. This is the most tedious backup method, but it is also the most flexible. It enables you to take backups of an active database. It ensures resource availability to end users, and enables the DBA and the operations staff to recover the database.

Cold backups concentrate on copying all the physical files associated with a database instance. Hot backups, on the other hand, concentrate on the tablespace level. To do a hot backup, you must place every individual tablespace into a backup mode (by using the alter tablespace command), copy the physical database files that make up the tablespace, and take the tablespace out of backup mode (by using the alter tablespace command). You can issue these commands from Oracle Server*Manager or SQL*Plus. For example:

 alter tablespace system begin backup; alter tablespace system end backup; 

When you place a tablespace in backup mode, the Oracle instance notes that a backup is being performed and internally compensates for it. As you know, it is impossible to make an authentic copy of a database file that is being written to. On receipt of the command to begin the backup, however, Oracle ceases to make direct changes to the database file. It uses a complex combination of rollback segments, buffers, redo logs, and archive logs to store the data until the end backup command is received and the database files are brought back in sync.

Simplifying a hot backup in this way is tantamount to classifying the USS Nimitz as a boat. The complexity of the actions taken by the Oracle RDBMS under a hot backup could

Page 531

consume an entire chapter and is beyond the scope of this book. What you should understand is that the trade-off for taking a hot backup is increased use of rollback segments, redo logs, archive logs, and internal buffer areas within the SGA.

CAUTION
Don't place all the tablespaces in backup mode, perform the backup, and then take them all out of backup mode. Because of how Oracle handles hot backups, you could experience problems. Instead, you should back up each tablespace as a single unit.

When you run a hot backup, you can restore the data files that compose a single tablespace and apply all the associated redo and archive logs to bring the tablespace back in sync with the database.

NOTE
You must be running the database in Archive Log mode to perform a hot backup. Archive Log mode assures data consistency when backing up only pieces of a database at a time. Remember that the redo logs (which are archived before being overwritten) maintain a record of all database transactions, providing the gap between separate backups of entities with the database.
Steps in Performing a Hot Backup

A hot backup is a complex operation, because each tablespace involves a complete backup operation. It makes sense to break the hot backup into its component parts . The steps in a hot backup are

  1. Place the tablespace in backup mode.
  2. Copy all the database files associated with the tablespace.
  3. Take the tablespace out of backup mode.
  4. Repeat steps 1 through 3 until all the tablespaces have been backed up.
  5. Copy the control file.
  6. Copy the online redo logs.

Oracle Enterprise Manager

Oracle Enterprise Manager provides a more user-friendly interface for conducting backups than does Server*Manager. Using the backup manager utility, the DBA can easily initiate different types of backups, including cold and hot backups and direct backup files to either disk or tape. Review the chapters on Enterprise Manager for more detailed information.

Previous Table of Contents Next


Oracle Unleashed
Oracle Development Unleashed (3rd Edition)
ISBN: 0672315750
EAN: 2147483647
Year: 1997
Pages: 391

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net