当前位置:数据库 > Oracle >>

oracle 10g rman备份与恢复之四

oracle 10g rman备份与恢复之四
 
nocatalog rman恢复
    dbid用来恢复spfile和controlfile用到
    CONFIGURE CONTROLFILE AUTOBACKUP ON;
    backup database plus archivelog delete input;
备份补充
RMAN> show all
2> ;
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/oracle/ora10g/product/10.2.0/db_1/dbs/snapcf_wolf.f'; # default
防止controlfile丢失
CONFIGURE CONTROLFILE AUTOBACKUP ON;  启用后会自动备份controlfile和spfile
先把之前的备份全部删除
delete backupset 
RMAN> delete backupset 652
2> ;
using channel ORA_DISK_1
List of Backup Pieces
BP Key  BS Key  Pc# Cp# Status      Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
658     652     1   1   AVAILABLE   DISK        /oracle/ora10g/flash_recovery_area/WOLF/autobackup/2013_04_21/o1_mf_s_813295785_8q75c9pw_.bkp
Do you really want to delete the above objects (enter YES or NO)? yes
deleted backup piece
backup piece handle=/oracle/ora10g/flash_recovery_area/WOLF/autobackup/2013_04_21/o1_mf_s_813295785_8q75c9pw_.bkp recid=44 stamp=813295785
Deleted 1 object
下面是我先在系统里面用rm删掉的,os里面删了之后,rman里面还会有信息,必须用crosscheck backupset,做标记,然后在删除。
RMAN> delete backupset 552
2> ;
using channel ORA_DISK_1
List of Backup Pieces
BP Key  BS Key  Pc# Cp# Status      Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
555     552     1   1   AVAILABLE   DISK        /oracle/ora10g/rmanback/inc0_1eo7jo4g_20130421
Do you really want to delete the above objects (enter YES or NO)? yes
RMAN-06207: WARNING: 1 objects could not be deleted for DISK channel(s) due
RMAN-06208:          to mismatched status.  Use CROSSCHECK command to fix status
RMAN-06210: List of Mismatched objects
RMAN-06211: ==========================
RMAN-06212:   Object Type   Filename/Handle
RMAN-06213: --------------- ---------------------------------------------------
RMAN-06214: Backup Piece    /oracle/ora10g/rmanback/inc0_1eo7jo4g_20130421
RMAN> CROSSCHECK backupset;
using channel ORA_DISK_1
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/oracle/ora10g/rmanback/full_T% recid=35 stamp=813237736
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/oracle/ora10g/rmanback/full_20130420 recid=37 stamp=813238342
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/oracle/ora10g/rmanback/inc0_1co7jn4l_20130421 recid=39 stamp=813292693
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/oracle/ora10g/rmanback/inc0_1eo7jo4g_20130421 recid=41 stamp=813293712
Crosschecked 4 objects
RMAN> DELETE NOPROMPT EXPIRED BACKUP;
using channel ORA_DISK_1
List of Backup Pieces
BP Key  BS Key  Pc# Cp# Status      Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
398     395     1   1   EXPIRED     DISK        /oracle/ora10g/rmanback/full_T%
433     430     1   1   EXPIRED     DISK        /oracle/ora10g/rmanback/full_20130420
494     491     1   1   EXPIRED     DISK        /oracle/ora10g/rmanback/inc0_1co7jn4l_20130421
555     552     1   1   EXPIRED     DISK        /oracle/ora10g/rmanback/inc0_1eo7jo4g_20130421
deleted backup piece
backup piece handle=/oracle/ora10g/rmanback/full_T% recid=35 stamp=813237736
deleted backup piece
backup piece handle=/oracle/ora10g/rmanback/full_20130420 recid=37 stamp=813238342
deleted backup piece
backup piece handle=/oracle/ora10g/rmanback/inc0_1co7jn4l_20130421 recid=39 stamp=813292693
deleted backup piece
backup piece handle=/oracle/ora10g/rmanback/inc0_1eo7jo4g_20130421 recid=41 stamp=813293712
Deleted 4 EXPIRED objects
RMAN> list backupset;
RMAN>
------------------------------------------------------------------------------------------------
backup format ‘/oracle/ora10g/rmanback/full_%u_%T.bak' database plus archivelog;
 
-----------------------------------------------------------------------
恢复
1、口令文件恢复
[root@redhat dbs]# pwd
/oracle/ora10g/product/10.2.0/db_1/dbs
[root@redhat dbs]# ls
hc_wolf.dat  initdw.ora  init.ora  lkDUMMY  lkWOLF  orapwwolf  snapcf_wolf.f  spfilewolf.ora
[root@redhat dbs]# 
假设口令文件丢失
重建口令文件
[oracle@redhat ~]$ cd /oracle/ora10g/product/10.2.0/db_1/dbs
[oracle@redhat dbs]$ orapwd file=orapwwolf password=123456 entries=5
[oracle@redhat dbs]$ ls
hc_wolf.dat  initdw.ora  init.ora  lkDUMMY  lkWOLF  orapwwolf  orapwwolf.bak  snapcf_wolf.f  spfilewolf.ora
[oracle@redhat dbs]$
[oracle@redhat dbs]$ orapwd
Usage: orapwd file=<fname> password=<password> entries=<users> force=<y/n>
  where
    file - name of password file (mand),
    password - password for SYS (mand),
    entries - maximum number of distinct DBA and     force - whether to overwrite existing file (opt),
OPERs (opt), 
  There are no spaces around the equal-to (=) character.
2、spfile丢失(dbid=3778783462)
   startup nomount
   set dbid dbid_number
   restore spfile from autobackup
   shutdown immediate
   set dbid dbid_number
   startup
   
模拟丢失spfile
SQL> show parameter spfile
NAME                                 T
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,