Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1906700
  • 博文数量: 498
  • 博客积分: 2078
  • 博客等级: 大尉
  • 技术积分: 1645
  • 用 户 组: 普通用户
  • 注册时间: 2008-11-18 22:43
个人简介

安大

文章分类

全部博文(498)

文章存档

2017年(1)

2016年(2)

2015年(21)

2014年(90)

2013年(101)

2012年(267)

2011年(16)

分类:

2012-08-01 15:13:13

跳过归档日志的完全非常规恢复(一) http://blog.chinaunix.net/uid-22948773-id-3294762.html
跳过归档日志的完全非常规恢复(二) http://blog.chinaunix.net/uid-22948773-id-3294763.html
跳过归档日志的完全非常规恢复(三) http://blog.chinaunix.net/uid-22948773-id-3294767.html
跳过归档日志的完全非常规恢复(四) http://blog.chinaunix.net/uid-22948773-id-3294770.html
跳过归档日志的完全非常规恢复(五) http://blog.chinaunix.net/uid-22948773-id-3294773.html

 

 

步骤一、首先创建测试环境

 


 

点击(此处)折叠或打开

  1. SQL> select name from v$dbfile;

  2. NAME
  3. --------------------------------------------------------------------------------

  4. /u01/app/oracle/oradata/huateng/users01.dbf
  5. /u01/app/oracle/oradata/huateng/undotbs01.dbf
  6. /u01/app/oracle/oradata/huateng/sysaux01.dbf
  7. /u01/app/oracle/oradata/huateng/system01.dbf
  8. /u01/app/oracle/oradata/huateng/example01.dbf

  9. SQL> create tablespace htyansp datafile '/u01/app/oracle/oradata/huateng/htyansp01.dbf' size 10m;

  10. Tablespace created.

  11. SQL> create user htyansp identified by htyansp;

  12. User created.

  13. SQL> alter user htyansp default tablespace htyansp;

  14. User altered.

  15. SQL> grant dba to htyansp;

  16. Grant succeeded.

  17. SQL> alter system switch logfile;

  18. System altered.

  19. SQL> archive log list
  20. Database log mode Archive Mode
  21. Automatic archival Enabled
  22. Archive destination /archivelog
  23. Oldest online log sequence 5
  24. Next log sequence to archive 7
  25. Current log sequence 7


上面创建了一个用户htyansp 及其相应的表空间htyansp,当前的日志序列号是7

 

步骤二、对数据库做一个全备份

 


 

点击(此处)折叠或打开

  1. [oracle@db2server ~]$ rman target /

  2. Recovery Manager: Release 11.2.0.1.0 - Production on Tue Jul 31 00:09:04 2012

  3. Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.

  4. connected to target database: HUATENG (DBID=2134565240)

  5. RMAN> backup database;

  6. Starting backup at 2012-07-31 00:09:14
  7. using target database control file instead of recovery catalog
  8. allocated channel: ORA_DISK_1
  9. channel ORA_DISK_1: SID=36 device type=DISK
  10. channel ORA_DISK_1: starting full datafile backup set
  11. channel ORA_DISK_1: specifying datafile(s) in backup set
  12. input datafile file number=00001 name=/u01/app/oracle/oradata/huateng/system01.dbf
  13. input datafile file number=00002 name=/u01/app/oracle/oradata/huateng/sysaux01.dbf
  14. input datafile file number=00005 name=/u01/app/oracle/oradata/huateng/example01.dbf
  15. input datafile file number=00003 name=/u01/app/oracle/oradata/huateng/undotbs01.dbf
  16. input datafile file number=00006 name=/u01/app/oracle/oradata/huateng/htyansp01.dbf
  17. input datafile file number=00004 name=/u01/app/oracle/oradata/huateng/users01.dbf
  18. channel ORA_DISK_1: starting piece 1 at 2012-07-31 00:09:16
  19. channel ORA_DISK_1: finished piece 1 at 2012-07-31 00:10:41
  20. piece handle=/u01/app/oracle/flash_recovery_area/HUATENG/backupset/2012_07_31/o1_mf_nnndf_TAG20120731T000915_81fdfg00_.bkp tag=TAG20120731T000915 comment=NONE
  21. channel ORA_DISK_1: backup set complete, elapsed time: 00:01:25
  22. channel ORA_DISK_1: starting full datafile backup set
  23. channel ORA_DISK_1: specifying datafile(s) in backup set
  24. including current control file in backup set
  25. including current SPFILE in backup set
  26. channel ORA_DISK_1: starting piece 1 at 2012-07-31 00:10:45
  27. channel ORA_DISK_1: finished piece 1 at 2012-07-31 00:10:46
  28. piece handle=/u01/app/oracle/flash_recovery_area/HUATENG/backupset/2012_07_31/o1_mf_ncsnf_TAG20120731T000915_81fdj56h_.bkp tag=TAG20120731T000915 comment=NONE
  29. channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
  30. Finished backup at 2012-07-31 00:10:46

  31. RMAN>


 

步骤三、创建测试数据

 


 

点击(此处)折叠或打开

  1. SQL> archive log list
  2. Database log mode Archive Mode
  3. Automatic archival Enabled
  4. Archive destination /archivelog
  5. Oldest online log sequence 5
  6. Next log sequence to archive 7
  7. Current log sequence 7
  8. SQL> conn htyansp/htyansp
  9. Connected.
  10. SQL> create table test(seq varchar2(20));
  11. Table created.
  12. SQL> insert into test values('sequence 7');
  13. 1 row created.
  14. SQL> commit;
  15. Commit complete.
  16. SQL> alter system switch logfile;
  17. System altered.
  18. 当前的日志文件序列号是7,:因此上面的记录将会存放到日志序列号为7的归档日志中。
  19. SQL> insert into test values('sequence 8');
  20. 1 row created.
  21. SQL> commit;
  22. Commit complete.
  23. SQL> alter system switch logfile;
  24. System altered.
  25. SQL> insert into test values('sequence 9');
  26. 1 row created.
  27. SQL> commit;
  28. Commit complete.
  29. SQL> alter system switch logfile;
  30. System altered.
  31. SQL> insert into test values('sequence 10');
  32. 1 row created.
  33. SQL> commit;
  34. Commit complete.
  35. SQL> alter system switch logfile;
  36. System altered.
  37. SQL> insert into test values('sequence 11');
  38. 1 row created.
  39. SQL> commit;
  40. Commit complete.
  41. SQL> alter system switch logfile;
  42. System altered.
  43. SQL> select * from htyansp.test;
  44. SEQ
  45. --------------------
  46. sequence 7
  47. sequence 8
  48. sequence 9
  49. sequence 10
  50. sequence 11


 

每次插入一条记录切换一次日志,上面的记录每条记录存放到一个日志文件中。

 


 

点击(此处)折叠或打开

  1. SQL> conn / as sysdba
  2. Connected.
  3. SQL> archive log list
  4. Database log mode Archive Mode
  5. Automatic archival Enabled
  6. Archive destination /archivelog
  7. Oldest online log sequence 10
  8. Next log sequence to archive 12
  9. Current log sequence 12
  10. SQL>


 

阅读(379) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~