- 最后登录
- 2013-11-17
- 在线时间
- 24 小时
- 威望
- 53
- 金钱
- 364
- 注册时间
- 2012-3-14
- 阅读权限
- 50
- 帖子
- 37
- 精华
- 0
- 积分
- 53
- UID
- 297
|
1#
发表于 2012-8-6 10:33:06
|
查看: 5359 |
回复: 5
我想用logmnr分析redlog,但是最后的结果和实际的不一致:
三次insert操作,一次delete操作,logmnr分析的结果只有一次insert操作。
不知道是哪做错了,请各位帮忙看看,谢谢!
OS:oracle linux 6.2
database:oracle 10.2.0.5
主要过程摘录:- 09:59:48 SQL> select * from v$log;
- GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIME
- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- -------------------
- 1 1 0 52428800 1 NO UNUSED 498033 2012-08-06:09:53:06
- 2 1 59 52428800 1 NO CURRENT 498188 2012-08-06:09:59:04
- 3 1 0 52428800 1 NO UNUSED 477703 2012-08-06:09:31:05
- 09:59:55 SQL>
- 在另一个session scott用户操作操作数据:
- 10:00:24 SQL> insert into tt values(1,'1');
- 1 row created.
- 10:00:42 SQL> commit;
- Commit complete.
- 10:00:45 SQL> insert into tt values(2,'2');
- 1 row created.
- 10:00:58 SQL> commit;
- Commit complete.
- 10:01:05 SQL> insert into tt values (3,'3');
- 1 row created.
- 10:01:19 SQL> insert into tt values(4,'4');
- 1 row created.
- 10:01:32 SQL> commit;
- Commit complete.
- 10:01:37 SQL> insert into tt values(5,'5');
- 1 row created.
- 10:01:48 SQL> commit;
- Commit complete.
- 10:01:51 SQL> select * from tt;
- ID NAME
- ---------- ----------
- 1 1
- 2 2
- 3 3
- 4 4
- 5 5
- -- 删除一条数据
- 10:01:58 SQL> delete from tt where id=4;
- 1 row deleted.
- 10:02:13 SQL> commit;
- Commit complete.
- -- 查看提交后结果
- 10:02:16 SQL> select * from tt;
- ID NAME
- ---------- ----------
- 1 1
- 2 2
- 3 3
- 5 5
- 10:02:21 SQL>
- 回到sys session:
- 10:02:33 SQL> select * from scott.tt;
- ID NAME
- ---------- ----------
- 1 1
- 2 2
- 3 3
- 5 5
- -- 确认当前redo log,切换日志组
- 10:02:42 SQL> select * from v$log;
- GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIME
- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- -------------------
- 1 1 0 52428800 1 NO UNUSED 498033 2012-08-06:09:53:06
- 2 1 59 52428800 1 NO CURRENT 498188 2012-08-06:09:59:04
- 3 1 0 52428800 1 NO UNUSED 477703 2012-08-06:09:31:05
- 10:02:53 SQL> alter system switch logfile;
- System altered.
- 10:03:02 SQL> select * from v$log;
- GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIME
- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- -------------------
- 1 1 60 52428800 1 NO CURRENT 498350 2012-08-06:10:03:02
- 2 1 59 52428800 1 NO ACTIVE 498188 2012-08-06:09:59:04
- 3 1 0 52428800 1 NO UNUSED 477703 2012-08-06:09:31:05
- -- 向logmnr添加文件,分析
- 10:03:12 SQL> EXECUTE DBMS_LOGMNR.ADD_LOGFILE(LOGFILENAME => '/oradata10/fac/redo02.log',OPTIONS => DBMS_LOGMNR.NEW);
- PL/SQL procedure successfully completed.
- 10:04:19 SQL> execute dbms_logmnr.start_logmnr(DICTFILENAME => '/opt/app/oracle/utlfile/fac_dict.ora');
- PL/SQL procedure successfully completed.
- -- 查看分析结果
- 10:04:29 SQL> SELECT SCN,OPERATION, SQL_REDO, SQL_UNDO,timestamp FROM V$LOGMNR_CONTENTS WHERE SEG_OWNER='SCOTT' AND SEG_NAME='TT';
- SCN OPERATION
- ---------- --------------------------------
- SQL_REDO
- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- SQL_UNDO
- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- TIMESTAMP
- -------------------
- 498229 INSERT
- insert into "SCOTT"."TT"("ID","NAME") values ('1','1');
- delete from "SCOTT"."TT" where "ID" = '1' and "NAME" = '1' and ROWID = 'AAAMB+AAEAAAAGcAAA';
- 2012-08-06:10:00:45
- 10:05:31 SQL> col sql_redo for a50
- 10:05:47 SQL> col sql_undo for a50
- 10:05:53 SQL> /
- SCN OPERATION SQL_REDO SQL_UNDO TIMESTAMP
- ---------- -------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------
- 498229 INSERT insert into "SCOTT"."TT"("ID","NAME") values ('1', delete from "SCOTT"."TT" where "ID" = '1' and "NAM 2012-08-06:10:00:45
- '1'); E" = '1' and ROWID = 'AAAMB+AAEAAAAGcAAA';
- -- 结果只看到一条数据
复制代码 详细见附件!
[local]sys session[/local]
[local]scott session[/local]
[ 本帖最后由 zhm2815 于 2012-8-6 10:40 编辑 ] |
|