重庆思庄Oracle、Redhat认证学习论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3114|回复: 3
打印 上一主题 下一主题

[参考文档] oracle 11g logminer字段USERNAME 为unknown的处理

[复制链接]
跳转到指定楼层
楼主
发表于 2018-8-31 17:02:45 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式


                               
登录/注册后可看大图

Applies to:  Oracle Database - Enterprise Edition - Version 8.1.7.0 and later
Information in this document applies to any platform.
***Checked for relevance on 29-Jul-2013***
SymptomsYou have just built the LogMiner dictionary and started the LogMiner session. You query V$LOGMNR_CONTENTS expecting to see the USERNAME and SESSION_INFO for some particular redo or undo operation.

However, the USERNAME field is NULL. This is NOT a recursive operation, and the USERNAME column is expected to contain a non-null value.
Cause
  • If supplemental logging was not active at the time when the redo records were created, then LogMiner won't be able to obtain all the required information. The Oracle Database Utilities manual mentions:
    By default, Oracle Database does not provide any supplemental logging, which means that by default LogMiner is not usable. Therefore, you must enable at least minimal supplemental logging prior to generating log files which will be analyzed by LogMiner.
    So, we have to enable supplemental logging by using a SQL statement similar to the following:
    SQL> CONNECT / AS SYSDBA
    SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;


    Then the information necessary to populate the USERNAME and SESSION_INFO columns will be stored in the redo stream.
  • The redo stream does not contain the USERNAME and SESSION_INFO data for every transaction. This information is only stored for the first transaction executed in the user's session. So in order to be able to see this information in V$LOGMNR_CONTENTS, all the redo generated during the entire session must be added to the mining session. Should this not be done, then the USERNAME and SESSION_INFO columns will remain empty.
  • LogMiner was first available in Oracle8i. If the COMPATIBLE instance parameter is set to a value lower than 8.1.0 you will not have access to its full functionality.
  • In Oracle9i and lower releases of Oracle, the TRANSACTION_AUDITING instance parameter is set to TRUE by default. This causes the generation of a redo record containing the user logon name, username, session ID, and some operating system and client information. For each successive transaction in the session, Oracle will store only the session ID. These session IDs are linked back to the first record to retrieve user and session information.

    When TRANSACTION_AUDITING is set to FALSE, this redo record is not written and the user information is not available to LogMiner.
SolutionThis can result from your database parameter settings and also from the method you are using to mine redo logs using LogMiner.


  • Ensure that database was in minimum supplemental logging at the time that the redo information was created:
    SQL> SELECT name, supplemental_log_data_min FROM v$database;

    NAME                           SUPPLEME
    ------------------------------ --------
    M10202WA                       YES

  • Ensure that all archive redo logs containing the necessary redo information have been added to the LogMiner session.
  • Ensure that the COMPATIBLE initialization parameter is set to 8.1.0 or higher.
    SQL> show parameter compatible

    NAME                                 TYPE        VALUE
    ------------------------------------ ----------- ----------
    compatible                           string      10.2.0.2.0

  • For Oracle8i and Oracle9i only: ensure that the TRANSACTION_AUDITING instance parameter is set to TRUE (default).
    SQL> show parameter transaction_auditing

    NAME                                 TYPE        VALUE
    ------------------------------------ ----------- ----------
    transaction_auditing                 boolean     TRUE










分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

沙发
 楼主| 发表于 2018-8-31 17:05:41 | 只看该作者
其实就是开启最小追加日志数据:


sql> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;

之后,再去查询 :

SELECT name, supplemental_log_data_min FROM v$database;

回复 支持 反对

使用道具 举报

板凳
 楼主| 发表于 2018-8-31 17:10:03 | 只看该作者
这个最小追加日志没有打开,在 flashback_transaction_query中,sql_undo列将是空的
同时,通过logminer取出的数据,有关客户信息部分,包含machine_info,username,client_info等等都是空的
回复 支持 反对

使用道具 举报

地板
发表于 2018-9-3 21:36:33 | 只看该作者
谢谢,记下来了。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2024-5-17 10:18 , Processed in 0.114904 second(s), 19 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表