ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Cataloging a User-Managed Copy

Cataloging a User-Managed Copy

原创 Linux操作系统 作者:paulyibinyi 时间:2007-12-25 17:40:26 0 删除 编辑

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
恢复成功

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7199859/viewspace-1321/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
学习数据库

注册时间:2007-12-11

  • 博文量
    902
  • 访问量
    6577006