【oracle】rman 简单的备份操作

Posted on 2012-12-19 15:57  雅飞士  阅读(430)  评论(0编辑  收藏  举报

备份:

备份全库:

RMAN> backup database format '/backup/fulldb/%U';

RMAN> list backup of database;

备份表空间:

RMAN> backup tablespace tbs_pb_dparam;
Starting backup at 20121214152625
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=00110 name=/oradata/orcl/TBS_PB_DPARAM_01.dbf
channel ORA_DISK_1: starting piece 1 at 20121214152625
channel ORA_DISK_1: finished piece 1 at 20121214152626
piece handle=/s01/fast_recovery_area/ORCL/backupset/2012_12_14/o1_mf_nnndf_TAG20121214T152625_8doo51q2_.bkp tag=TAG20121214T152625 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 20121214152626

RMAN> list backup of tablespace tbs_pb_dparam;
List of Backup Sets
===================
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
9       Full    82.55M     DISK        00:00:07     20121214151355
        BP Key: 9   Status: AVAILABLE  Compressed: NO  Tag: TAG20121214T151204
        Piece Name: /backup/fulldb/0dnsrm9c_1_1
List of Datafiles in backup set 9
  File LV Type Ckp SCN    Ckp Time       Name
  ---- -- ---- ---------- -------------- ----
  110     Full 2515132    20121214120212 /oradata/orcl/TBS_PB_DPARAM_01.dbf
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
11      Full    1.03M      DISK        00:00:00     20121214152625
        BP Key: 11   Status: AVAILABLE  Compressed: NO  Tag: TAG20121214T152625
        Piece Name: /s01/fast_recovery_area/ORCL/backupset/2012_12_14/o1_mf_nnndf_TAG20121214T152625_8doo51q2_.bkp
List of Datafiles in backup set 11
  File LV Type Ckp SCN    Ckp Time       Name
  ---- -- ---- ---------- -------------- ----
  110     Full 2515132    20121214120212 /oradata/orcl/TBS_PB_DPARAM_01.dbf

有2个备份集,删除其中一个:

RMAN> delete backupset 11;
using channel ORA_DISK_1
List of Backup Pieces
BP Key  BS Key  Pc# Cp# Status      Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
11      11      1   1   AVAILABLE   DISK        /s01/fast_recovery_area/ORCL/backupset/2012_12_14/o1_mf_nnndf_TAG20121214T152625_8doo51q2_.bkp
Do you really want to delete the above objects (enter YES or NO)? yes
deleted backup piece
backup piece handle=/s01/fast_recovery_area/ORCL/backupset/2012_12_14/o1_mf_nnndf_TAG20121214T152625_8doo51q2_.bkp RECID=11 STAMP=802020385
Deleted 1 objects
RMAN> list backup of tablespace tbs_pb_dparam;
List of Backup Sets
===================
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
9       Full    82.55M     DISK        00:00:07     20121214151355
        BP Key: 9   Status: AVAILABLE  Compressed: NO  Tag: TAG20121214T151204
        Piece Name: /backup/fulldb/0dnsrm9c_1_1
List of Datafiles in backup set 9
  File LV Type Ckp SCN    Ckp Time       Name
  ---- -- ---- ---------- -------------- ----
  110     Full 2515132    20121214120212 /oradata/orcl/TBS_PB_DPARAM_01.dbf

备份指定的数据文件:

RMAN> backup datafile 10;
Starting backup at 20121214153209
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=00010 name=/oradata/orcl/TBS_ACT_DAPP_01.dbf
channel ORA_DISK_1: starting piece 1 at 20121214153209
channel ORA_DISK_1: finished piece 1 at 20121214153210
piece handle=/s01/fast_recovery_area/ORCL/backupset/2012_12_14/o1_mf_nnndf_TAG20121214T153209_8doohshb_.bkp tag=TAG20121214T153209 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 20121214153210
Starting Control File and SPFILE Autobackup at 20121214153210
piece handle=/s01/fast_recovery_area/ORCL/autobackup/2012_12_14/o1_mf_s_802008132_8doohv3w_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 20121214153211

RMAN> list backup of datafile 10;
List of Backup Sets
===================
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
9       Full    82.55M     DISK        00:00:07     20121214151355
        BP Key: 9   Status: AVAILABLE  Compressed: NO  Tag: TAG20121214T151204
        Piece Name: /backup/fulldb/0dnsrm9c_1_1
  List of Datafiles in backup set 9
  File LV Type Ckp SCN    Ckp Time       Name
  ---- -- ---- ---------- -------------- ----
  10      Full 2515132    20121214120212 /oradata/orcl/TBS_ACT_DAPP_01.dbf
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
13      Full    1.03M      DISK        00:00:00     20121214153209
        BP Key: 13   Status: AVAILABLE  Compressed: NO  Tag: TAG20121214T153209
        Piece Name: /s01/fast_recovery_area/ORCL/backupset/2012_12_14/o1_mf_nnndf_TAG20121214T153209_8doohshb_.bkp
  List of Datafiles in backup set 13
  File LV Type Ckp SCN    Ckp Time       Name
  ---- -- ---- ---------- -------------- ----
  10      Full 2515132    20121214120212 /oradata/orcl/TBS_ACT_DAPP_01.dbf

由于执行了 :configure controlfile autobackup on; 所以每次都会备份控制文件。

手动备份控制文件:

RMAN> backup current controlfile;
Starting backup at 20121214153444
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 20121214153446
channel ORA_DISK_1: finished piece 1 at 20121214153447
piece handle=/s01/fast_recovery_area/ORCL/backupset/2012_12_14/o1_mf_ncnnf_TAG20121214T153444_8doonp47_.bkp tag=TAG20121214T153444 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 20121214153447
Starting Control File and SPFILE Autobackup at 20121214153447
piece handle=/s01/fast_recovery_area/ORCL/autobackup/2012_12_14/o1_mf_s_802008132_8doonr4f_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 20121214153450

备份spfile文件:

RMAN> backup spfile;
Starting backup at 20121214154008
using channel ORA_DISK_1
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 20121214154009
channel ORA_DISK_1: finished piece 1 at 20121214154010
piece handle=/s01/fast_recovery_area/ORCL/backupset/2012_12_14/o1_mf_nnsnf_TAG20121214T154008_8dooys25_.bkp tag=TAG20121214T154008 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 20121214154010
Starting Control File and SPFILE Autobackup at 20121214154010
piece handle=/s01/fast_recovery_area/ORCL/autobackup/2012_12_14/o1_mf_s_802008132_8dooyton_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 20121214154011

删除所有备份:

RMAN> delete backup;
using channel ORA_DISK_1
List of Backup Pieces
BP Key  BS Key  Pc# Cp# Status      Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
6       6       1   1   AVAILABLE   DISK        /backup/fulldb/0ansrm65_1_1
7       7       1   1   AVAILABLE   DISK        /backup/fulldb/0bnsrm7v_1_1
8       8       1   1   AVAILABLE   DISK        /backup/fulldb/0cnsrm94_1_1
9       9       1   1   AVAILABLE   DISK        /backup/fulldb/0dnsrm9c_1_1
10      10      1   1   AVAILABLE   DISK        /s01/fast_recovery_area/ORCL/autobackup/2012_12_14/o1_mf_s_802008132_8donfpfx_.bkp
12      12      1   1   AVAILABLE   DISK        /s01/fast_recovery_area/ORCL/autobackup/2012_12_14/o1_mf_s_802008132_8doo5392_.bkp
14      14      1   1   AVAILABLE   DISK        /s01/fast_recovery_area/ORCL/autobackup/2012_12_14/o1_mf_s_802008132_8doohv3w_.bkp
15      15      1   1   AVAILABLE   DISK        /s01/fast_recovery_area/ORCL/backupset/2012_12_14/o1_mf_ncnnf_TAG20121214T153444_8doonp47_.bkp
16      16      1   1   AVAILABLE   DISK        /s01/fast_recovery_area/ORCL/autobackup/2012_12_14/o1_mf_s_802008132_8doonr4f_.bkp
17      17      1   1   AVAILABLE   DISK        /s01/fast_recovery_area/ORCL/backupset/2012_12_14/o1_mf_nnsnf_TAG20121214T154008_8dooys25_.bkp
18      18      1   1   AVAILABLE   DISK        /s01/fast_recovery_area/ORCL/autobackup/2012_12_14/o1_mf_s_802008132_8dooyton_.bkp
Do you really want to delete the above objects (enter YES or NO)? yes
deleted backup piece
backup piece handle=/backup/fulldb/0ansrm65_1_1 RECID=6 STAMP=802019526
deleted backup piece
backup piece handle=/backup/fulldb/0bnsrm7v_1_1 RECID=7 STAMP=802019583
deleted backup piece
backup piece handle=/backup/fulldb/0cnsrm94_1_1 RECID=8 STAMP=802019620
deleted backup piece
backup piece handle=/backup/fulldb/0dnsrm9c_1_1 RECID=9 STAMP=802019629
deleted backup piece
backup piece handle=/s01/fast_recovery_area/ORCL/autobackup/2012_12_14/o1_mf_s_802008132_8donfpfx_.bkp RECID=10 STAMP=802019638
deleted backup piece
backup piece handle=/s01/fast_recovery_area/ORCL/autobackup/2012_12_14/o1_mf_s_802008132_8doo5392_.bkp RECID=12 STAMP=802020387
deleted backup piece
backup piece handle=/s01/fast_recovery_area/ORCL/autobackup/2012_12_14/o1_mf_s_802008132_8doohv3w_.bkp RECID=14 STAMP=802020731
deleted backup piece
backup piece handle=/s01/fast_recovery_area/ORCL/backupset/2012_12_14/o1_mf_ncnnf_TAG20121214T153444_8doonp47_.bkp RECID=15 STAMP=802020886
deleted backup piece
backup piece handle=/s01/fast_recovery_area/ORCL/autobackup/2012_12_14/o1_mf_s_802008132_8doonr4f_.bkp RECID=16 STAMP=802020887
deleted backup piece
backup piece handle=/s01/fast_recovery_area/ORCL/backupset/2012_12_14/o1_mf_nnsnf_TAG20121214T154008_8dooys25_.bkp RECID=17 STAMP=802021209
deleted backup piece
backup piece handle=/s01/fast_recovery_area/ORCL/autobackup/2012_12_14/o1_mf_s_802008132_8dooyton_.bkp RECID=18 STAMP=802021210
Deleted 11 objects
RMAN> list backup;
specification does not match any backup in the repository

原文地址:http://blog.yafeishi.net/2012/12/oracle-rman-simple-backup.html

Copyright © 2024 雅飞士
Powered by .NET 9.0 on Kubernetes