Oracle认证专家视频教程-OCP全套教程之学习笔记-RMAN恢复

前端之家收集整理的这篇文章主要介绍了Oracle认证专家视频教程-OCP全套教程之学习笔记-RMAN恢复前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

知识要点

基本恢复

可以脱机的,在线恢复

linux>rm -f /u01/app/oracle/oradata/sky2/users01.dbf
RMAN>sql “alter tablespace users offline immeidiate”;
RMAN>restore tablespace users;
RMAN>recover tablespace users;
RMAN>sql “alter tablespace users online”;

不能脱机的,在mount阶段恢复

linux>rm -f /u01/app/oracle/oradata/sky2/undotbs01.db
RMAN> shutdown immediate
RMAN> startup mount;
RMAN>restore datafile ‘/u01/app/oracle/oradata/sky2/undotbs01.dbf’;
RMAN>recover datafile ‘/u01/app/oracle/oradata/sky2/undotbs01.dbf’;
RMAN>alter database open;

从指定文件恢复

RMAN>restore tablespace users from tag=’TAG20170703T163702’;
RMAN>recover tablespace users;

基于时间的恢复

  1. 设定日期格式
    sqlplus>alter system set nls_date_format=’yyyy-mm-dd:hh24:mi:ss’ scope=spfile;

  2. 数据库要处于mount阶段基于时间恢复,恢复到指定的时间,之后变化的数据就恢复不回去了,基本都不在本机做
    run{
    allocate channel a1 type disk;
    allocate channel a2 type disk;
    set until time = ‘2017-07-04:09:45:49’;
    restore database;
    recover database;
    alter database open resetlogs;
    release channel a1;
    release channel a2;
    }

数据文件重命名

重命名之后然后在从新数据文件恢复
run{
allocate channel a1 type disk;
sql ‘alter tablespace users offline’;
set newname for datafile ‘/u01/app/oracle/oradata/sky2/users01.dbf’ to ‘/u01/app/oracle/oradata/sky2/users.dbf’;
restore tablespace users;
switch datafile ‘/u01/app/oracle/oradata/sky2/users.dbf’;
recover tablespace users;
sql ‘alter tablespace users online’;
release channel a1;
}

恢复控制文件和参数文件

RMAN>restore controlfile from ”; RMAN>restore spfile from ”; RMAN>restore spfile to pfile ”;

原文链接:https://www.f2er.com/oracle/208625.html

猜你在找的Oracle相关文章