Monday, September 6, 2010

Useful GoldenGate commands - SHELL, OBEY, HELP, HISTORY,VERSIONS

There are a number of other useful GoldenGate commands which we can run from the GGSCI interface. The GoldenGate Reference Guide has information in more detail, but I have tried out a few and found some to be very useful which I am highlighting below.


HISTORY: To view a list of the most recently issued GGSCI commands since the GGSCI session started


GGSCI (linux01.kim.com) 4> history
GGSCI Command History
1: show all
2: info all
3: start extract ext3
4: history


! : Use the ! command to execute a previous GGSCI command without modifications.


GGSCI (linux01.kim.com) 3> info extract ext3
EXTRACT EXT3 Last Started 2010-07-21 14:29 Status RUNNING
Checkpoint Lag 01:07:22 (updated 00:00:02 ago)
Log Read Checkpoint Oracle Redo Logs
2010-07-21 13:22:28 Seqno 188, RBA 49576960


GGSCI (linux01.kim.com) 4> !
info extract ext3
EXTRACT EXT3 Last Started 2010-07-21 14:29 Status RUNNING
Checkpoint Lag 01:07:22 (updated 00:00:04 ago)
Log Read Checkpoint Oracle Redo Logs
2010-07-21 13:22:28 Seqno 188, RBA 49576960

We can also use a combination of “!” and HISTORY to run a particular command listed in the history. For example, to run the command 3 listed in the history, we can just run “! 3″.


VERSIONS: to display operating system and database version information. Use DBLOGIN to connect to the database first


GGSCI (linux01.kim.com) 11> dblogin userid ggs_owner, password ggs_owner
Successfully logged into database.
GGSCI (linux01.kim.com) 12> versions
Operating System:
Linux
Version #1 SMP Mon Mar 29 20:19:03 EDT 2010, Release 2.6.18-194.el5PAE
Node: linux01.kim.com
Machine: i686
Database:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 – Production
PL/SQL Release 11.1.0.6.0 – Production
CORE 11.1.0.6.0 Production
TNS for Linux: Version 11.1.0.6.0 – Production
NLSRTL Version 11.1.0.6.0 – Production


SHELL: to execute shell commands from within the GGSCI interface.


GGSCI (linux01.kim.com) 13> shell ls -l /home/oracle/goldengate/dirdat/
total 50588
-rw-rw-rw- 1 oracle oinstall 985 Jul 16 14:57 lt000000
-rw-rw-rw- 1 oracle oinstall 9999629 Jul 19 13:09 lt000001


HELP: to obtain information about a GoldenGate command. The basic command returns a list of command categories and the associated commands.

GGSCI (linux01.kim.com) 15> help
GGSCI Command    Summary
SUBDIRS          CREATE SUBDIRS
ER               INFO ER, KILL ER, LAG ER, SEND ER, STATUS ER,
                START ER, STATS ER, STOP ER
EXTRACT          ADD, ALTER, CLEANUP, DELETE, INFO, KILL,
                LAG, SEND, START, STATS, STATUS, STOP
EXTTRAIL         ADD, ALTER, DELETE, INFO
GGSEVT           VIEW
MANAGER          INFO, REFRESH, SEND, START, STOP, STATUS
MARKER           INFO
PARAMS           EDIT, VIEW
REPLICAT         ADD, ALTER, CLEANUP, DELETE, INFO, KILL,
                LAG, SEND, START, STATS, STATUS, STOP
REPORT           VIEW
RMTTRAIL         ADD, ALTER, DELETE, INFO
TRACETABLE       ADD, DELETE, INFO
TRANDATA         ADD, DELETE, INFO
Database         DBLOGIN, LIST TABLES,
                ENCRYPT PASSWORD
DDL              DUMPDDL
CHECKPOINTTABLE  ADD CHECKPOINTTABLE, DELETE CHECKPOINTTABLE,
                CLEANUP CHECKPOINTTABLE, INFO CHECKPOINTTABLE
Miscellaneous    FC, HELP, HISTORY, INFO ALL, INFO MARKER, OBEY,
                SET, SHELL, SHOW, VERSIONS, !

For help on a specific command, type HELP  [command] [object]

Example: HELP ADD REPLICAT


OBEY: to process a file that contains a list of GoldenGate commands. OBEY is useful for executing commands that are frequently used in sequence. Suppose we want to run some Goldengate commands and execute those from a Unix shell script which can be called via say cron. So we have a start_goldgate.sh shell script which will use the GGSCI command OBEY to call a text file which has the Goldengate commands which we would like to run in sequence.


[oracle@linux01 goldengate]$ cat start_goldgate.sh
cd /home/oracle/goldengate
./ggsci < EOF
OBEY /home/oracle/goldengate/startup.txt
EOF


[oracle@linux01 goldengate]$ cat startup.txt
START MANAGER
START EXTRACT EXT3
START EXTRACT DPUMP
INFO ALL


[oracle@linux01 goldengate]$ ./start_goldgate.sh
Oracle GoldenGate Command Interpreter for Oracle
Version 10.4.0.19 Build 002
Linux, x86, 32bit (optimized), Oracle 11 on Sep 29 2009 08:50:50

Copyright (C) 1995, 2009, Oracle and/or its affiliates.  All rights reserved.

GGSCI (linux01.kim.com) 1>
GGSCI (linux01.kim.com) 2> START MANAGER

Manager started.

GGSCI (linux01.kim.com) 3> START EXTRACT EXT3

EXTRACT EXT3 is already running.

GGSCI (linux01.kim.com) 4> START EXTRACT DPUMP

EXTRACT DPUMP is already running.

GGSCI (linux01.kim.com) 5> INFO ALL

Program     Status      Group       Lag           Time Since Chkpt
MANAGER     RUNNING
EXTRACT     RUNNING     DPUMP       00:00:00      00:00:01
EXTRACT     ABENDED     EXT2        00:00:00      172:36:58
EXTRACT     RUNNING     EXT3        00:00:00      00:00:04

No comments: