rem run rman
rman target / cmdfile=G:\oracle\ msglog= e:/orabackup/full_rmanlog%date:~4,10%.log
run{
allocate channel c1 type disk;
backup
incremental level=0
format 'G:\inc0_%u_%T'
tag sun_inc0
database
plus archivelog delete input;
release channel c1;
}
run{
allocate channel c1 type disk;
backup
incremental level=2
format 'G:\inc2_%u_%T'
tag mon_inc2
database
plus archivelog delete input;
release channel c1;
}
run{
allocate channel c1 type disk;
backup
incremental level=2
format 'G:\inc2_%u_%T'
tag tue_inc2
database
plus archivelog delete input;
release channel c1;
}
run{
allocate channel c1 type disk;
backup
incremental level=1
format 'G:\inc1_%u_%T'
tag wed_inc1
database
plus archivelog delete input;
release channel c1;
}
run{
allocate channel c1 type disk;
backup
incremental level=2
format 'G:\inc2_%u_%T'
tag thu_inc2
database
plus archivelog delete input;
release channel c1;
}
run{
allocate channel c1 type disk;
backup
incremental level=2
format 'G:\inc2_%u_%T'
tag fri_inc2
database
plus archivelog delete input;
release channel c1;
}
run{
allocate channel c1 type disk;
backup
incremental level=2
format 'G:\inc2_%u_%T'
tag sat_inc2
database
plus archivelog delete input;
release channel c1;
}
run {
set archivelog destination to 'g:\';
restore archivelog sequence 16;
}
startup mount;
--如果是控制文件丢失
sql>startup nomount;
sql>
DECLARE
DEVTYPE VARCHAR2(256);
DONE BOOLEAN;
BEGIN
DEVTYPE:=DBMS_BACKUP_RESTORE.DEVICEALLOCATE(NULL);
DBMS_BACKUP_RESTORE.RESTORESETDATAFILE;
DBMS_BACKUP_RESTORE.RESTORECONTROLFILETO('G:\oracle\oradata\orcl\CONTROL01.CTL');
DBMS_BACKUP_RESTORE.RESTOREBACKUPPIECE('G:\CTRL_C-1231731297-20091202-03',DONE=>done);
DBMS_BACKUP_RESTORE.RESTORESETDATAFILE; DBMS_BACKUP_RESTORE.RESTORECONTROLFILETO('G:\oracle\oradata\orcl\CONTROL02.CTL');
DBMS_BACKUP_RESTORE.RESTOREBACKUPPIECE('G:\CTRL_C-1231731297-20091202-03',DONE=>done);
DBMS_BACKUP_RESTORE.RESTORESETDATAFILE; DBMS_BACKUP_RESTORE.RESTORECONTROLFILETO('G:\oracle\oradata\orcl\CONTROL03.CTL');
DBMS_BACKUP_RESTORE.RESTOREBACKUPPIECE('G:\CTRL_C-1231731297-20091202-03',DONE=>done);
DBMS_BACKUP_RESTORE.DEVICEDEALLOCATE(NULL);
END;
/
sql>alter database mount;
restore database;