Help us understand the problem. What is going on with this article?

GoldenGate布教活動⑥ ~GoldenGate管理コマンド編1~

このエントリは Oracle Database or GoldenGate Advent Calendar 2018 の Day 18 の記事となります。

Oracle Database or GoldenGate Advent Calendar 2018
https://adventar.org/calendars/3525

GoldenGateは「ggsci」ユーティリティで管理を行います。

GGSCIは、Oracle GoldenGateのコマンドライン・インタフェースです。GGSCIを使用して、Oracle GoldenGateを構成、制御および監視する全種類のコマンドを発行できます。

GGSCIを起動するには、ディレクトリをOracle GoldenGateインストール・ディレクトリに変更してから、ggsci実行ファイルを実行します。

[oracle@dbvms1 gg122]$ cd /gg/gg122
[oracle@dbvms1 gg122]$ ./ggsci
Oracle GoldenGate Command Interpreter for Oracle
Version 12.2.0.1.170919 27731916_FBO
Linux, x64, 64bit (optimized), Oracle 11g on Sep  4 2018 20:23:18
Operating system character set identified as UTF-8.

Copyright (C) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
GGSCI (dbvms1) 1>

それでは各種コマンドを記載していきます。当然、こちらに記載していないコマンドも多くありますのでリファレンスをご確認の上でお試しください。

Oracle® Fusion Middleware Oracle GoldenGateリファレンスfor Windows and UNIX 12c (12.2.0.1)

VERSIONS


GoldenGateが稼働しているOSのバージョンやカーネル、ホスト名が出力されます。DBのバージョンも確認出来ます。GGのバージョン自体はggsciに接続する際に出力されるのでそちらで確認出来ます。

Operating System:
Linux
Version #2 SMP Thu Jun 14 18:55:52 PDT 2018, Release 4.1.12-124.16.4.el6uek.x86_64
Node: dbvms1
Machine: x86_64

Database:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
CORE    11.2.0.4.0      Production
TNS for Linux: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production

HELP


helpコマンドを実行することでggsci上で実行可能な一覧が出力されます。「help ADD REPLICAT」でマニュアルの記載が出力されるようですね。たくさんありますが、普段使うのは一部のコマンドなのでご安心ください。

GGSCI (dbvms1 as ggs@db112n) 4> help

GGSCI Command Summary:

Object:          Command:
SUBDIRS          CREATE
DATASTORE        ALTER, CREATE, DELETE, INFO, REPAIR
ER               INFO, KILL, LAG, SEND, STATUS, START, STATS, STOP
EXTRACT          ADD, ALTER, CLEANUP, DELETE, INFO, KILL,
                 LAG, REGISTER, SEND, START, STATS, STATUS, STOP
                 UNREGISTER
EXTTRAIL         ADD, ALTER, DELETE, INFO
GGSEVT           VIEW
JAGENT           INFO, START, STATUS, STOP
MANAGER          INFO, SEND, START, STOP, STATUS
MARKER           INFO
PARAMETERS       EDIT, VIEW, SET EDITOR, INFO, GETPARAMINFO
REPLICAT         ADD, ALTER, CLEANUP, DELETE, INFO, KILL, LAG, REGISTER, SEND,
                 START, STATS, STATUS, STOP, SYNCHRONIZE, UNREGISTER
REPORT           VIEW
RMTTRAIL         ADD, ALTER, DELETE, INFO
TRACETABLE       ADD, DELETE, INFO
TRANDATA         ADD, DELETE, INFO
SCHEMATRANDATA   ADD, DELETE, INFO
CHECKPOINTTABLE  ADD, DELETE, CLEANUP, INFO, UPGRADE
WALLET           CREATE, OPEN, PURGE
MASTERKEY        ADD, INFO, RENEW, DELETE, UNDELETE
CREDENTIALSTORE  ADD, ALTER, INFO, DELETE
HEARTBEATTABLE   ADD, DELETE, ALTER, INFO
HEARTBEATENTRY   DELETE


Commands without an object:
(Database)       DBLOGIN, LIST TABLES, ENCRYPT PASSWORD, FLUSH SEQUENCE
                 MININGDBLOGIN, SET NAMECCSID
(DDL)            DUMPDDL
(Miscellaneous)   ! ,ALLOWNESTED | NOALLOWNESTED, CREATE SUBDIRS,
                 DEFAULTJOURNAL, FC, HELP, HISTORY, INFO ALL, OBEY, SHELL,
                 SHOW, VERSIONS, VIEW GGSEVT, VIEW REPORT
                 (note: type the word COMMAND after the ! to display the
                 ! help topic, for example: GGSCI (sys1)> help ! command

shell


ggsci上からOS上のコマンドを実行する時は「shell」コマンドを使います。

GGSCI (dbvms1 as ggs@db112n) 10> shell date

2018年 12月 18日 火曜日 14:42:44 JST

!


前回のコマンドを再実行する時は「!」が使えます。SQL*Plusでの「/」や「r」あたりでしょうか。

GGSCI (dbvms1 as ggs@db112n) 10> shell date

2018年 12月 18日 火曜日 14:42:44 JST

GGSCI (dbvms1 as ggs@db112n) 11> !
shell date

2018年 12月 18日 火曜日 14:44:19 JST

INFO


INFOコマンドはGoldenGateを運用する上で一番使用するコマンドかもしれません。プロセス全体のステータスの確認、及び個別プロセスの状態を確認することが出来ます。

GGSCI (dbvms1 as ggs@db112n) 12> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING
EXTRACT     RUNNING     C11         00:00:10      00:00:02
EXTRACT     RUNNING     D11         00:00:00      00:00:02

GGSCI (dbvms1 as ggs@db112n) 13> info c11

EXTRACT    C11       Last Started 2018-12-18 09:24   Status RUNNING
Checkpoint Lag       00:00:09 (updated 00:00:08 ago)
Process ID           4425
Log Read Checkpoint  Oracle Integrated Redo Logs
                     2018-12-18 14:46:03
                     SCN 0.4747790 (4747790)


GGSCI (dbvms1 as ggs@db112n) 14>

INFO <プロセス名> showch


INFO <プロセス名> showch コマンドでGoldenGateがどの時点のREDOを読み取っているか、どこのTrailファイルを作成しているかがわかります。 よく見るポイントを★にしています。

EXTRACT    C11       Last Started 2018-12-18 09:24   Status RUNNING
Checkpoint Lag       00:00:10 (updated 00:00:04 ago)
Process ID           4425
Log Read Checkpoint  Oracle Integrated Redo Logs
                     2018-12-18 14:46:12
                     SCN 0.4747795 (4747795)


Current Checkpoint Detail:

Read Checkpoint #1

  Oracle Integrated Redo Log

  Startup Checkpoint (starting position in the data source):
    Timestamp: 2018-11-02 15:56:16.000000
    SCN: Not available

  Recovery Checkpoint (position of oldest unprocessed transaction in the data source):
    Timestamp: 2018-12-18 14:46:12.000000
    SCN: 0.4747794 (4747794)

  Current Checkpoint (position of last record read in the data source):
    Timestamp: 2018-12-18 14:46:12.000000
    SCN: 0.4747795 (4747795)    ★←現在の読み取り位置

  BR Previous Recovery Checkpoint:
    Timestamp: 2018-12-18 09:24:25.821010
    SCN: Not available

  BR Begin Recovery Checkpoint:
    Timestamp: 2018-12-18 13:24:39.000000
    SCN: 0.4745128 (4745128)

  BR End Recovery Checkpoint:
    Timestamp: 2018-12-18 13:24:39.000000
    SCN: 0.4745128 (4745128)

Write Checkpoint #1

  GGS Log Trail

  Current Checkpoint (current write position): ★←現在のTrailの書き込み位置
    Sequence #: 12                             ★←シーケンス値「12」を書き込み中 例.)lt000000012
    RBA: 1414                                  ★←RBA値(ブロックアドレス)は「1414」
    Timestamp: 2018-12-18 14:46:22.651367      ★←書き込み時点のタイムスタンプ
    Extract Trail: ./dirdat/c11/lt
    Seqno Length: 9
    Flip Seqno Length: No
    Trail Type: EXTTRAIL

Header:
  Version = 2
  Record Source = A
  Type = 13
  # Input Checkpoints = 1
  # Output Checkpoints = 1

File Information:
  Block Size = 2048
  Max Blocks = 100
  Record Length = 2048
  Current Offset = 0

Configuration:
  Data Source = 3
  Transaction Integrity = 1
  Task Type = 0

Status:
  Start Time = 2018-12-18 09:24:33
  Last Update Time = 2018-12-18 14:46:22
  Stop Status = A
  Last Result = 520

stats


statsコマンドでGoldenGateが何件のレコードを処理したかがわかります。

GGSCI (dbvms1) 3> stats c11

Sending STATS request to EXTRACT C11 ...

Start of Statistics at 2018-12-18 14:53:05.

Output to ./dirdat/c11/lt:

Extracting from GGTEST.T1 to GGTEST.T1:

*** Total statistics since 2018-12-18 14:52:54 ***
        Total inserts                                   1345.00
        Total updates                                      0.00
        Total deletes                                      0.00
        Total discards                                     0.00
        Total operations                                1345.00

*** Daily statistics since 2018-12-18 14:52:54 ***
        Total inserts                                   1345.00
        Total updates                                      0.00
        Total deletes                                      0.00
        Total discards                                     0.00
        Total operations                                1345.00

*** Hourly statistics since 2018-12-18 14:52:54 ***
        Total inserts                                   1345.00
        Total updates                                      0.00
        Total deletes                                      0.00
        Total discards                                     0.00
        Total operations                                1345.00

*** Latest statistics since 2018-12-18 14:52:54 ***
        Total inserts                                   1345.00
        Total updates                                      0.00
        Total deletes                                      0.00
        Total discards                                     0.00
        Total operations                                1345.00

End of Statistics.

GoldenGate管理コマンド編2は別途記載予定!

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away