1、RMAN远程登录数据库

C:\Users\MaryHu>rman target sys/oracle@DB200  nocatalog

Recovery Manager: Release 11.2.0.1.0 - Production on Sat Mar 23 15:15:02 2013

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: POLI (DBID=3718810889)
using target database control file instead of recovery catalog

2、查看备份历史记录信息

RMAN> list backup;

List of Backup Sets
===================

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1       Full    1.05G      DISK        00:00:43     19-MAR-13
        BP Key: 1   Status: AVAILABLE  Compressed: NO  Tag: TAG20130319T154228
        Piece Name: /u01/flash_recovery_area/POLI/backupset/2013_03_19/o1_mf_nnndf_TAG20130319T154228_8nj5q5sd_.bkp
  List of Datafiles in backup set 1
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 1194625    19-MAR-13 /u01/oradata/poli/system01.dbf
  2       Full 1194625    19-MAR-13 /u01/oradata/poli/sysaux01.dbf
  3       Full 1194625    19-MAR-13 /u01/oradata/poli/undotbs01.dbf
  4       Full 1194625    19-MAR-13 /u01/oradata/poli/users01.dbf
  5       Full 1194625    19-MAR-13 /u01/oradata/poli/example01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
2       Full    9.33M      DISK        00:00:02     19-MAR-13
        BP Key: 2   Status: AVAILABLE  Compressed: NO  Tag: TAG20130319T154228
        Piece Name: /u01/flash_recovery_area/POLI/backupset/2013_03_19/o1_mf_ncnnf_TAG20130319T154228_8nj5ro16_.bkp
  Control File Included: Ckp SCN: 1194643      Ckp time: 19-MAR-13

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
3       Full    9.33M      DISK        00:00:01     19-MAR-13
        BP Key: 3   Status: AVAILABLE  Compressed: NO  Tag: TAG20130319T155246
        Piece Name: /u01/flash_recovery_area/POLI/backupset/2013_03_19/o1_mf_ncnnf_TAG20130319T155246_8nj6bhrd_.bkp
  Control File Included: Ckp SCN: 1194878      Ckp time: 19-MAR-13

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
4       Full    9.33M      DISK        00:00:03     21-MAR-13
        BP Key: 4   Status: AVAILABLE  Compressed: NO  Tag: TAG20130321T182034
        Piece Name: /u01/flash_recovery_area/POLI/autobackup/2013_03_21/o1_mf_n_810670834_8noqqnd0_.bkp
  Control File Included: Ckp SCN: 1253212      Ckp time: 21-MAR-13

 3、执行备份 将备份文件备份到指定的目录下

RMAN> backup database format '/u01/arcerzhang/poli_%U';

Starting backup at 23-MAR-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=134 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/oradata/poli/system01.dbf
input datafile file number=00002 name=/u01/oradata/poli/sysaux01.dbf
input datafile file number=00006 name=/u01/oradata/expimp01.dbf
input datafile file number=00005 name=/u01/oradata/poli/example01.dbf
input datafile file number=00003 name=/u01/oradata/poli/undotbs01.dbf
input datafile file number=00004 name=/u01/oradata/poli/users01.dbf
channel ORA_DISK_1: starting piece 1 at 23-MAR-13
channel ORA_DISK_1: finished piece 1 at 23-MAR-13
piece handle=/u01/arcerzhang/poli_05o58kok_1_1 tag=TAG20130323T151740 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:28
Finished backup at 23-MAR-13

Starting Control File Autobackup at 23-MAR-13
piece handle=/u01/flash_recovery_area/POLI/autobackup/2013_03_23/o1_mf_n_810832749_8ntovfoq_.bkp comment=NONE
Finished Control File Autobackup at 23-MAR-13

备注: RMAN>BACKUP FORMAT '/BACKUP/df_%d_%s_p%.bus' DATABASE filesperset = 2;其中filesperset = 2,指明了每个backup set中可以存放2个数据文件.

 4、检验备份信息

RMAN> list backup;


List of Backup Sets
===================


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1       Full    1.05G      DISK        00:00:43     19-MAR-13
        BP Key: 1   Status: AVAILABLE  Compressed: NO  Tag: TAG20130319T154228
        Piece Name: /u01/flash_recovery_area/POLI/backupset/2013_03_19/o1_mf_nnndf_TAG20130319T154228_8nj5q5sd_.bkp
  List of Datafiles in backup set 1
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 1194625    19-MAR-13 /u01/oradata/poli/system01.dbf
  2       Full 1194625    19-MAR-13 /u01/oradata/poli/sysaux01.dbf
  3       Full 1194625    19-MAR-13 /u01/oradata/poli/undotbs01.dbf
  4       Full 1194625    19-MAR-13 /u01/oradata/poli/users01.dbf
  5       Full 1194625    19-MAR-13 /u01/oradata/poli/example01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
2       Full    9.33M      DISK        00:00:02     19-MAR-13
        BP Key: 2   Status: AVAILABLE  Compressed: NO  Tag: TAG20130319T154228
        Piece Name: /u01/flash_recovery_area/POLI/backupset/2013_03_19/o1_mf_ncnnf_TAG20130319T154228_8nj5ro16_.bkp
  Control File Included: Ckp SCN: 1194643      Ckp time: 19-MAR-13

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
3       Full    9.33M      DISK        00:00:01     19-MAR-13
        BP Key: 3   Status: AVAILABLE  Compressed: NO  Tag: TAG20130319T155246
        Piece Name: /u01/flash_recovery_area/POLI/backupset/2013_03_19/o1_mf_ncnnf_TAG20130319T155246_8nj6bhrd_.bkp
  Control File Included: Ckp SCN: 1194878      Ckp time: 19-MAR-13

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
4       Full    9.33M      DISK        00:00:03     21-MAR-13
        BP Key: 4   Status: AVAILABLE  Compressed: NO  Tag: TAG20130321T182034
        Piece Name: /u01/flash_recovery_area/POLI/autobackup/2013_03_21/o1_mf_n_810670834_8noqqnd0_.bkp
  Control File Included: Ckp SCN: 1253212      Ckp time: 21-MAR-13

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
5       Full    1.07G      DISK        00:01:20     23-MAR-13
        BP Key: 5   Status: AVAILABLE  Compressed: NO  Tag: TAG20130323T151740
        Piece Name: /u01/arcerzhang/poli_05o58kok_1_1
  List of Datafiles in backup set 5
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 1330610    23-MAR-13 /u01/oradata/poli/system01.dbf
  2       Full 1330610    23-MAR-13 /u01/oradata/poli/sysaux01.dbf
  3       Full 1330610    23-MAR-13 /u01/oradata/poli/undotbs01.dbf
  4       Full 1330610    23-MAR-13 /u01/oradata/poli/users01.dbf
  5       Full 1330610    23-MAR-13 /u01/oradata/poli/example01.dbf
  6       Full 1330610    23-MAR-13 /u01/oradata/expimp01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
6       Full    9.33M      DISK        00:00:00     23-MAR-13
        BP Key: 6   Status: AVAILABLE  Compressed: NO  Tag: TAG20130323T151909
        Piece Name: /u01/flash_recovery_area/POLI/autobackup/2013_03_23/o1_mf_n_810832749_8ntovfoq_.bkp
  Control File Included: Ckp SCN: 1330652      Ckp time: 23-MAR-13

 


 

备份方式二

RMAN> run {allocate channel d1 device type disk maxpiecesize=100M;backup database format='/u01/arcerzhang/poli_%U' filesperset 3;}

released channel: ORA_DISK_1
allocated channel: d1
channel d1: SID=134 device type=DISK

Starting backup at 23-MAR-13
channel d1: starting full datafile backup set
channel d1: specifying datafile(s) in backup set
input datafile file number=00002 name=/u01/oradata/poli/sysaux01.dbf
input datafile file number=00006 name=/u01/oradata/expimp01.dbf
input datafile file number=00003 name=/u01/oradata/poli/undotbs01.dbf
channel d1: starting piece 1 at 23-MAR-13
channel d1: finished piece 1 at 23-MAR-13
piece handle=/u01/arcerzhang/poli_07o58nl5_1_1 tag=TAG20130323T160701 comment=NONE
channel d1: starting piece 2 at 23-MAR-13
channel d1: finished piece 2 at 23-MAR-13
piece handle=/u01/arcerzhang/poli_07o58nl5_2_1 tag=TAG20130323T160701 comment=NONE
channel d1: starting piece 3 at 23-MAR-13
channel d1: finished piece 3 at 23-MAR-13
piece handle=/u01/arcerzhang/poli_07o58nl5_3_1 tag=TAG20130323T160701 comment=NONE
channel d1: starting piece 4 at 23-MAR-13
channel d1: finished piece 4 at 23-MAR-13
piece handle=/u01/arcerzhang/poli_07o58nl5_4_1 tag=TAG20130323T160701 comment=NONE
channel d1: starting piece 5 at 23-MAR-13
channel d1: finished piece 5 at 23-MAR-13
piece handle=/u01/arcerzhang/poli_07o58nl5_5_1 tag=TAG20130323T160701 comment=NONE
channel d1: backup set complete, elapsed time: 00:00:29
channel d1: starting full datafile backup set
channel d1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/oradata/poli/system01.dbf
input datafile file number=00005 name=/u01/oradata/poli/example01.dbf
input datafile file number=00004 name=/u01/oradata/poli/users01.dbf
channel d1: starting piece 1 at 23-MAR-13
channel d1: finished piece 1 at 23-MAR-13
piece handle=/u01/arcerzhang/poli_08o58nm2_1_1 tag=TAG20130323T160701 comment=NONE
channel d1: starting piece 2 at 23-MAR-13
channel d1: finished piece 2 at 23-MAR-13
piece handle=/u01/arcerzhang/poli_08o58nm2_2_1 tag=TAG20130323T160701 comment=NONE
channel d1: starting piece 3 at 23-MAR-13
channel d1: finished piece 3 at 23-MAR-13
piece handle=/u01/arcerzhang/poli_08o58nm2_3_1 tag=TAG20130323T160701 comment=NONE
channel d1: starting piece 4 at 23-MAR-13
channel d1: finished piece 4 at 23-MAR-13
piece handle=/u01/arcerzhang/poli_08o58nm2_4_1 tag=TAG20130323T160701 comment=NONE
channel d1: starting piece 5 at 23-MAR-13
channel d1: finished piece 5 at 23-MAR-13
piece handle=/u01/arcerzhang/poli_08o58nm2_5_1 tag=TAG20130323T160701 comment=NONE
channel d1: starting piece 6 at 23-MAR-13
channel d1: finished piece 6 at 23-MAR-13
piece handle=/u01/arcerzhang/poli_08o58nm2_6_1 tag=TAG20130323T160701 comment=NONE
channel d1: starting piece 7 at 23-MAR-13
channel d1: finished piece 7 at 23-MAR-13
piece handle=/u01/arcerzhang/poli_08o58nm2_7_1 tag=TAG20130323T160701 comment=NONE
channel d1: backup set complete, elapsed time: 00:00:34
Finished backup at 23-MAR-13

Starting Control File Autobackup at 23-MAR-13
piece handle=/u01/flash_recovery_area/POLI/autobackup/2013_03_23/o1_mf_n_810835684_8ntrq4gm_.bkp comment=NONE
Finished Control File Autobackup at 23-MAR-13
released channel: d1