To catalog a user-managed copy:
E)xr#r9\3H-wn7A
Rx&n01. Make a copy with an operating system utility. Note that ALTER TABLESPACE
T'O`(pf
tU0BEGIN/END BACKUP is necessary if the database is open and the datafiles areITPUB个人空间Z!M(E
r"^
online while the backup is in progress. This example backs up an online
I/L
n0ks4G0datafile.
i%L:D.N*Aa*CjY Y0SQL> ALTER TALBESPACE users BEGIN BACKUP;
A#Q\V1M0% cp $ORACLE_HOME/oradata/trgt/users01.dbf /tmp/users01.dbf;
L _H2w+At0SQL> ALTER TABLESPACE users END BACKUP;ITPUB个人空间 dO6a)gS-V(j@'D;]
2. After connecting to the target database and, if desired, the recovery catalog, runITPUB个人空间o1b)l@\ {8tx6J
the CATALOG command. For example, enter:
q0hw(D"f0CATALOG 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.
ITPUB个人空间9HT1{/a#}9UP
Connected to:ITPUB个人空间y0S7kPj aX
Oracle9i Enterprise Edition Release 9.2.0.4.0 - ProductionITPUB个人空间l[`DY1l
With the Partitioning, OLAP and Oracle Data Mining optionsITPUB个人空间wC h.I n-D1[
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;ITPUB个人空间j5u&{%N.A
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
w+eB'q0b5y0ORACLE instance started.
Total System Global Area 101785252 bytesITPUB个人空间6@-J`_UZ c/O,Cs
Fixed Size 454308 bytesITPUB个人空间 l @ \'RPe
Variable Size 75497472 bytes
"wUh^1I+w{zk0Database Buffers 25165824 bytes
$RzeNF3}:E/M0Redo Buffers 667648 bytes
4Fb pc5Br$M#eX,ifw0Database mounted.
u+mkIP
F~U%n0SQL> exitITPUB个人空间9QtY?a1IB:zj4o
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
4J/Z@
awpL0With the Partitioning, OLAP and Oracle Data Mining options
+S)mk%r#FQ0JServer Release 9.2.0.4.0 - Production
C:\Documents and Settings\Paul Yi>rman target / catalogpaultest/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)
"C8i
u u8X,^9T{
vk0connected to recovery catalog database
RMAN> catalog datafilecopy 'd:\tools01.dbf';
cataloged datafile copyITPUB个人空间Rj
t;C_9rtS0W
datafile copy filename=D:\TOOLS01.DBF recid=20 stamp=642275380
RMAN> restore datafile 4;
Starting restore at 25-DEC-07
allocated channel: ORA_DISK_1ITPUB个人空间(L2v/Uf:bG9Fy;V
channel ORA_DISK_1: sid=11 devtype=DISKITPUB个人空间 C$a,of,}
A.];z6`
channel ORA_DISK_1: restoring datafile 00004ITPUB个人空间$^3OjK](L)r*m#I
input datafilecopy recid=20 stamp=642275380 filename=D:\TOOLS01.DBF
a*~5jaPU6t m*g0destination for restore of datafile 00004: D:\ORACLE\ORADATA\PAUL\TOOLS01.DBFITPUB个人空间 N~:NN*m0O5y0]bE
channel ORA_DISK_1: copied datafilecopy of datafile 00004
UY7l4{4M)p.f0output filename=D:\ORACLE\ORADATA\PAUL\TOOLS01.DBF recid=21 stamp=642275403ITPUB个人空间
T M3N
A3f4Ej
Finished restore at 25-DEC-07
RMAN> recover datafile 4;
Starting recover at 25-DEC-07ITPUB个人空间
_A
o5qkH+f%Z
using channel ORA_DISK_1
starting media recovery
nb.aAko9R~z0media recovery complete
Finished recover at 25-DEC-07
RMAN> alter database open;
database opened
SQL> desc test;
z-EG9dn%HO0 Name Null? TypeITPUB个人空间|X'~S+E%T)e\
----------------------------------------- -------- ---------------------------
ID NUMBER
HYpW3[%]0恢复成功