Objective
l Describe the use of RMAN for and
l Perform complete recovery in mode
l Relocate and recover a tablespace by using archived redo log files
Restoration Using RMAN
l Restore files from backup sets or image copies by using the command
l Recover files by using the command
Using RMAN in ARCHIVELOG
rman target /
RMAN> STARTUP MOUNT
RMAN> RESTORE DATABASE;
RMAN> RECOVER DATABASE;
RMAN> ALTER DATABASE OPEN;
下面开始实验:
SYSTEM: Oracle VERSION:
$
Recovery Manager: Release 11.2.0.1.0 - Production on Thu Apr 14 09:03:20 2011
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCL (DBID=1276064171)
using target database control file instead of recovery catalog
RMAN>
specification does not match any backup in the repository
RMAN> --准备一个全备
Starting backup at 14-APR-11
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=00001 name=/u01/app/oracle/oradata/orcl/system01.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/orcl/sysaux01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/orcl/undotbs01.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/orcl/example01.dbf
input datafile file number=00006 name=/u01/app/oracle/oradata/orcl/app01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/orcl/users01.dbf
channel ORA_DISK_1: starting piece 1 at 13-APR-11
channel ORA_DISK_1: finished piece 1 at 13-APR-11
piece handle=/u02/backup/orcl_04m9mqh3_1_1 tag=TAG20110413T200555 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07
Finished backup at 14-APR-11
Starting Control File and SPFILE Autobackup at 14-APR-11
piece handle=/u01/app/oracle/flash_recovery_area/ORCL/autobackup/2011_04_13/o1_mf_s_748382762_6tdl3tk7_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 14-APR-11
RMAN> --归档当前联机重做日志文件(REDO LOG)
sql statement: alter system archive log current
RMAN>
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
3 Full 1.06G DISK 00:00:05 13-APR-11
BP Key: 3 Status: AVAILABLE Compressed: NO Tag: TAG20110413T200555
Piece Name: /u02/backup/orcl_04m9mqh3_1_1
List of Datafiles in backup set 3
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 1224029 13-APR-11 /u01/app/oracle/oradata/orcl/system01.dbf
2 Full 1224029 13-APR-11 /u01/app/oracle/oradata/orcl/sysaux01.dbf
3 Full 1224029 13-APR-11 /u01/app/oracle/oradata/orcl/undotbs01.dbf
4 Full 1224029 13-APR-11 /u01/app/oracle/oradata/orcl/users01.dbf
5 Full 1224029 13-APR-11 /u01/app/oracle/oradata/orcl/example01.dbf
6 Full 1183312 13-APR-11 /u01/app/oracle/oradata/orcl/app01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
4 Full 7.58M DISK 00:00:00 13-APR-11
BP Key: 4 Status: AVAILABLE Compressed: NO Tag: TAG20110413T200602
Piece Name: /u01/app/oracle/flash_recovery_area/ORCL/autobackup/2011_04_13/o1_mf_s_748382762_6tdl3tk7_.bkp
SPFILE Included: Modification time: 13-APR-11
SPFILE db_unique_name: ORCL
Control File Included: Ckp SCN: 1224037 Ckp time: 13-APR-11