oracle课堂随笔----第二十三天

RMAN配置

$ rman target / 或rman target sys/[email protected]

RMAN> show all; 所有备份相关设置

RMAN> CONFIGURE CONTROLFILE AUTOBACKUP On;

RMAN> CONFIGURE CONTROLFILE AUTOBACKUP clear;

RMAN> backup tablespace users;  备份表空间用户

RMAN> list backup;  查看列表

SQL> desc v$backup_set 浏览器中也可以查看

自动通道管理:

RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 2;

RMAN> backup tablespace users, example;

$ mkdir /home/oracle/disk1 /home/oracle/disk2

RMAN> configure channel 1 device type disk to destination ‘/home/oracle/disk1‘;

RMAN> configure channel 2 device type disk to destination ‘/home/oracle/disk2‘;

RMAN> backup tablespace users, example;

恢复默认

RMAN> CONFIGURE DEVICE TYPE DISK clear;

RMAN> CONFIGURE CHANNEL 1 device type disk clear;

RMAN> CONFIGURE CHANNEL 2 device type disk clear;

手动通道管理:

RMAN> run {

allocate channel c1 device type disk to destination ‘/home/oracle/disk1‘;

allocate channel c2 device type disk to destination ‘/home/oracle/disk2‘;

backup tablespace users, example;

backup (tablespace users channel c1)(tablespace example channel c2);

}

backup section size 500M datafile 1;

指定备份格式:

RMAN> backup tablespace users; 备份集 bs

RMAN> backup as compressed backupset tablespace users;压缩备份集

RMAN> backup as copy tablespace users;镜像备份

RMAN> list backup of tablespace users;

RMAN> list copy of tablespace users;

备份的加密:

RMAN备份

不归档 归档

online offline online offline

完全  部分 完全  部分                完全  部分  完全  部分

shutdown nomount mount open

备份数据文件:

SQL> select file_id, file_name from dba_data_files;

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;

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> alter database enable block change tracking using file ‘/home/oracle/blk_trk.chg‘;

需要重新连接会话

SQL> select * from v$block_change_tracking;

SQL> select DATAFILE_BLOCKS, BLOCKS_READ, BLOCKS, USED_CHANGE_TRACKING from v$backup_datafile where INCREMENTAL_LEVEL>0;

SQL> create table t3(x int) tablespace users;

SQL> insert into t3 values (1);

SQL> commit;

RMAN> backup incremental level 1 tablespace users;

SQL> select DATAFILE_BLOCKS, BLOCKS_READ, BLOCKS, USED_CHANGE_TRACKING from v$backup_datafile where INCREMENTAL_LEVEL>0;

SQL> alter database disable block change tracking; 关闭

增量更新:

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; 删除备份

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恢复

时间: 2024-11-08 20:18:13

oracle课堂随笔----第二十三天的相关文章

oracle课堂随笔---第二十二天

备份恢复 配置可恢复性 冗余 控制文件   (镜像) SQL> show parameter control_files SQL> select * from v$controlfile; 修改路径: $ cd $ORACLE_HOME/dbs $ cp spfileorcl.ora spfileorcl.ora.bak SQL> alter system set control_files='/u01/app/oracle/oradata/orcl/control01.ctl', '/

oracle课堂笔记--第十三天

自连接: empid ename mgrid 100 abc 101 def 100 102 xyz 100 emp: mgr: empid ename mgrid empid mgrname 100 abc 100 abc 101 def 100 102 xyz 100 101 def 100 100 abc 102 xyz 100 100 abc select emp.ename, mgr.mgrname from emp, mgr where emp.mgrid=mgr.empid emp

oracle课堂随笔--第十七天

数据字典/动态性能视图 SQL> conn hr/hr SQL> desc user_tables  当前用户名下所有的表 SQL> select TABLE_NAME from user_tables; SQL> desc user_views SQL> select VIEW_NAME from user_views; SQL> desc user_indexes SQL> select INDEX_NAME, TABLE_NAME from user_ind

oracle课堂随笔--第十六天

实例管理 监听 启动监听: $ netstat -tlnp | grep 1521 $ lsnrctl LSNRCTL> help $ lsnrctl status $ lsnrctl stop $ netstat -tln | grep 1521 快速动态注册:(可选) $ sqlplus / as sysdba SQL> alter system register; $ lsnrctl status em 启动EM: $ netstat -tlnp | grep 1158 $ echo $

oracle课堂随笔--第十四天

集合操作 select employee_id, job_id from employees union all          不去除  保留重复值 select employee_id, job_id from job_history; select employee_id, job_id from employees Union                去除重复值 select employee_id, job_id from job_history; select employe

第二十三课

第二十三课第一单元语法部分 Vておく<提前>:预先…… 口语形式:-とく 说明:   A.表示为后面要做的事情事先做好某种准备. B.表示采取某种行为,并使其结果的状态持续下去.   C.有时表示一种临时的措施. 例句:     1 日本へ行く前に日本語を習っておくつもりだ.    2 電気は消さないで 練習: 1.事先打个电话问一.朝までつけておこう.    3 その場で一応の手当てをしておいて.病院へ連れていった.下比较好 2.预先磨好刀. Vてある<客体存续的状态>: 说明:

扣响C#之门笔记--第二十三章

23.1 泛型的概念 (1)在普通集合中,元素均被看做是object类型,会有以下缺点(a)赋值时候将类型转为object,使用时候又将object转为对应的类型,在装箱和拆箱时候造成一定性能损失:(b)任何类型的数据都可以放进集合里面,不利于类型安全检查: static void Main(string[] args) { Queue q = new Queue(); q.Enqueue(10); q.Enqueue("wo"); // q.Enqueue(1); foreach (

NeHe OpenGL教程 第二十三课:球面映射

转自[翻译]NeHe OpenGL 教程 前言 声明,此 NeHe OpenGL教程系列文章由51博客yarin翻译(2010-08-19),本博客为转载并稍加整理与修改.对NeHe的OpenGL管线教程的编写,以及yarn的翻译整理表示感谢. NeHe OpenGL第二十三课:球面映射 球面映射: 这一个将教会你如何把环境纹理包裹在你的3D模型上,让它看起来象反射了周围的场景一样. 球体环境映射是一个创建快速金属反射效果的方法,但它并不像真实世界里那么精确!我们从18课的代码开始来创建这个教程

[Effective Java 读书笔记] 第三章类和接口 第二十三-- ??条

第二十三条 请不要再新代码中使用原生态类型 1 使用原生态类型,就失去了泛型在安全性和表述性方面的所有优势,所以新代码中不要使用原生态类型 2 List<String>可以传递给List作为的参数,但是不能传递给List<Object>,因为泛型有子类型化的规则,List<String>是原生态类型List的一个子类型,而不是参数化类型List<Object>的子类型 3. 如果不确定类型,可以使用通配符类型 Set<?>,