当前位置:数据库 > Oracle >>

Oracle恢复目录

Oracle恢复目录
 
一、创建恢复目录
1、建表空间
 create tablespace rc_data datafile '/u01/app/oracle/oradata/ocp/rc_data.dbf' size 50m;
 
 
2、建用户
 create user rc_ocp identified by rc_ocp default tablespace rc_data quota unlimited on rc_data;
 
 
3、授权
 grant connect,resource,recovery_catalog_owner to rc_ocp;
 
 
4、创建目录
 rman catalog rc_ocp/rc_ocp
 
 
 create catalog;
 
 5、注册
 rman target sys/oracle@ocp catalog rc_ocp/rc_ocp@ocp
 
 
 register database;
 
 
 6、查incarnation
  list incarnation;
 
 
 二、虚拟专用目录:
   1.先建表空间,用户,授权
  sys@OCP>create user v_user1 identified by v_user1 default tablespace tp1 temporary tablespace temp quota unlimited on tp1;
   
  sys@OCP> grant recovery_catalog_owner to v_user1;
   
  2.用基本恢复目录登录给v_user1用户授权
   [oracle@ocm ~]$ rman catalog rc_ocp/rc_ocp
    grant catalog for database ocp to v_user1;
    grant catalog for database ocm to v_user1;
 
 
  3.用虚拟用户登录,建恢复目录
   [oracle@ocm ~]$ rman catalog v_user1/v_user1
    create virtual catalog;
     
     list incarnation
 
 
  4.sqlplus v_user1/v_user1
   select * from RC_BACKUP_DATAFILE;
 
 
三、备份脚本
 
 
      create script datafile_5{
      backup datafile 5;
     }
 
 
    run{execute script full_db;}
 
 
    rman target sys/oracle@oca catalog rc_admin/rc_admin@oca script datafile_4
 
 
     list script names;
 
 
     print script datafile_4;
 
 
     replace script datafile_4{
       backup format='/backup/rman/full_%U'
       database;
      }
 
 
四、常用操作
    delete script full_db;
    resync catalog;
    unregister database;
    upgrade catalog;
    drop catalog;
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,