To catalog a user-managed copy:
1. Make a copy with an operating system utility. Note that ALTER TABLESPACE
BEGIN/END BACKUP is necessary if the database is open and the datafiles are
online while the backup is in progress. This example backs up an online
datafile.
SQL> ALTER TALBESPACE users BEGIN BACKUP;
% cp $ORACLE_HOME/oradata/trgt/users01.dbf /tmp/users01.dbf;
SQL> ALTER TABLESPACE users END BACKUP;
2. After connecting to the target database and, if desired, the recovery catalog, run
the CATALOG command. For example, enter:
CATALOG DATAFILECOPY '/tmp/users01.dbf';
测试如下:
C:\Documents and Settings\Paul Yi>sqlplus "/as sysdba"
SQL*Plus: Release 9.2.0.4.0 - Production on Tue Dec 25 17:43:11 2007
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
SQL> alter tablespace tools begin backup;
Tablespace altered.
cp d:\oracle\oradata\paul\tools01.dbf 到 d:\tools01.dbf
SQL> alter tablespace tools end backup;
Tablespace altered.
SQL> drop table test;
Table dropped.
SQL> create table test (id number) tablespace tools;
Table created.
SQL> shutdown abort;
ORACLE instance shut down.
删除 d:\oracle\oradata\paul\tools01.dbf 文件
C:\Documents and Settings\Paul Yi>sqlplus "/as sysdba"
SQL*Plus: Release 9.2.0.4.0 - Production on Tue Dec 25 17:49:11 2007
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to an idle instance.
SQL> startup mount
ORACLE instance started.
Total System Global Area 101785252 bytes
Fixed Size 454308 bytes
Variable Size 75497472 bytes
Database Buffers 25165824 bytes
Redo Buffers 667648 bytes
Database mounted.
SQL> exit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
C:\Documents and Settings\Paul Yi>rman target / catalog paultest/paultest@dev89
Recovery Manager: Release 9.2.0.4.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
connected to target database: PAUL (DBID=1605165889)
connected to recovery catalog database
RMAN> catalog datafilecopy 'd:\tools01.dbf';
cataloged datafile copy
datafile copy filename=D:\TOOLS01.DBF recid=20 stamp=642275380
RMAN> restore datafile 4;
Starting restore at 25-DEC-07
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=11 devtype=DISK
channel ORA_DISK_1: restoring datafile 00004
input datafilecopy recid=20 stamp=642275380 filename=D:\TOOLS01.DBF
destination for restore of datafile 00004: D:\ORACLE\ORADATA\PAUL\TOOLS01.DBF
channel ORA_DISK_1: copied datafilecopy of datafile 00004
output filename=D:\ORACLE\ORADATA\PAUL\TOOLS01.DBF recid=21 stamp=642275403
Finished restore at 25-DEC-07
RMAN> recover datafile 4;
Starting recover at 25-DEC-07
using channel ORA_DISK_1
starting media recovery
media recovery complete
Finished recover at 25-DEC-07
RMAN> alter database open;
database opened
SQL> desc test;
Name Null? Type
----------------------------------------- -------- ---------------------------
ID NUMBER
恢复成功