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

oracle 10g rman备份与恢复之五

oracle 10g rman备份与恢复之五
 
oracle 10g rman备份与恢复之四
http://www.zzzyk.com/database/201304/205040.html
 
恢复控制文件,日志文件,整库恢复,单个数据文件恢复
nocatalog恢复
    控制文件丢失恢复过程
startup nomount
restore controlfile from autobackup
alter database mount
recover database
alter database open resetlogs
 
模拟控制文件丢失
RMAN> shutdown immediate
database closed
database dismounted
Oracle instance shut down
 
[root@redhat wolf]# ls
control01.ctl  redo01.log  sysaux01.dbf  undotbs01.dbf
control02.ctl  redo02.log  system01.dbf  users01.dbf
control03.ctl  redo03.log  temp01.dbf
[root@redhat wolf]# mv control01.ctl control01.ctl.bak
[root@redhat wolf]# ls
control01.ctl.bak  redo01.log  sysaux01.dbf  undotbs01.dbf
control02.ctl      redo02.log  system01.dbf  users01.dbf
control03.ctl      redo03.log  temp01.dbf
 
连接rman管理器
[oracle@redhat ~]$ rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on 星期日 4月 21 10:27:09 2013
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
connected to target database (not started)
启动数据库到nomount状态
RMAN> startup nomount;
Oracle instance started
Total System Global Area     285212672 bytes
Fixed Size                     1218992 bytes
Variable Size                 92276304 bytes
Database Buffers             188743680 bytes
Redo Buffers                   2973696 bytes
RMAN> restore controlfile from autobackup;
Starting restore at 21-4月 -13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK
recovery area destination: /oracle/ora10g/flash_recovery_area
database name (or database unique name) used for search: WOLF
channel ORA_DISK_1: no autobackups found in the recovery area
autobackup search outside recovery area not attempted because DBID was not set
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 04/21/2013 10:28:26
RMAN-06172: no autobackup found or specified handle is not a valid copy or piece
 
 
RMAN> restore controlfile from '/oracle/ora10g/flash_recovery_area/WOLF/backupset/2013_04_21
2> 
3> 
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01006: error signalled during parse
RMAN-02002: unexpected end of input file reached
 
还原控制文件(这里最好用全路径)
RMAN> restore controlfile from '/oracle/ora10g/flash_recovery_area/WOLF/backupset/2013_04_21/o1_mf_ncsnf_TAG20130421T095042_8q7vtb8b_.bkp';
Starting restore at 21-4月 -13
using channel ORA_DISK_1
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:05
output filename=/oracle/ora10g/oradata/wolf/control01.ctl
output filename=/oracle/ora10g/oradata/wolf/control02.ctl
output filename=/oracle/ora10g/oradata/wolf/control03.ctl
Finished restore at 21-4月 -13
 
查看控制文件是否恢复
[root@redhat wolf]# ls
control01.ctl      control03.ctl  redo03.log    temp01.dbf
control01.ctl.bak  redo01.log     sysaux01.dbf  undotbs01.dbf
control02.ctl      redo02.log     system01.dbf  users01.dbf
打开数据库到mount状态
RMAN> alter database mount;
database mounted
released channel: ORA_DISK_1
 
恢复数据库
RMAN> recover database;
Starting recover at 21-4月 -13
Starting implicit crosscheck backup at 21-4月 -13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK
Crosschecked 2 objects
Finished implicit crosscheck backup at 21-4月 -13
Starting implicit crosscheck copy at 21-4月 -13
using channel ORA_DISK_1
Finished implicit crosscheck copy at 21-4月 -13
searching for all files in the recovery area
cataloging files...
cataloging done
List of Cataloged Files
File Name: /oracle/ora10g/flash_recovery_area/WOLF/backupset/2013_04_21/o1_mf_ncsnf_TAG20130421T095042_8q7vtb8b_.bkp
using channel ORA_DISK_1
starting media recovery
archive log thread 1 sequence 2 is already on disk as file /oracle/ora10g/oradata/wolf/redo01.log
archive log filename=/oracle/ora10g/oradata/wolf/redo01.log thread=1 sequence=2
media recovery complete, elapsed time: 00:00:07
Finished recover at 21-4月 -13
启动数据库
RMAN> alter database open resetlogs;
database opened
sqlplus登录,查看数据库是否正常
[oracle@redhat ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on 星期日 4月 21 10:46:37 2013
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> select * from dual;
 
 
D
-
X
 
 
=====================================================================================
 
日志文件的恢复
 
redolog file 丢失
     shutdown immediate
startup mount
alter database resetlogs
 
==========================================================================================
全库备份(包括控制文件,参数文件,数据文件等)
RMAN> backup database plus archivelog delete input;
Starting backup at 22-4月 -13
current log archived
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=134 devtype=DISK
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=7 recid=1 stamp=789518526
input archive log thread=1 sequence=8 recid=2 stamp=789537831
input archive log thread=1 sequence=9 recid=3 stamp=789537832
input archive log thread=1 sequence=15 recid=4 stamp=790907119
input archive log thread=1 sequence=16 recid=5 st
Oracle
MySQL
Access
SQLServer
DB2
Excel
SQLite
SYBASE
Postgres
如果你遇到数据库难题:
请访问www.zzzyk.com 试试
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,