本文《完全恢复执行和留在rollup例子》,介绍oracle的一些操作和代码。
一、将数据文件备份复制回去之后,还有执行完全恢复命令 1.recover database startup force mount recover database; ==alter database reover database; 2.recover tablespace 只能在open状态下运行 recover tablespace users; == alter database recover tablespace users; 3. recover datafile 可以在mount和open下运行 recover datafile 'd:\demo\system01.dbf'; recover datafile 1,2 ==alter database recover datafile 1,2 4、应用归根日志 指定归档日志位置后恢复 recover from 'e:\archivelog' datafile 4; 自动应用归档日志: 方法1:set autorecovery on recover datafile 5; 方法2: recover automatic datafile 5; 查看哪些数据文件需要恢复 select file#,error,change# from v$recover_file; 列表哪个日志序号开始需要应用 select sequence# from v$loghist where 1481225 between first_change# and switch_change#; 列出需要的日志 select sequence#,archive_name from v$recovry_log; 二、留在rollup例子 1.20:48:37 scott@ORCL (^ω^) select a.dname,b.job,sum(b.sal) sum_sal,grouping(a.dname),grouping(b.job) 2.20:57:43 2 from dept a,emp b 3.20:57:43 3 where a.deptno=b.deptno 4.20:57:43 4 group by a.dname,rollup(b.job) 5.20:57:45 5 / 6. 7.DNAME JOB SUM_SAL GROUPING(A.DNAME) GROUPING(B.JOB) 8.---------------------------- ------------------ ---------- ----------------- --------------- 9.SALES CLERK 950 0 0 10.SALES MANAGER 2850 0 0 11.SALES SALESMAN 5600 0 0 12.SALES 9400 0 1 13.RESEARCH CLERK 1200 0 0 14.RESEARCH ANALYST 7000 0 0 15.RESEARCH MANAGER 2975 0 0 16.RESEARCH 11175 0 1 17.ACCOUNTING CLERK 1300 0 0 18.ACCOUNTING MANAGER 2450 0 0 19.ACCOUNTING PRESIDENT 5000 0 0 20.ACCOUNTING 8750 0 1 21. 22.已选择12行。