Complete recovery:
rman target / nocatalog
startup mount;
restore database;
recover database;
alter database open; -- 在归档模式下
恢复的之后, 更改的路径
rman target / nocatalog
startup mount;
run {
set newname for datafile 1 to ‘/<newdir>/system01.dbf’ …
restore database;
switch datafile all;
recover database;
alter database open; }
tablespace 级别de :
run {
sql “alter tablespace users offline immediate”;
restore tablespace users;
recover tablespace users;
sql “alter tablespace users online”; }
使用 rman 重新定位 tablespace 的路径:
1. 首先确认要转换路径的表空间的datafile. select file#, name, bytes from v$datafiles;
2. run {
sql “alter tablespace users offline immediate”;
set newname for datafile ‘/oradata/u03/users01.dbf’ to ‘/oradata/u04/users01/dbf’ --这句用来指定 restore的路径
restore(tablespace users);
switch datafile 3; -- update the control file and recovery catalog
recover tablespace users;
sql “alter tablespace tbs1 online”; }
Incomplete Recovery:
1. Mount the database
2. Allocate multiple channels for parallelization.
3. Restore all datafiles.
4. Recover the database by using UNTIL TIME, UNTIL SEQUENCE, or UNTIL SCN.
5. Open the database by using RESETLOGS.
6. Perform a whole database backup.
run {
allocate channel c1 type disk;
allocate channel c2 type disk;
set until time = ‘2000-12-09:14:44:44’;
restore database;
recover database;
alter database open resetlogs; }
这里要注意一下: NLS_DATE_FORMAT 这个参数所对应的时间格式.
run {
set until sequence 120 thread 1;
alter database mount;
restore database;
recover database;
sql “alter database open resetlogs”; }
转载
恢复的几种情形
1.在mount 或open 阶段完成的灾难恢复
非系统表空间,undo表空间,所有的数据文件
2.在nomount 阶段完成的灾难恢复
控制文件(controlfile)
3.在mount 阶段完成的灾难恢复
系统表空间,联机重做日志文件