Oracle8i Backup and Recovery Guide
Release 2 (8.1.6)

Part Number A76993-01

Library

Product

Contents

Index

Go to previous page Go to next page

4
Performing Operating System Backups

If you do not use Recovery Manager, then you can make backups of your database using operating system utilities and recover datafiles using SQL*Plus. This chapter explains how to use operating system methods to back up an Oracle database, and includes the following topics:

Listing Database Files Before Performing a Backup

Before taking a backup, identify all the files in your database. Then, ascertain what you need to back up.

To list datafiles, online redo logs, and control files:

  1. Start SQL*Plus and query V$DATAFILE to obtain a list of datafiles:

    SELECT name FROM v$datafile;
    
    NAME
    --------------------------------------------------------------------------------
    /oracle/dbs/tbs_01.f
    /oracle/dbs/tbs_02.f
    /oracle/dbs/tbs_03.f
    /oracle/dbs/tbs_11.f
    /oracle/dbs/tbs_12.f
    /oracle/dbs/tbs_21.f
    /oracle/dbs/tbs_22.f
    /oracle/dbs/tbs_23.f
    /oracle/dbs/tbs_24.f
    9 rows selected.
    
    
    

    You can also join the V$TABLESPACE and V$DATAFILE views to obtain a listing of datafiles along with their associated tablespaces:

    SELECT t.name "Tablespace", f.name "Datafile"
      FROM v$tablespace t, v$datafile f
      WHERE t.ts# = f.ts#
      ORDER BY t.name;
        
    Tablespace                     Datafile 
    ---------------------------    --------------------------
    SYSTEM                         /oracle/dbs/tbs_01.f
    SYSTEM                         /oracle/dbs/tbs_02.f 
    SYSTEM                         /oracle/dbs/tbs_03.f
    TBS_1                          /oracle/dbs/tbs_11.f
    TBS_1                          /oracle/dbs/tbs_12.f 
    TBS_2                          /oracle/dbs/tbs_21.f 
    TBS_2                          /oracle/dbs/tbs_22.f 
    TBS_2                          /oracle/dbs/tbs_23.f 
    TBS_2                          /oracle/dbs/tbs_24.f 
    
    
    
  2. Obtain the filenames of online redo log files by using the V$LOGFILE view. For example, issue this query:

    SELECT member FROM v$logfile;
    MEMBER 
    --------------------------------------------------------------------------------
    /oracle/dbs/t1_log1.f 
    /oracle/dbs/t1_log2.f
    2 rows selected.
    
    
  3. Obtain the filenames of the current control files using the CONTROL_FILES parameter. For example, issue this query:

    SELECT value FROM v$parameter 
      WHERE name = 'control_files';
    
    VALUE
    --------------------------------------------------------------------------------
    /oracle/dbs/cf1.f, /oracle/dbs/cf2.f
    
    
    
  4. If you plan to take a control file backup using the ALTER DATABASE statement with the BACKUP CONTROLFILE TO 'filename' option, save a list of all datafiles and online redo log files with the control file backup.

Performing Operating System Backups

While Recovery Manager is the recommended tool for backing up an Oracle database, you can also make backups using operating system utilities. The utility you choose is dependent on your operating system.

This section describes the various aspects of making operating system backups, and includes the following topics:

Performing Whole Database Backups

Take a whole database backup of all files that constitute a database after the database is shut down to system-wide use in normal priority. A whole database backup taken while the database is open or after an instance crash or SHUTDOWN ABORT is inconsistent. In such cases, the files are inconsistent with respect to the checkpoint SCN.

You can take a whole database backup if a database is operating in either ARCHIVELOG or NOARCHIVELOG mode. If you run the database in NOARCHIVELOG mode, however, the backup must be consistent, that is, you must shut down the database cleanly before the backup.

The set of backup files that result from a consistent whole database backup are consistent because all files correspond to the same SCN. You can restore the database without performing recovery. After restoring the backup files, you can perform additional recovery steps to recover the database to a more current time if the database is operated in ARCHIVELOG mode. Also, you can take inconsistent whole database backups if your database is in ARCHIVELOG mode.

Only use a backup control file created during a whole database backup to restore the other files taken in that backup, not for complete or incomplete database recovery. The reason is that Oracle recognizes backup control files created with the ALTER DATABASE BACKUP CONTROLFILE statement as backup control files; operating system copies of control files look like current control files to Oracle. Unless you are making a whole database backup, always back up the control file using a SQL statement.

See Also:

"Performing Control File Backups" for more information about backing up control files. 

Making Consistent Whole Database Backups

To guarantee that a database's datafiles are consistent, shut down the database with the NORMAL, IMMEDIATE, or TRANSACTIONAL options before making a whole database backup. Never perform a whole database backup after an instance failure or after the database is shut down using a SHUTDOWN ABORT statement unless your database is in ARCHIVELOG mode.

To make a consistent whole database backup:

  1. If the database is open, use SQL*Plus to shut down the database with the NORMAL, IMMEDIATE, or TRANSACTIONAL options:

    SHUTDOWN NORMAL
    SHUTDOWN IMMEDIATE
    SHUTDOWN TRANSACTIONAL
    
    
    

    Do not make a whole database backup when the instance is aborted or stopped because of a failure. Reopen the database and shut it down cleanly first.

  2. Use operating system commands or a backup utility to make backups of all datafiles and all control files specified by the CONTROL_FILES parameter of the initialization parameter file. Also back up the initialization parameter file and other Oracle product initialization files. To find them, do a search for *.ora starting in your Oracle home directory and recursively search all of its subdirectories.


    Note:

    If you are forced to perform a restore operation, you must restore the control files to all locations specified in the parameter file. Consequently, it is better to make copies of each multiplexed control file--even if the control files are identical--to avoid problems at restore time. 


    For example, you might back up the datafiles and control files in the /disk1/oracle/dbs directory to /disk2/backup as follows:

    % cp /disk1/oracle/dbs/*.dbf /disk2/backup
    % cp /disk1/oracle/dbs/*.cf /disk2/backup
    
     
    
  3. Restart the database

    STARTUP
    

    See Also:

    Oracle8i Administrator's Guide for more information on starting up and shutting down a database. 

Performing Tablespace and Datafile Backups

Only make tablespace and datafile backups when operating in ARCHIVELOG mode. You cannot use individual datafile backups to restore a database operating in NOARCHIVELOG mode because you do not have archived redo logs to recover the datafiles to the same point in time.

This section contains the topics:

Backing Up Online Tablespaces and Datafiles

You can back up all or specified datafiles of an online tablespace while the database is open. When you back up an individual datafile or online tablespace, Oracle stops recording checkpoints in the headers of the online datafiles being backed up.

The ALTER TABLESPACE BEGIN BACKUP statement puts a tablespace into hot backup mode; as a result, Oracle stops recording checkpoints to the tablespace's datafiles. You must put a tablespace in hot backup mode to make operating system datafile backups when the database is open--except when backing up a read-only tablespace, in which case you can simply back up the online datafiles.

After a hot backup is completed, Oracle advances the file header to the current database checkpoint, but only after you execute the ALTER TABLESPACE END BACKUP statement to take the tablespace out of hot backup mode.

When you restore a datafile, the header has a record of the most recent datafile checkpoint that occurred before the online tablespace backup, not any that occurred during it. As a result, Oracle asks for the appropriate set of redo log files to apply should recovery be needed.

To back up online read-write tablespaces in an open database:

  1. Before beginning a backup of a tablespace, identify all of the tablespace's datafiles using the DBA_DATA_FILES data dictionary view. For example, assume that you want to back up the USERS tablespace. Enter the following:

    SELECT tablespace_name, file_name
    FROM sys.dba_data_files
    WHERE tablespace_name = 'USERS';
     
    TABLESPACE_NAME                     FILE_NAME
    -------------------------------   --------------------
    USERS                             /oracle/dbs/tbs_21.f
    USERS                             /oracle/dbs/tbs_22.f
    
    
    

    In this example, /oracle/dbs/tbs_21.f and /oracle/dbs/tbs_22.f are fully specified filenames corresponding to the datafiles of the USERS tablespace.

  2. Mark the beginning of the online tablespace backup. For example, the following statement marks the start of an online backup for the tablespace USERS:

    ALTER TABLESPACE users BEGIN BACKUP;
    


    WARNING:

    If you forget to mark the beginning of an online tablespace backup, or neglect to assure that the BEGIN BACKUP statement has completed before backing up an online tablespace, then the backup datafiles are not useful for subsequent recovery operations. Attempting to recover such a backup is risky and can return errors that result in inconsistent data. For example, the attempted recovery operation will issue a "fuzzy files" warning, and lead to an inconsistent database that will not open. 


  3. Back up the online datafiles of the online tablespace using operating system commands. For example, UNIX users might enter:

    % cp /oracle/dbs/tbs_21.f /oracle/backup/tbs_21.backup
    % cp /oracle/dbs/tbs_22.f /oracle/backup/tbs_22.backup
    
    
    
  4. After backing up the datafiles of the online tablespace, indicate the end of the online backup using the SQL statement ALTER TABLESPACE with the END BACKUP option. For example, the following statement ends the online backup of the tablespace USERS:

    ALTER TABLESPACE users END BACKUP;
    
    
    

If you forget to mark the end of an online tablespace backup, and an instance failure or SHUTDOWN ABORT occurs, then Oracle assumes that media recovery (possibly requiring archived redo logs) is necessary at the next instance startup. To avoid performing media recovery in this case, use the following statement, where filename is any valid system path name:

ALTER DATABASE DATAFILE filename END BACKUP;
To back up online read-only tablespaces in an open database:

  1. Before beginning a backup of a read-only tablespace, identify all of the tablespace's datafiles using the DBA_DATA_FILES data dictionary view. For example, assume that you want to back up the USERS tablespace. Enter the following:

    SELECT tablespace_name, file_name
    FROM sys.dba_data_files
    WHERE tablespace_name = 'USERS';
     
    TABLESPACE_NAME                     FILE_NAME
    -------------------------------   --------------------
    USERS                             /oracle/dbs/tbs_21.f
    USERS                             /oracle/dbs/tbs_22.f
    
    
    

    In this example, /oracle/dbs/tbs_21.f and /oracle/dbs/tbs_22.f are fully specified filenames corresponding to the datafiles of the USERS tablespace.

  2. Back up the online datafiles of the online tablespace using operating system commands. You do not have to take the tablespace offline or put the tablespace in hot backup mode because users are automatically prevented from making changes to the read-only tablespace. For example, UNIX users can enter:

    % cp /oracle/dbs/tbs_21.f /oracle/backup/tbs_21.backup
    % cp /oracle/dbs/tbs_22.f /oracle/backup/tbs_22.backup
    


    Note:

    When restoring a backup of a read-only tablespace, take the tablespace offline, restore the datafiles, then bring the tablespace online. A backup of a read-only tablespace is still usable if the read-only tablespace is made read-write after the backup, but the restored backup will require recovery. 


    See Also:

    Oracle8i Reference for more information about the DBA_DATA_FILES data dictionary view, and SQL*Plus User's Guide and Reference for more information about startup and shutdown statements. 

Determining Datafile Backup Status

To check the backup status of a datafile, query the V$BACKUP view. This view lists all online files and gives their backup status. It is most useful when the database is open. It is also useful immediately after a crash, because it shows the backup status of the files at the time of the crash. Use this information to determine whether you have left tablespaces in hot backup mode.

V$BACKUP is not useful if the control file currently in use is a restored backup or a new control file created after the media failure occurred. A restored or re-created control file does not contain the information Oracle needs to fill V$BACKUP accurately. Also, if you have restored a backup of a file, this file's STATUS in V$BACKUP reflects the backup status of the older version of the file, not the most current version. Thus, this view can contain misleading information about restored files.

For example, the following query displays the current backup status of datafiles:

SELECT file#, status FROM v$backup;

FILE#        STATUS
---------   ---------
0011         INACTIVE
0012         INACTIVE
0013         ACTIVE
...

In the STATUS column, INACTIVE indicates that the file is not currently being backed up, whereas ACTIVE indicates that the file is currently being backed up.

Backing Up Multiple Online Tablespaces

When backing up several online tablespaces, use either of the following procedures:

To back up online tablespaces in parallel:

  1. Prepare all online tablespaces for backup by issuing all necessary ALTER TABLESPACE statements at once. For example, put tablespaces TS1, TS2, and TS3 in hot backup mode:

    ALTER TABLESPACE ts1 BEGIN BACKUP;
    ALTER TABLESPACE ts2 BEGIN BACKUP;
    ALTER TABLESPACE ts3 BEGIN BACKUP;
    
    
    
  2. Back up all files of the online tablespaces. For example, a UNIX user might back up tbs_1.f, tbs_2.f, and tbs_3.f as follows:

    % cp /oracle/dbs/tbs_1.f /oracle/backup/tbs_1.bak
    % cp /oracle/dbs/tbs_2.f /oracle/backup/tbs_2.bak
    % cp /oracle/dbs/tbs_3.f /oracle/backup/tbs_3.bak
    
    
    
  3. Indicate that the online backups have been completed:

    ALTER TABLESPACE ts1 END BACKUP;
    ALTER TABLESPACE ts2 END BACKUP;
    ALTER TABLESPACE ts3 END BACKUP;
    
To back up online tablespaces serially:

  1. Prepare a tablespace for online backup. For example, to put tablespace TBS_1 in hot backup mode enter:

    SQL> ALTER TABLESPACE tbs_1 BEGIN BACKUP;
    
    
  2. Back up the datafiles in the tablespace. For example, enter:

    % cp /oracle/dbs/tbs_1.f /oracle/backup/tbs_1.bak
    
    
  3. Take the tablespace out of hot backup mode. For example, enter:

    SQL> ALTER TABLESPACE tbs_1 END BACKUP;
    
    
    
  4. Repeat this procedure for each remaining tablespace until you have backed up all the desired tablespaces.

Oracle recommends the serial option because it minimizes the time between ALTER TABLESPACE ... BEGIN/END BACKUP statements. During online backups, more redo information is generated for the tablespace.

Making Backups in SUSPEND Mode

Some third-party tools allow you to mirror a set of disks or logical devices, that is, maintain an exact duplicate of the primary data in another location, and then split the mirror. Splitting the mirror involves separating the copies so that you can use them independently.

Using the Oracle8i SUSPEND/RESUME functionality, you can suspend I/O to the database, then split the mirror and make a backup of the split mirror. This feature, which complements the hot backup functionality, allows you to quiesce the database so that no new I/O can be performed. You can then access the suspended database to make backups without I/O interference.


Note:

Some RAID devices benefit from suspending writes while the split operation is occurring; your RAID vendor can advise you on whether your system would benefit from this feature. 


Understanding the Suspend/Resume Feature

The ALTER SYSTEM SUSPEND statement suspends the database by halting I/Os to datafile headers and data as well as control files. When the database is suspended, all pre-existing I/O operations can complete; however, any new database access attempts are queued.

The SUSPEND and RESUME statements operate on the database and not just the instance. If the SUSPEND statement is entered on one system in an OPS configuration, then the internal locking mechanisms propagate the halt request across instances, thereby quiescing all active instances in a given cluster.

Making Backups in a Suspended Database

After a successful database suspension, you can back up the database to disk or break the mirrors. Because suspending a database does not guarantee immediate termination of I/O, Oracle recommends that you precede the SUSPEND statement with a BEGIN BACKUP statement to place the tablespaces in hot backup mode.

You must use conventional operating system backup methods to back up split mirrors. RMAN cannot make database backups or copies because these operations require reading the datafile headers. After the database backup is finished or the mirrors are re-silvered, then you can resume normal database operations using the RESUME statement.

Backing up a suspended database without splitting mirrors can cause an extended database outage because the database is inaccessible during this time. If backups are taken by splitting mirrors, however, then the outage is nominal. The outage time depends on the size of cache to flush, the number of datafiles, and the time required to break the mirror.

Note the following restrictions:

To make a split mirror backup in SUSPEND mode:

  1. Place the database tablespaces in hot backup mode using the ALTER TABLESPACE ... BEGIN BACKUP statement. For example, to place tablespace USERS in hot backup mode enter:

    ALTER TABLESPACE users BEGIN BACKUP;
    
    
    
  2. If your mirror system has problems with splitting a mirror while disk writes are occurring, issue the following:

    ALTER SYSTEM SUSPEND;
    
    
  3. Check to make sure that the database is suspended:

    SELECT database_status FROM v$instance;
    
    DATABASE_STATUS 
    ----------------- 
    SUSPENDED 
    
    
    
  4. Split the mirrors at the operating system or hardware level.

  5. Issue the following:

    ALTER SYSTEM RESUME;
    
    
  6. Check to make sure that the database is active:

    SELECT database_status FROM v$instance;
    
    DATABASE_STATUS 
    ----------------- 
    ACTIVE 
    
    
    
  7. Take the specified tablespaces out of hot backup mode. For example, to take tablespace USERS out of hot backup mode enter:

    ALTER TABLESPACE users END BACKUP;
    
    
    
  8. Copy the control file and archive the online redo logs as usual for a backup.


    WARNING:

    Do not use the SUSPEND statement as a substitute for placing a tablespace in hot backup mode. 


    See Also:

    Oracle8i Administrator's Guide for more information about the SUSPEND/RESUME feature, Oracle8i SQL Reference for more information about the ALTER SYSTEM statement with the RESUME and SUSPEND options. 

Backing Up Offline Tablespaces and Datafiles

You can back up all or some of the datafiles of an individual tablespace while the tablespace is offline. All other tablespaces of the database can remain open and available for system-wide use. You must have the MANAGE TABLESPACE system privilege to take tablespaces offline and online.


Note:

You cannot take the SYSTEM tablespace or any tablespace with active rollback segments offline. The following procedure cannot be used for such tablespaces. 


To back up offline tablespaces:

  1. Before beginning a backup of a tablespace, identify the tablespace's datafiles using the DBA_DATA_FILES table. For example, assume that you want to back up the USERS tablespace. Enter the following:

    SELECT tablespace_name, file_name
    FROM sys.dba_data_files
    WHERE tablespace_name = 'USERS';
     
    TABLESPACE_NAME                     FILE_NAME
    -------------------------------   -----------------
    USERS                              /oracle/dbs/users.f
    
    
    

    In this example, /oracle/dbs/users.f is a fully specified filename corresponding to the datafile in the USERS tablespace.

  2. Take the tablespace offline using normal priority if possible. Normal priority is recommended because it guarantees that you can subsequently bring the tablespace online without the requirement for tablespace recovery. For example, the following statement takes a tablespace named USERS offline normally:

    ALTER TABLESPACE users OFFLINE NORMAL;
    
    
    

    After you take a tablespace offline with normal priority, all datafiles of the tablespace are closed.

  3. Back up the offline datafiles. For example, a UNIX user might enter the following to back up datafile users.f:

    % cp /disk1/oracle/dbs/users.f /disk2/backup/users.backup
    
    
    
  4. Bring the tablespace online. For example, the following statement brings tablespace USERS back online:

    ALTER TABLESPACE users ONLINE;
    


    Note:

    If you took the tablespace offline using temporary or immediate priority, then you must not bring the tablespace online unless you perform tablespace recovery. 


    After you bring a tablespace online, it is open and available for use.

Performing Control File Backups

Back up the control file of a database after making a structural modification to a database operating in ARCHIVELOG mode. To back up a database's control file, you must have the ALTER DATABASE system privilege.

You have these options when backing up the control file:

Backing Up the Control File to a Physical File

The primary method for backing up the control file is to use a SQL statement to generate a binary file.

To back up the control file after a structural change:

  1. Make the desired change to the database. For example, you might create a new datafile:

    ALTER DATABASE CREATE DATAFILE '/oracle/dbs/tbs_20.f' AS '/oracle/dbs/tbs_4.f';
    
    
    
  2. Back up the database's control file. The following SQL statement backs up a database's control file to /oracle/backup/cf.bak:

    ALTER DATABASE BACKUP CONTROLFILE TO '/oracle/backup/cf.bak' REUSE;
    
    
    

    The REUSE option allows you to have the new control file overwrite a control file that currently exists.

Backing Up the Control File to a Trace File

The TRACE option of the ALTER DATABASE BACKUP CONTROLFILE statement helps you manage and recover your control file. The TRACE option prompts Oracle to write SQL statements to the database's trace file rather than generate a physical backup. The statements in the trace file start the database, re-create the control file, and recover and open the database appropriately.

Each SQL statement in the trace file is commented. Thus, you can copy the statements from the trace file into a script file, edit them as necessary, and use the script to recover the database if all copies of the control file are lost (or to change the value of control file parameters such as MAXDATAFILES). The trace file is located in the location specified by the USER_DUMP_DEST initialization parameter.

To back up the control file to a trace file, mount the database and issue the following statement:

ALTER DATABASE BACKUP CONTROLFILE TO TRACE;
Creating a Trace File: Scenario

Assume that you want to generate a script that re-creates the control file for the SALES database. The database has these characteristics:

You issue the following statement to create the trace file:

ALTER DATABASE BACKUP CONTROLFILE TO TRACE NORESETLOGS;

You then edit the trace file to create a script that creates a new control file based on the control file that was current when you generated the trace file. To avoid recovering offline normal or read-only tablespaces, omit them from the CREATE CONTROLFILE statement. At database open time, the dictionary check code will mark these files as MISSING. The RENAME statement renames them back to their filenames.

For example, the script might read as follows:

# The following statements will create a new control file and use it to open the database.
# No data other than log history will be lost. Additional logs may be required for media 
# recovery of offline datafiles. Use this only if the current version of all online logs 
# are available.

STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE SALES NORESETLOGS ARCHIVELOG
     MAXLOGFILES 32
     MAXLOGMEMBERS 2
     MAXDATAFILES 32
     MAXINSTANCES 16
     MAXLOGHISTORY 1600
LOGFILE
     GROUP 1
       '/diska/prod/sales/db/log1t1.dbf',
       '/diskb/prod/sales/db/log1t2.dbf'
     )  SIZE 100K
    GROUP 2 
       '/diska/prod/sales/db/log2t1.dbf',
        '/diskb/prod/sales/db/log2t2.dbf'
    ) SIZE 100K,
    GROUP 3 
       '/diska/prod/sales/db/log3t1.dbf',
       '/diskb/prod/sales/db/log3t2.dbf'
    ) SIZE 100K
DATAFILE
    '/diska/prod/sales/db/database1.dbf',
    '/diskb/prod/sales/db/filea.dbf'
;

# This datafile is offline, but its tablespace is online. Take the datafile offline 
# manually.
ALTER DATABASE DATAFILE '/diska/prod/sales/db/filea.dbf' OFFLINE;

# Recovery is required if any datafiles are restored backups,
# or if the most recent shutdown was not normal or immediate.
RECOVER DATABASE;

# All redo logs need archiving and a log switch is needed.
ALTER SYSTEM ARCHIVE LOG ALL;

# The database can now be opened normally.
ALTER DATABASE OPEN;

# The backup control file does not list read-only and normal offline tablespaces so that 
# Oracle can avoid performing recovery on them. Oracle checks the data dictionary and 
# finds information on these absent files and marks them 'MISSINGxxxx'. It then renames 
# the missing files to acknowledge them without having to recover them.
ALTER DATABASE RENAME FILE 'MISSING0002'
     TO '/diska/prod/sales/db/fileb.dbf';

Using the statement without NORESETLOGS produces the same output. Using the statement with RESETLOGS produces a similar script that includes statements that recover and open the database, but resets the redo logs upon startup.

Verifying Backups

You should periodically verify your backups to ensure that they are usable for recovery. This section contains the following topics:

Testing the Restore of Backups

The best way to test the usability of backups is to restore them to a separate host and attempt to open the database, performing media recovery if necessary. This option requires that you have a separate computer available for the restore procedure.

See Also:

"Restoring Files" to learn how to restore files, and "Performing Complete Media Recovery" to learn how to recover files. 

Using the DBVERIFY Utility

DBVERIFY is an external command-line utility that performs a physical data structure integrity check on an offline database. Use DBVERIFY primarily when you need to ensure that a backup database or datafile is valid before it is restored or as a diagnostic aid when you have encountered data corruption problems.

The name and location of DBVERIFY is dependent on your operating system. For example, to perform an integrity check on datafile tbs_52.f on UNIX, you can execute the dbv command as follows:

% dbv file=tbs_52.f

DBVERIFY: Release 8.1.5.0.0

(c) Copyright 1998 Oracle Corporation.  All rights reserved.

DBVERIFY - Verification starting : FILE = tbs_52.f

DBVERIFY - Verification complete

Total Pages Examined         : 250
Total Pages Processed (Data) : 4
Total Pages Failing   (Data) : 0
Total Pages Processed (Index): 15
Total Pages Failing   (Index): 0
Total Pages Processed (Other): 29
Total Pages Empty            : 202
Total Pages Marked Corrupt   : 0
Total Pages Influx           : 0

See Also:

Oracle8i Utilities for more information about using DBVERIFY. 

Responding to a Failed Online Tablespace Backup

The following situations can cause a tablespace backup to fail and be incomplete:

Upon detecting an incomplete online tablespace backup at startup, Oracle assumes that media recovery is necessary for startup to proceed.

For example, Oracle may display:

SQL> startup
ORACLE instance started.
Total System Global Area                         19839308 bytes
Fixed Size                                          63820 bytes
Variable Size                                    11042816 bytes
Database Buffers                                  8192000 bytes
Redo Buffers                                       540672 bytes
Database mounted.
ORA-01113: file 12 needs media recovery
ORA-01110: data file 12: '/oracle/dbs/tbs_41.f'
To avoid performing media recovery on a tablespace:

  1. Use the V$BACKUP view to list the datafiles of the tablespaces that were being backed up before the database was restarted:

    SQL>  SELECT * FROM v$backup WHERE status = 'ACTIVE';
    FILE#      STATUS             CHANGE#    TIME     
    ---------- ------------------ ---------- ---------
             12 ACTIVE                  20863 25-NOV-98
             13 ACTIVE                  20863 25-NOV-98
             20 ACTIVE                  20863 25-NOV-98
     3 rows selected.
    
    
    
  2. Issue the ALTER DATABASE DATAFILE ... END BACKUP statement to end the hot backup. For example, to take datafiles 12, 13, and 20 out of hot backup mode enter:

    ALTER DATABASE DATAFILE 12,13,20 END BACKUP;
    


    WARNING:

    Do not use ALTER DATABASE DATAFILE ... END BACKUP if you have restored any of the affected files from a backup. 


  3. Open the database:

    ALTER DATABASE OPEN;
    
To recover the database without using the END BACKUP statement:

  1. Mount the database:

    STARTUP MOUNT;
    
    
    
  2. Recover the database:

    RECOVER DATABASE;
    
    
    
  3. Use the V$BACKUP view to confirm that there are no active datafiles:

    SQL>  SELECT * FROM v$backup WHERE status = 'ACTIVE';
    FILE#      STATUS             CHANGE#    TIME     
    ---------- ------------------ ---------- ---------
    0 rows selected.
    

    See Also:

    Chapter 5, "Performing Media Recovery" for information on recovering a database. 

Using Export and Import for Supplemental Protection

Export and Import are utilities that move Oracle data in and out of Oracle databases. Export writes data from an Oracle database to an operating system file in a special binary format. Import reads Export files and restores the corresponding information into an existing database. Although Export and Import are designed for moving Oracle data, you can also use them to supplement backups of data.

This section describes the Import and Export utilities, and includes the following topics:

Using Export

The Export utility allows you to back up your database while it is open and available for use. It writes a read-consistent view of the database's objects to an operating system file. System audit options are not exported.


WARNING:

If you use Export to perform a backup, you must export all data in a logically consistent way so that the backup reflects a single point in time. No one should make changes to the database while the Export takes place. Ideally, you should run the database in restricted mode while you export the data, so no regular users can access the data. 


Table 4-1 lists available export modes.

Table 4-1 Export Modes 
Mode  Description 

User 

Exports all objects owned by a user. 

Table 

Exports all or specific tables owned by a user. 

Full Database 

Exports all objects of the database. 

Following are descriptions of Export types:

Incremental Export

Only database data that has changed since the last incremental, cumulative, or complete export is exported. An incremental export exports the object's definition and all its data. Incremental exports are typically performed more often than cumulative or complete reports.

For example, if tables A, B, and C exist, and only table A's information has been modified since the last incremental export, only table A is exported. 

Cumulative Exports 

Only database data that has been changed since the last cumulative or complete export is exported. 

 

Perform this type of export on a limited basis, such as once a week, to condense the information contained in numerous incremental exports. 

 

For example, if tables A, B, and C exist, and only table A's and table B's information has been modified since the last cumulative export, only the changes to tables A and B are exported. 

Complete Exports 

All database data is exported. 

 

Perform this type of export on a limited basis, such as once a month, to export all data contained in a database. 

Using Import

The Import utility allows you to restore the database information held in previously created Export files. It is the complement utility to Export.

To recover a database using Export files and the Import utility:

  1. Re-create the database structure, including all tablespaces and users.


    Note:

    These re-created structures should not have objects in them. 


  2. Import the appropriate Export files to restore the database to the most current state possible. Depending on how your Export schedule is performed, imports of varying degrees will be necessary to restore a database.

Assume that the schedule illustrated in Figure 4-1 is used in exporting data from an Oracle database

Figure 4-1 A Typical Export Schedule


Text description of osbackua.gif follows.

Text description of the illustration osbackua.gif.

A complete export was taken on Day 1, a cumulative export was taken every week, and incremental exports were taken daily. Follow these steps to recover:

  1. Recreate the database, including all tablespaces and users.

  2. Import the complete database export taken on Day 1.

  3. Import the cumulative database export taken on Day 7.

  4. Import the incremental database exports taken on Days 8, 9, and 10.


Go to previous page Go to next page
Oracle
Copyright © 1996-2000, Oracle Corporation.

All Rights Reserved.

Library

Product

Contents

Index