码迷,mamicode.com
首页 > 数据库 > 详细

Oracle课程档案,第十四天

时间:2017-08-16 19:09:13      阅读:193      评论:0      收藏:0      [点我收藏+]

标签:ble   policy   oss   课程   rac   data   user   archive   消失   

备份数据文件:
SQL> select file_id, file_name from dba_data_files; backup:备用(备份) datafile:数据文件 backup tablespace:备份表空间 backup database:备份数据库
RMAN> backup datafile 4;
RMAN> backup datafile 4, 5;
RMAN> backup datafile ‘/u01/app/oracle/oradata/orcl/users01.dbf‘;
RMAN> backup tablespace users;
RMAN> backup tablespace users, example; 逗号分隔
RMAN> backup database;
RMAN> list backup;
desc v$backup_set,浏览器查看备份

增量备份:
RMAN> backup incremental level 0 tablespace users; incremental:增量的 level固定的后面一定要跟上
RMAN> list backup of tablespace users;
SQL> create table t1(x int) tablespace users;
SQL> insert into t1 values (1);
SQL> commit;
RMAN> backup incremental level 1 tablespace users;
RMAN> backup incremental level 1 tablespace users;
SQL> create table t2(x int) tablespace users;
SQL> insert into t2 values (1);
SQL> commit;
RMAN> backup incremental level 1 cumulative tablespace users;
RMAN> list backup of tablespace users;

增量更新:
SQL> create table t1(x int) tablespace users;
SQL> insert into t1 values (1);
SQL> commit;
RMAN> backup incremental level 1 for recover(恢复) of copy with tag(标签) ‘update_copy‘ tablespace users; 第一次创建的是0级备份
RMAN> list(名单) copy; 记录time和scn
SQL> insert into t1 values (2);
SQL> commit;
RMAN> backup incremental level 1 for recover of copy with tag ‘update_copy‘ tablespace users; 第2次创建的是1级备份
RMAN> list backup; backupset格式
RMAN> recover copy of tablespace users with tag ‘update_copy‘;
RMAN> list copy; time和scn更新
脚本形式:
RMAN> run {
backup incremental level 1 for recover of copy with tag ‘update_copy‘ tablespace users;
recover copy of tablespace users with tag ‘update_copy‘;
}

备份归档日志:
RMAN> list archivelog all;
RMAN> backup archivelog all delete all input;
RMAN> list archivelog all;
RMAN> list backup;

 

查看:
RMAN> list backup; 查看的是备份集
RMAN> list copy; 查看的是镜像拷贝
RMAN> list backup of tablespace users;
RMAN> list backup of datafile 4;
RMAN> list archivelog all; 查看所有归档日志
检查备份:
RMAN> delete backup; 删除备份 show all:查看RMAN各种配置 report:报告
RMAN> delete copy;
RMAN> list backup; list copy;
RMAN> report need backup; 根据策略检查
RMAN> backup tablespace users;
RMAN> report need backup;
RMAN> CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
RMAN> report need backup;
RMAN> CONFIGURE RETENTION POLICY clear;
RMAN> report obsolete; 冗余>1的 删除
删除备份:
RMAN> delete backupset of tablespace users; 指定编号的删除 不要直接删除
RMAN> delete backupset 1234;
RMAN> backup tablespace users;
RMAN> backup tablespace users;
RMAN> show all;
RMAN> delete obsolete;
crosscheck:
RMAN> delete backup;
RMAN> backup tablespace users;
RMAN> list backup of tablespace users;
$ mv /u01/app/oracle/fast_recovery_area/ORCL/backupset/… 改名
RMAN> restore datafile 4; 报错
RMAN> crosscheck backup;
RMAN> list backup of tablespace users; 报废状态
RMAN> list expired backup;
$ mv /u01/app/oracle/fast_recovery_area/ORCL/backupset/… 恢复原名
RMAN> crosscheck backup;
RMAN> list backup of tablespace users; 可用状态
RMAN> delete expired backup;
catalog:
$ cp /u01/app/oracle/fast_recovery_area/ORCL/backupset/… 复制
RMAN> delete backup;
RMAN> list backup; backupset消失
$ mv /u01/app/oracle/fast_recovery_area/ORCL/backupset/… 恢复原名
RMAN> catalog recovery area noprompt;
RMAN> list backup; backupset恢复

Oracle课程档案,第十四天

标签:ble   policy   oss   课程   rac   data   user   archive   消失   

原文地址:http://www.cnblogs.com/awdsjk/p/7374874.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!