All about Oracle User-Managed Database Backups(二)

2014-11-24 14:31:53 · 作者: · 浏览: 1
SQL> ALTER SYSTEM ARCHIVE LOG CURRENT;

To back up online tablespaces in parallel
=========================================
SQL> ALTER DATABASE BEGIN BACKUP;

% cp $ORACLE_HOME/oradata/trgt/*.dbf /disk2/backup/

SQL> ALTER DATABASE END BACKUP;

SQL> ALTER SYSTEM ARCHIVE LOG CURRENT;

Caution: Do not use ALTER DATABASE END BACKUP if you have restored any of the affected files from a backup.
To back up online read-only tablespaces in an open database
===========================================================
SELECT TABLESPACE_NAME, STATUS 
FROM DBA_TABLESPACES
WHERE STATUS = 'READ ONLY';

% cp $ORACLE_HOME/oradata/trgt/history*.dbf  /disk2/backup/

Optionally, export the metadata in the read-only tablespace. Using the transportable tablespace feature
% expdp DIRECTORY=dpump_dir1 DUMPFILE=hs.dmp TRANSPORT_TABLESPACES=history LOGFILE=tts.log
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 ALTER SYSTEM SUSPEND statement with a BEGIN BACKUP statement so that the tablespaces are placed in backup mode.
To make a split mirror backup in SUSPEND mode
=============================================
Place the database tablespaces in backup mode. For example, to place tablespace users in backup mode enter:
ALTER TABLESPACE users BEGIN BACKUP;
If you are backing up all of the tablespaces for your database, you can instead use:
ALTER DATABASE BEGIN BACKUP;
If your mirror system has problems with splitting a mirror while disk writes are occurring, then suspend the database. For example, issue the following:
ALTER SYSTEM SUSPEND;

SELECT DATABASE_STATUS FROM V$INSTANCE;

DATABASE_STATUS 
----------------- 
SUSPENDED 

Split the mirrors at the operating system or hardware level.

ALTER SYSTEM RESUME;

SELECT DATABASE_STATUS FROM V$INSTANCE;

DATABASE_STATUS 
----------------- 
ACTIVE 

ALTER TABLESPACE users END BACKUP;

Copy the control file and archive the online redo logs as usual for a backup.
Making User-Managed Backups to Raw Devices
==========================================
In the following example, you back up from one raw device to another raw device:
% dd if=/dev/rsd1b of=/dev/rsd2b bs=8k skip=8 seek=8 count=3841
In the following example, you back up from a raw device to a file system:
% dd if=/dev/rsd1b of=/backup/df1.dbf bs=8k skip=8 count=3841
In the following example, you back up from a file system to a raw device:
% dd if=/backup/df1.dbf of=/dev/rsd2b bs=8k seek=8
In the following example, you back up from a file system to a file system, and so can set the block size to a high value to boost I/O performance:
% dd if=/oracle/dbs/df1.dbf of=/backup/df1.dbf bs=1024k