rman中copy 功能使用

一. COPY功能使用

1.COPY DATABASE

RMAN> backup as copy database format ‘/u01/orabak/whole_db_cp_%s_%t.bak’;

Starting backup at 20090910062411
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=28 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=/oradata/ora11g/system01.dbf
output file name=/u01/orabak/whole_db_cp_7_697184653.bak tag=TAG20090910T062412 RECID=2 STAMP=697184738
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:25
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=/oradata/ora11g/sysaux01.dbf
output file name=/u01/orabak/whole_db_cp_8_697184738.bak tag=TAG20090910T062412 RECID=3 STAMP=697184794
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:06
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=/oradata/ora11g/undotbs01.dbf
output file name=/u01/orabak/whole_db_cp_9_697184804.bak tag=TAG20090910T062412 RECID=4 STAMP=697184821
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting datafile copy
input datafile file number=00005 name=/u01/oradata/ts01.dbf
output file name=/u01/orabak/whole_db_cp_10_697184831.bak tag=TAG20090910T062412 RECID=5 STAMP=697184831
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting datafile copy
copying current control file
output file name=/u01/orabak/whole_db_cp_11_697184832.bak tag=TAG20090910T062412 RECID=6 STAMP=697184833
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=/u01/oradata/users01.dbf
output file name=/u01/orabak/whole_db_cp_12_697184835.bak tag=TAG20090910T062412 RECID=7 STAMP=697184835
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 20090910062716
channel ORA_DISK_1: finished piece 1 at 20090910062717
piece handle=/u01/orabak/whole_db_cp_13_697184836.bak tag=TAG20090910T062412 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 20090910062717

RMAN> list copy;

specification does not match any archived log in the repository
List of Datafile Copies
=======================

Key     File S Completion Time Ckp SCN    Ckp Time
——- —- – ————— ———- —————
2       1    A 20090910062538  295555     20090910062413
Name: /u01/orabak/whole_db_cp_7_697184653.bak
Tag: TAG20090910T062412

3       2    A 20090910062634  295591     20090910062538
Name: /u01/orabak/whole_db_cp_8_697184738.bak
Tag: TAG20090910T062412

4       3    A 20090910062701  295635     20090910062645
Name: /u01/orabak/whole_db_cp_9_697184804.bak
Tag: TAG20090910T062412

7       4    A 20090910062715  295675     20090910062715
Name: /u01/orabak/whole_db_cp_12_697184835.bak
Tag: TAG20090910T062412

5       5    A 20090910062711  295673     20090910062711
Name: /u01/orabak/whole_db_cp_10_697184831.bak
Tag: TAG20090910T062412

List of Control File Copies
===========================

Key     S Completion Time Ckp SCN    Ckp Time
——- – ————— ———- —————
6       A 20090910062713  295673     20090910062711
Name: /u01/orabak/whole_db_cp_11_697184832.bak
Tag: TAG20090910T062412

1       A 20090910062203  295191     20090910062202
Name: /u01/orabak/whole_db_cp_5_697184523.bak
Tag: TAG20090910T062201

2.COPY TABLESPACE

RMAN> backup as copy tablespace ts01 format ‘/u03/ts01_cp.bak’;

Starting backup at 20090925094600
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00006 name=/u01/oracle11gr2/oradata/ora11g/ts01.dbf
output file name=/u03/ts01_cp.bak tag=TAG20090925T094600 RECID=47 STAMP=698492760
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 20090925094601

3.COPY DATAFILES

RMAN> backup as copy datafile 4 ,5 format ‘/u01/orabak/df_4_5_%s_%t.bak’;

Starting backup at 20090910065044
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00005 name=/u01/oradata/ts01.dbf
output file name=/u01/orabak/df_4_5_19_697186244.bak tag=TAG20090910T065044 RECID=12 STAMP=697186245
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=/u01/oradata/users01.dbf
output file name=/u01/orabak/df_4_5_20_697186245.bak tag=TAG20090910T065044 RECID=13 STAMP=697186246
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 20090910065046

RMAN> copy datafile 4 to ‘/u01/orabak/datafile_4.bak’;

Starting backup at 20090910065225
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=/u01/oradata/users01.dbf
output file name=/u01/orabak/datafile_4.bak tag=TAG20090910T065225 RECID=14 STAMP=697186345
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 20090910065226

RMAN> backup as copy datafile 4 format ‘/u01/orabak/datafile_4_1.bak’;

Starting backup at 20090910065308
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=/u01/oradata/users01.dbf
output file name=/u01/orabak/datafile_4_1.bak tag=TAG20090910T065309 RECID=15 STAMP=697186389
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 20090910065310

另外,rman中的copy可以直接将raw device拷贝成file-system的数据文件,这也是一个不错的功能。

二.COPY与BACKUP比较

ROOTDBA@ora11g>create table t_cp tablespace ts01 as select * from dba_objects;

Table created.

Elapsed: 00:00:00.47
ROOTDBA@ora11g>insert into t_cp select * from t_cp;

18185 rows created.

Elapsed: 00:00:00.08
ROOTDBA@ora11g>r
1* insert into t_cp select * from t_cp
insert into t_cp select * from t_cp
*
ERROR at line 1:
ORA-01653: unable to extend table ROOTDBA.T_CP by 128 in tablespace TS01

Elapsed: 00:00:00.03
ROOTDBA@ora11g>commit;

ROOTDBA@ora11g>truncate table t_cp ;

Table truncated.

Elapsed: 00:00:00.16
ROOTDBA@ora11g>select segment_name,bytes/1024/1024 from user_segments where segment_name=’T_CP’;

SEGMENT_NAME                   BYTES/1024/1024
—————————— —————
T_CP                                     .0625

RMAN> backup datafile 6 format ‘/u03/df_6_bk_trunc.bak’;

Starting backup at 20090925093253
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00006 name=/u01/oracle11gr2/oradata/ora11g/ts01.dbf
channel ORA_DISK_1: starting piece 1 at 20090925093253
channel ORA_DISK_1: finished piece 1 at 20090925093254
piece handle=/u03/df_6_bk_trunc.bak tag=TAG20090925T093253 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 20090925093254

RMAN> copy datafile 6 to ‘/u03/df_6_cp_trunc.bak’;

Starting backup at 20090925093330
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00006 name=/u01/oracle11gr2/oradata/ora11g/ts01.dbf
output file name=/u03/df_6_cp_trunc.bak tag=TAG20090925T093330 RECID=45 STAMP=698492010
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 20090925093331

RMAN> backup as copy datafile 6 format ‘/u03/df_6_as_trunc.bak’;

Starting backup at 20090925093348
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00006 name=/u01/oracle11gr2/oradata/ora11g/ts01.dbf
output file name=/u03/df_6_as_trunc.bak tag=TAG20090925T093348 RECID=46 STAMP=698492028
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 20090925093349

oracle@dbatest1:/u03 #ls -lrth
-rw-r—– 1 oracle dba 1.6M Sep 25 09:32 df_6_bk_trunc.bak
-rw-r—– 1 oracle dba 5.1M Sep 25 09:33 df_6_cp_trunc.bak
-rw-r—– 1 oracle dba 5.1M Sep 25 09:33 df_6_as_trunc.bak

由此可以看出
1. copy 和 backup as copy 应该是一样的.
2. copy 和 backup 是完全不一样的

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

转载于:http://blog.itpub.net/7364032/viewspace-615523/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值