ogg logdump详解

1.查看record header:
To view the record header with the data:
Logdump 1> GHDR ON
The record header contains information about the transaction.


2.添加列信息,列信息包括使用hex和ascii的编码显示的长度:
To add column information:
Logdump 2> DETAIL ON
Column information includes the number and length in hex and ASCII.


3.添加列的值,以hex和ascii显示:
To add hex and ASCII data values to the column information:
Logdump 3> DETAIL DATA


4.查看user tokens:
To view user tokens:
Logdump 4> USERTOKEN ON
User tokens are custom user-defined information that is specified in a TABLEor
FILEmapping statement and stored in the trail file for specific purposes.


5.查看gg自动的tokens:
To view automatically generated tokens:
Logdump 4> GGSTOKEN ON
Oracle GoldenGate automatically generated tokes include the transaction ID (XID),
the row id for DML operations, the fetchingstatus (if applicable), and tag value.


6.控制一次显示多少条记录:
To control how much record data is displayed:
Logdump 5> RECLEN length


7.打开一个trail文件
Open a file with the following command:
Logdump 6> OPEN file_name
Where:
file_nameis either the relative name or fully qualified name of the file, including
the file sequence number. For example:
open /home/ggs/dirdat/jd000000
open $data01.glogggl.aa000000


8.显示下一个记录
To go to the first record and then move through records in sequence:

Logdump 7> NEXT


9.搜索下一个记录的头部信息
To find the next good record header, enter the following command:
Logdump 8> SCANFORHEADER



通过TransInd可以知道这个sql是在事务中的哪个位置,x00是第一条sql,x01是中间的sql,x02是最后一条sql,如果是x03表示这个事务里面只有一条sql:
Transaction Indicator Description
TransInd : . (x00) First statement in transaction
TransInd : . (x01) Statement in middle of transaction
TransInd : . (x02) Last statement in transaction
TransInd : . (x03) Sole statement in transaction
如果TransInd是x02或者x03,那么下一个记录的TransInd必然是x00,是一个新的事务的开始:
When TransInd is eitherx02
or x03, the TransIndof the next record should be x00, starting a new transaction
或者使用SFET,查找事务的结尾:
To scan for the end of a transaction, enter the following command:
Logdump 20> SCANFORENDTRANS


10.跳转到指定的rba:
■ To go to an RBA anywhere in the file:
Logdump 35> POS 9
Logdump 36> N
This displays the record located at that RBA.
跳转到第一个记录:
■ To go to the first record in the file:
Logdump 37> POS FIRST
Alternatively, you can enter the following command:
Logdump 37> POS 0


11.过滤掉你不想看的表,只看你想看的表
To filter out everything except records containing a specific table name:
On a Windows or UNIX system:
Logdump 60> FILTER INCLUDE FILENAME [container| catalog] schema.table
注意:这里你想看哪个表就写哪个表,其它表的信息将被过滤。经过测试schema.table必须要用大写
清除过滤信息
To remove the current filter criteria, enter the following command:
Logdump 62> FILTER CLEAR
多条件的过滤:
To filter on multiple conditions, enter one of the following commands:
■ Logdump 60> FILTER INCLUDE FILENAME $volume.subvolume...file..; FILTER
RECTYPE record_type; FILTER MATCH ALL
■ Logdump 60> FILTER INCLUDE ANSINAME catalog.schema.table; FILTER
RECTYPE record_type; FILTER MATCH ALL
■ Logdump 65> FILTER INCLUDE FILENAMEschema.table; FILTER RECTYPE
record_type; FILTER MATCH ALL


例如:
Logdump 201 >filter include filename TEST2.TDATE;FILTER rectype insert;filter match all
Logdump 202 >count
LogTrail /ogg/oracle/dirdat/lt000012 has 1 records
Total Data Bytes                 25
  Avg Bytes/Record               25
Insert                            1
After Images                      1
Filtering matched            1 records
          suppressed         8 records

Average of 1 Transactions
    Bytes/Trans .....         73
    Records/Trans ...          1
    Files/Trans .....          1


TEST2.TDATE                                        Partition 4
Total Data Bytes                 25
  Avg Bytes/Record               25
Insert                            1
After Images                      1

这个例子中只看TEST2.TDATE的insert操作,过滤了8条其它的操作!

这里也可以使用数字代表rectype,例如:
Logdump 207 >filter include filename TEST2.TDATE;FILTER rectype 115;filter match all 
Logdump 105 >show RECTYPE
LogTrail record types
    1 - Abort                             2 - Commit                  
    3 - Delete                            4 - EndRollBack             
    5 - Insert                            6 - Prepared                
    7 - TMF-Shutdown                      8 - TransBegin              
    9 - TransRelease                     10 - Update                  
   11 - UpdateComp                       12 - FileAlter               
   13 - FileCreate                       14 - FilePurge               
   15 - FieldComp                        16 - FileRename              
   17 - AuxPointer                       18 - NetworkCommit           
   19 - NetworkAbort                     20 - CurrentPos              
   90 - GGSSQLCol                       100 - GGSPurgedata            
  108 - GGSPurgedataPartonly            101 - GGSPurgeFile            
  102 - GGSCreateFile                   103 - GGSAlterFile            
  104 - GGSRenameFile                   105 - GGSSetmode              
  107 - GGSControl                      106 - GGSChangeLabel          
  115 - GGSPKUpdate                     135 - GGSUnifiedPKUpdate      
  134 - GGSUnifiedUpdate                117 - GGSPKUpdate32           
  116 - LargeObject                     132 - Sequence OP             
  150 - RestartAbend                    151 - RestartOK               
  152 - RecoveryEnd                     160 - DDLOP                   
  161 - RecordFragment                  200 - GGSBulkio               
  201 - GGSFileClose                    202 - GGSLoggerTS             
  203 - GGSExtractTS                    204 - GGSCollectTS            
  205 - GGSComment                      250 - LibOpenTrace            
  251 - LibCloseTrace                   252 - LoggerOpenTrace         
  253 - LoggerCloseTrace                254 - LoggerAddedInfo         
  249 - LoggerAddedStats                255 - FileHeader 

filter_optioncan be one of:
{
ANSINAME name[, name] |
AUDITRBA rba[comparison_operator] |
CLEAR {filter_spec| ALL} |
CSN | LogCSN [comparison_operator] [value]
ENDTIME time_string|
FILENAME name[, name] |
GGSTOKEN token_name[comparison_operator] [token_value] |
HEX "hex_string" [byte_range][, "hex_string" [byte_range]] [...] |
INT16 16_bit_integer|
INT32 32_bit_integer|
IOTYPE operation_type[, operation_type] |
MATCH {ANY | ALL} |
OFF |
ON |
PROCESS process_name|
RBA byte_address[comparison_operator] [...] |
RECLEN length[comparison_operator] |
RECTYPE {type_number| type_name} |
SHOW |
STARTTIME time_string|
STRING [BOTH] [B],text[column_range]
[[B],text[column_range]] [...] |
SYSKEY system_key[comparison_operator] [...] |
TRANSID transaction_identifier|
TRANSIND indicator[comparison_operator] |
TYPE type|
UNDOFLAG type[comparison_operator] |
USERTOKEN token_name[comparison_operator] [token_value]
}

12.显示汇总信息,包括表做了多是操作等等
The following command shows a count summary followed by counts for each table or
data file:
Logdump 67> COUNT

例1,统计时间间隔:
COUNT START 2011-01-11 12:00:00 , END 2011-01-12 12:00:00
例2,统计dirtdat目录下所有lt开头的trail文件信息
Logdump 308 >count log lt*
Current LogTrail is /ogg/oracle/dirdat/lt000010
LogTrail /ogg/oracle/dirdat/lt000010 has 68 records
LogTrail /ogg/oracle/dirdat/lt000010 closed
Current LogTrail is /ogg/oracle/dirdat/lt000007
LogTrail /ogg/oracle/dirdat/lt000007 has 4 records
LogTrail /ogg/oracle/dirdat/lt000007 closed
Current LogTrail is /ogg/oracle/dirdat/lt000008
LogTrail /ogg/oracle/dirdat/lt000008 has 117 records
LogTrail /ogg/oracle/dirdat/lt000008 closed
Current LogTrail is /ogg/oracle/dirdat/lt000011
LogTrail /ogg/oracle/dirdat/lt000011 has 1625 records
LogTrail /ogg/oracle/dirdat/lt000011 closed
Current LogTrail is /ogg/oracle/dirdat/lt000012
LogTrail /ogg/oracle/dirdat/lt000012 has 9 records
LogTrail /ogg/oracle/dirdat/lt000012 closed
Current LogTrail is /ogg/oracle/dirdat/lt000009
LogTrail /ogg/oracle/dirdat/lt000009 has 2 records
LogTrail /ogg/oracle/dirdat/lt000009 closed
LogTrail lt* has 1825 records
例3、count detail 
显示所有的操作,而不是统计。

13.save保存文件
save命令将当前的trail文件中的记录保存到其它文件中,一般trail文件比较大,不方便分析,
用save将部分的记录保存到其它文件中,并且可以用ogg继续分析这个文件,方便分析
Use SAVEto write a subset of the records to a new trail or extract file. By saving a
subset to a new file, you can work with a smaller file that is easier to debug. Saving to
another file also enables you to extract valid records that can be processed by Oracle
GoldenGate, while excluding records that may be causing errors.
To set the version of the trail or file (to old or new format), use the TRAILFORMAT command.
SAVE file_name[!] {nrecords | nbytes}
[NOCOMMENT]
[OLDFORMAT | NEWFORMAT]
[TRANSIND indicator]
[TRUNCATE]
To save the whole file, enter the following command, where fileis the name of the
new file:
Logdump 68> SAVE file
To save a subset of records, enter the following command:
Evaluating Transaction Size
Using the Logdump Utility 1-7
Logdump 69> SAVE file nRECORDS

Logdump 47 >save aaa 3 records
Saved 3 records to /ogg/oracle/dirdat/aaa
Logdump 48 >ls
aaa  lr000012  lt000008  lt000009  lt000010  lt000011  lt000012
Logdump 52 >open aaa
Current LogTrail is /ogg/oracle/dirdat/aaa
Logdump 53 >count
LogTrail /ogg/oracle/dirdat/aaa has 4 records
Total Data Bytes               1401
  Avg Bytes/Record              350
Insert                            2
RestartOK                         1
Others                            1
After Images                      3

Average of 3 Transactions
    Bytes/Trans .....        531
    Records/Trans ...          1
    Files/Trans .....          1

14.自动打开下一个trail文件
To close the current file and open the next one in the trail, enter the following
command:
Logdump 70> NEXTTRAIL


16.打开一个日志,记录你的操作,类似于spool
To start logging, enter the following command:
Logdump 71> LOG TO filename.txt
To write text to the log:
Logdump 72> WRITELOG "text"
To stop logging:
Logdump 73> LOG STOP


17.env显示logdump的环境变量,还会显示trail的一些信息:

To see the current Logdump environment, enter the following command:
Logdump 228 >env
Version             : Linux, x64, 64bit (optimized) on Aug  7 2014 05:41:04

Current Directory   : /ogg/oracle
LogTrail            : /ogg/oracle/dirdat/lt000012
Trail Format        : New
End of File         : 2311
Current Position    : 1374    Forward
Next Position       : 1435
Last Modtime        : 2015/09/13 09:12:55.000.000
Display RecLen      : 16960
Logtrail Filter     : On
Show Ghdr           : On 
Detail              : Data 
UserToken           : On 
Trans History       : 0 Transactions, Records 100, Bytes 100000
LargeBlock I/O      : On, Blocksize 57344
Local System        : LittleEndian
Metadata Byte Order : BigEndian   
Logtrail Data       : BigEndian/ASCII
Logtrail Headers    : ASCII
Dump                : ASCII
Savefile comments   : Off
Timeoffset          : LOCAL
Scan Notify Interval: 10000 records, Scrolling On

18.设置trans大小,用来跟踪事务的大小
a. Use TRANSHISTto set the size of the history table that tracks transaction size. The
maximum size is 200 bytes. A value of 0 turns off the tracking
TRANSHIST n
--设置两个参数transreclimt和transbytelimit来设置阀值,当事务的大小或者记录数超过阀值的时候被跟踪,而且在count命令下会显示出来
b. Use either the TRANSRECLIMITor TRANSBYTELIMITcommand to set a lower
boundary for what is considered a normal sized transaction. These commands
prevent normal-sized transactions from being tracked. Eliminating normal-sized
transactions reduces the amount of data that must be reviewed.
{TRANSBYTELIMIT n bytes| TRANSRECLIMIT n records}


19.logdump的历史命令会写在下面几个目录中,一般是在$HOME下的logdump.hst
■ The USERPROFILEenvironment variable.
■ The $HOMEenvironment variable.
■ The default $vol.subvol19.begin设置一个时间,用来查找这个时间附近的记录
Use BEGINto do a binary search through a TMF orOracle GoldenGate trail to locate a
record at or near the specified time.
Logdump 284 >begin 2015/09/13 07:24:03


20.BULKIOSTATS用来显示物理和逻辑读和平均读取时间
Use BULKIOSTATSto display statistics for bulk I/O records, including the number of
physical and logical reads and current and average read times.


21.用COMPUTETIMESTAMP转换时间格式为julian格式
Use COMPUTETIMESTAMP to convert a datetime string to Julian format.
Logdump 290 >computetimestamp 2015-09-13 02:31:16
2015-09-13 02:31:16 is JulianTimestamp 212308871476000000


22.如果trail文件是加密的,使用decrypt命令进行解密
Use DECRYPTto decrypt data that was encrypted with Oracle GoldenGate trail
encryption, so that it can be viewed with Logdump.
Example
DECRYPT ON
Example
DECRYPT ON KEYNAME mykey


23.FLOAT命令将number转换成hex和float行number
Use FLOATto display a number or hex string inboth its hex representation and as a
floating-point number. This command is useful when looking for a specific
floating-point number and you need the hex representation of that number. This
command does not require a trail file to be opened
Logdump 21 >float 5
4014000000000000  5.000000


24.SCANFORHEADER/SFH寻找下一条记录的头部
25.SCANFORENDTRANS/SFET寻找下一条记录的尾部信息  
26.SCANFORRBA/SFR 寻找字节附件的记录             SCANFORRBA 321 /home/ggs/dirdat/rt000000
27.SCANFORTIME/SFTS寻找某个时间点的记录       SCANFORTIME 2011-01-27 14:33:57
28.SCANFORTYPE/SFT  寻找下一条指定类型的记录 SHOW RECTYPE查看操作类型 SCANFORTYPE Commit 、SFT 2
29.show显示logdump的内部信息:
Use SHOW to display internal Logdump information
SHOW
[ENV]
[FILTER]
[OPEN]
[RECTYPE]


30.skip跳过多少条记录
Use SKIPto skip the specified number of records.


31.obey  执行文件中的一系列命令

OBEY file_name


32.fc显示并执行上一条命令

fc

fc n






评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值