Chinaunix首页 | 论坛 | 博客
  • 博客访问: 69033
  • 博文数量: 15
  • 博客积分: 638
  • 博客等级: 上士
  • 技术积分: 155
  • 用 户 组: 普通用户
  • 注册时间: 2007-09-26 23:13
文章分类

全部博文(15)

文章存档

2012年(1)

2011年(1)

2009年(13)

分类: Oracle

2009-10-22 21:00:25

备份——全库备份。

启动数据库到archivelog模式
rman target=rman/rman
rman>backup database plus archivelog delete input;

删除两个用户及相关表后。
恢复部分内容——基于时间点的恢复。
[root@ccj 2009_10_22]# ll
总用量 1299304
-rw-r-----  1 oracle oinstall   39169536 10月 22 14:31 o1_mf_annnn_TAG20091022T143115_5fzz1oyv_.bkp
-rw-r-----  1 oracle oinstall      30208 10月 22 14:36 o1_mf_annnn_TAG20091022T143634_5fzzcmfo_.bkp
-rw-r-----  1 oracle oinstall    7110656 10月 22 14:27 o1_mf_ncnnf_TAG20091022T142737_5fzytyh2_.bkp
-rw-r-----  1 oracle oinstall    7110656 10月 22 14:36 o1_mf_ncnnf_TAG20091022T143121_5fzzcg0l_.bkp
-rw-r-----  1 oracle oinstall 1275740160 10月 22 14:36 o1_mf_nnndf_TAG20091022T143121_5fzz1t8k_.bkp
[root@ccj 2009_10_22]# pwd
/opt/oracle/flash_recovery_area/ORCL/backupset/2009_10_22

[oracle@ccj ~]$ export NLS_DATE_FORMAT="yyyy-mm-dd hh24:mi:ss"
[oracle@ccj ~]$
[oracle@ccj ~]$  export NLS_DATE_FORMAT="yyyy-mm-dd hh24:mi:ss"
[oracle@ccj ~]$ rman target=rman/rman
Recovery Manager: Release 10.2.0.1.0 - Production on Thu Oct 22 17:08:54 2009

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

connected to target database: ORCL (DBID=1223339172)
RMAN> restore database;

Starting restore at 2009-10-22 17:23:29
using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /opt/oracle/oradata/orcl/system01.dbf
restoring datafile 00002 to /opt/oracle/oradata/orcl/undotbs01.dbf
restoring datafile 00003 to /opt/oracle/oradata/orcl/sysaux01.dbf
restoring datafile 00004 to /opt/oracle/oradata/orcl/users01.dbf
restoring datafile 00005 to /opt/oracle/oradata/orcl/example01.dbf
restoring datafile 00006 to /opt/oracle/oradata/db/reporter.dbf
restoring datafile 00007 to /opt/oracle/oradata/db/sm_db.dbf
restoring datafile 00008 to /opt/oracle/product/10g/dbs/nhnmcc_data.data
channel ORA_DISK_1: reading from backup piece /opt/oracle/flash_recovery_area/ORCL/backupset/2009_10_22/o1_mf_nnndf_TAG20091022T143121_5fzz1t8k_.bkp
channel ORA_DISK_1: restored backup piece 1
piece handle=/opt/oracle/flash_recovery_area/ORCL/backupset/2009_10_22/o1_mf_nnndf_TAG20091022T143121_5fzz1t8k_.bkp tag=TAG20091022T143121
channel ORA_DISK_1: restore complete, elapsed time: 00:02:38
Finished restore at 2009-10-22 17:26:09

RMAN>  recover database until time '2009-10-22 14:37:00';

Starting recover at 2009-10-22 17:26:58
using channel ORA_DISK_1

starting media recovery
media recovery complete, elapsed time: 00:00:05

Finished recover at 2009-10-22 17:27:04


最后,alter database open resetlogs;

注:备份时archivelog状态,恢复时候mount状态;
可能用到的命令sql>alter session set NLS_date_format = 'YYYY-MM-DD HH24:MI:SS'
阅读(486) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~