[oracle@station oracle]$ rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Fri Jun 8 12:56:11 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: ORCL (DBID=1312694260)
RMAN> list backup; ---查看所有RMAN备份文件
using target database control file instead of recovery catalog
RMAN> backup tablespace users; ---备份users表空间
Starting backup at 08-JUN-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=140 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00004 name=/u01/app/oracle/oradata/ORCL/datafile/o1_mf_users_7wnthzto_.dbf
channel ORA_DISK_1: starting piece 1 at 08-JUN-12
channel ORA_DISK_1: finished piece 1 at 08-JUN-12
piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/2012_06_08/o1_mf_nnndf_TAG20120608T125639_7x4cp7c3_.bkp tag=TAG20120608T125639 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 08-JUN-12
RMAN> list backup; ---再次查看R所有MAN备份文件
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1 Full 2.10M DISK 00:00:00 08-JUN-12
BP Key: 1 Status: AVAILABLE Compressed: NO Tag: TAG20120608T125639
Piece Name: /u01/app/oracle/flash_recovery_area/ORCL/backupset/2012_06_08/o1_mf_nnndf_TAG20120608T125639_7x4cp7c3_.bkp
List of Datafiles in backup set 1
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
4 Full 888677 08-JUN-12 /u01/app/oracle/oradata/ORCL/datafile/o1_mf_users_7wnthzto_.dbf
RMAN> exit
Recovery Manager complete.
[oracle@station oracle]$ rm -rf ./oradata/ORCL/datafile/*users* ----手工删除users在线表空间
[oracle@station oracle]$ rman target / ----进入RMAN管理器
Recovery Manager: Release 10.2.0.1.0 - Production on Fri Jun 8 12:59:15 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: ORCL (DBID=1312694260)
RMAN> sql "alter database datafile 4 offline"; ----通过RMAN下线users表空间
using target database control file instead of recovery catalog
sql statement: alter database datafile 4 offline
RMAN> restore datafile 4; ----还原users表空间
Starting restore at 08-JUN-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=137 devtype=DISK
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00004 to /u01/app/oracle/oradata/ORCL/datafile/o1_mf_users_7wnthzto_.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/ORCL/backupset/2012_06_08/o1_mf_nnndf_TAG20120608T125639_7x4cp7c3_.bkp
channel ORA_DISK_1: restored backup piece 1
piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/2012_06_08/o1_mf_nnndf_TAG20120608T125639_7x4cp7c3_.bkp tag=TAG20120608T125639
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 08-JUN-12
RMAN> recover datafile 4; ----修复users表空间
Starting recover at 08-JUN-12
using channel ORA_DISK_1
starting media recovery
media recovery complete, elapsed time: 00:00:02
Finished recover at 08-JUN-12
RMAN> sql "alter database datafile 4 online"; ----对修复完的users表空间进行上线
sql statement: alter database datafile 4 online
RMAN> quit
Recovery Manager complete.
[oracle@station oracle]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Jun 8 13:04:49 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> conn /as sysdba
Connected.
SQL> select * from hr.strom; ----查看是否有之前创建的表
A
----------
1
本文出自 “strom的博客” 博客,谢绝转载!