有人问:请问oracle中如何查那些表加了表级附加日志?
https://www.modb.pro/issue/26805
方法1:直接输出info trandata 用户名.*结果记录存成t.txt,然后grep “enabled for table” t.txt过滤下就出来了
GGSCI (ora02) 3> dblogin USERIDALIAS jyc
Successfully logged into database CDB$ROOT.
GGSCI (ora02 as c##oggadmin@jyc/CDB$ROOT) 4> add trandata jyc.*
ERROR: The catalog name is missing. Fully qualified name for table jyc.* is required for root database.
GGSCI (ora02 as c##oggadmin@jyc/CDB$ROOT) 5> add trandata jycdb.jyc.*
2023-07-05 13:46:46 INFO OGG-15132 Logging of supplemental redo data enabled for table JYCDB.JYC.J.
2023-07-05 13:46:46 INFO OGG-15133 TRANDATA for scheduling columns has been added on table JYCDB.JYC.J.
2023-07-05 13:46:46 INFO OGG-15135 TRANDATA for instantiation CSN has been added on table JYCDB.JYC.J.
2023-07-05 13:46:46 INFO OGG-15132 Logging of supplemental redo data enabled for table JYCDB.JYC.T.
2023-07-05 13:46:46 INFO OGG-15133 TRANDATA for scheduling columns has been added on table JYCDB.JYC.T.
2023-07-05 13:46:46 INFO OGG-15135 TRANDATA for instantiation CSN has been added on table JYCDB.JYC.T.
2023-07-05 13:46:46 INFO OGG-15132 Logging of supplemental redo data enabled for table JYCDB.JYC.TEST.
2023-07-05 13:46:46 INFO OGG-15133 TRANDATA for scheduling columns has been added on table JYCDB.JYC.TEST.
2023-07-05 13:46:46 INFO OGG-15135 TRANDATA for instantiation CSN has been added on table JYCDB.JYC.TEST.
2023-07-05 13:46:47 INFO OGG-10471 ***** Oracle Goldengate support information on table JYC.J *****
Oracle Goldengate support native capture on table JYC.J.
Oracle Goldengate marked following column as key columns on table JYC.J: ID.
2023-07-05 13:46:47 INFO OGG-10471 ***** Oracle Goldengate support information on table JYC.T *****
Oracle Goldengate support native capture on table JYC.T.
Oracle Goldengate marked following column as key columns on table JYC.T: ID.
2023-07-05 13:46:47 INFO OGG-10471 ***** Oracle Goldengate support information on table JYC.TEST *****
Oracle Goldengate support native capture on table JYC.TEST.
Oracle Goldengate marked following column as key columns on table JYC.TEST: ID.
把以下info trandata jycdb.jyc.*记录操作日志为t.txt,最后在过滤t.txt即可显示表名
GGSCI (ora02 as c##oggadmin@jyc/CDB$ROOT) 7> info trandata jycdb.jyc.*
2023-07-05 13:48:15 INFO OGG-06480 Schema level supplemental logging, excluding non-validated keys, is enabled on schema "JYC".
2023-07-05 13:48:15 INFO OGG-01980 Schema level supplemental logging is enabled on schema "JYC" for all scheduling columns.
2023-07-05 13:48:15 INFO OGG-10471 ***** Oracle Goldengate support information on table JYC.J *****
Oracle Goldengate support native capture on table JYC.J.
Oracle Goldengate marked following column as key columns on table JYC.J: ID.
Logging of supplemental redo log data is enabled for table JYCDB.JYC.J.
Columns supplementally logged for table JYCDB.JYC.J: "ID".
Prepared CSN for table JYCDB.JYC.J: 5932218
2023-07-05 13:48:15 INFO OGG-10471 ***** Oracle Goldengate support information on table JYC.T *****
Oracle Goldengate support native capture on table JYC.T.
Oracle Goldengate marked following column as key columns on table JYC.T: ID.
Logging of supplemental redo log data is enabled for table JYCDB.JYC.T.
Columns supplementally logged for table JYCDB.JYC.T: "ID".
Prepared CSN for table JYCDB.JYC.T: 5932091
2023-07-05 13:48:15 INFO OGG-10471 ***** Oracle Goldengate support information on table JYC.TEST *****
Oracle Goldengate support native capture on table JYC.TEST.
Oracle Goldengate marked following column as key columns on table JYC.TEST: ID.
Logging of supplemental redo log data is enabled for table JYCDB.JYC.TEST.
Columns supplementally logged for table JYCDB.JYC.TEST: "ID".
Prepared CSN for table JYCDB.JYC.TEST: 5932134
方法2:查询视图dba_log_groups和dba_log_group_columns
select distinct g.owner || '.' || g.table_name table_name
from dba_log_groups g, dba_log_group_columns c
where g.log_group_name = c.log_group_name(+)
and g.table_name = c.table_name(+)
and g.owner = '用户名';

查看详细字段的情况下:
select g.log_group_name name,
g.owner || '.' || g.table_name table_name,
g.always,
g.generated,
c.column_name
from dba_log_groups g, dba_log_group_columns c
where g.log_group_name = c.log_group_name(+)
and g.table_name = c.table_name(+)
and g.table_name = 'T'
and g.owner = 'JYC'
order by 1, 2, 3, 4;

相关参考:https://www.cnblogs.com/remote-antiquity/p/7106515.html
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




