1、做全库备份
RMAN> run{
allocate channel c1 type disk maxpiecesize=500m;
backup current controlfile format '+dgasm/backup/ctl_%d_%s';
backup full database format '+dgasm/backup/db_%d_%s_%p_%t';
sql 'alter system archive log current';
release channel c1;
}2> 3> 4> 5> 6> 7>
using target database control file instead of recovery catalog
allocated channel: c1
channel c1: SID=37 device type=DISK
Starting backup at 30-JUN-12
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
including current control file in backup set
channel c1: starting piece 1 at 30-JUN-12
channel c1: finished piece 1 at 30-JUN-12
piece handle=+DGASM/backup/ctl_ora11_37 tag=TAG20120630T094535 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:04
Finished backup at 30-JUN-12
Starting backup at 30-JUN-12
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00001 name=+DGASM/ora11/datafile/system.257.785186755
input datafile file number=00002 name=+DGASM/ora11/datafile/sysaux.258.785186845
input datafile file number=00003 name=+DGASM/ora11/datafile/undotbs1.259.785186901
input datafile file number=00004 name=+DGASM/ora11/datafile/users.272.787009469
channel c1: starting piece 1 at 30-JUN-12
channel c1: finished piece 1 at 30-JUN-12
piece handle=+DGASM/backup/db_ora11_38_1_787311941 tag=TAG20120630T094541 comment=NONE
channel c1: starting piece 2 at 30-JUN-12
channel c1: finished piece 2 at 30-JUN-12
piece handle=+DGASM/backup/db_ora11_38_2_787311941 tag=TAG20120630T094541 comment=NONE
channel c1: backup set complete, elapsed time: 00:01:00
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel c1: starting piece 1 at 30-JUN-12
channel c1: finished piece 1 at 30-JUN-12
piece handle=+DGASM/backup/db_ora11_39_1_787312002 tag=TAG20120630T094541 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
Finished backup at 30-JUN-12
released channel: c1
RMAN>
2、做操做
创建haozg user 然后建表
SQL> create table haozg_hist as select * from v$loghist;
Table created.
SQL> alter system switch logfile;
System altered.
SQL> /
System altered.
SQL> /
System altered.
SQL> /
System altered.
SQL>
SQL> create table test(id number,name varchar2(13));
Table created.
SQL> insert into test select object_id,object_name from dba_objects where rownum=1;
1 row created.
SQL> commit;
Commit complete.
SQL> alter system switch logfile;
System altered.
SQL> /
System altered.
SQL> /
System altered.
3、关闭数据库,删除控制文件,模拟控制文件顺坏
在grid 用户下操作
ASMCMD> cd controlfile
ASMCMD> ls
current.260.787304065
ASMCMD> rm -f *
4、启动数据库到nomount状态
starting media recovery
archived log for thread 1 with sequence 8 is already on disk as file +DGASM/ora11/onlinelog/group_2.264.785192615
archived log for thread 1 with sequence 9 is already on disk as file +DGASM/ora11/onlinelog/group_3.265.785192859
archived log for thread 1 with sequence 10 is already on disk as file +DGASM/ora11/onlinelog/group_1.263.785192081
archived log file name=/oracle/archivelog/1_1_787309225.dbf thread=1 sequence=1
archived log file name=/oracle/archivelog/1_2_787309225.dbf thread=1 sequence=2
archived log file name=/oracle/archivelog/1_3_787309225.dbf thread=1 sequence