Quantcast
Channel: ATeam Chronicles
Viewing all articles
Browse latest Browse all 255

Oracle GoldenGate: Using the GGSCI !, History, and FC Commands

$
0
0

Introduction

The Oracle GoldenGate Command Interpreter (GGSCI) contains three commands that can be used to reduce the amount of typing required to interact with the product. These commands come in handy when troubleshooting, monitoring, and configuring large environments; or if, like myself, you are QWERTY keyboard challenged. This article discusses the function and use of the GGSCI History, ! (Bang), and FC (Fix/Change) commands.

Main Article

Here is an example GGSCI prompt:
GGSCI (oelr5u7) 27>

The prompt consists of three parts:
GGSCI
An identifier signifying that you are running the Oracle GoldenGate Command Interpreter.
(oelr5u7)
Identifies the server where you are running GGSCI.
27>
 A numeric command line indicator
As commands are executed, the line count increments. Not only is this an indicator of how many commands you have executed during the GGSCI session, it is a reference to an item inside of a buffer. When GGSCI is started, buffer space is allocated and used to store all of the commands executed during the session. In the example above, twenty-seven commands have been executed during this GGSCI session; so there will be twenty-seven elements in the buffer array. The buffer elements may be accessed via the GGSCI History, ! (Bang), and FC (Fix/Change) commands.

The History Command

"HISTORY", or the shorthand "h", is used to view the command buffer list. By default, the last ten buffer entries are displayed.
GGSCI (oelr5u7) 26> h

GGSCI Command History

   17: info exttrail *
   18: info etest detail
   19: stats etest
   20: add extract myext, tranlog, begin now
   21: dblogin userid gguser, password Oracle1
   22: info trandata east.*
   23: delete extract myext
   24: stats rtest
   25: info er *
   26: h

GGSCI (oelr5u7) 27>
Executing "h" followed by a number will display the specified number of entries from the history buffer. When a number is specified, the buffer data retrieved is a backwards count starting with the most current element. So, "h 5" will display the last five commands executed, including the "h 5" command.
GGSCI (oelr5u7) 28> h 5
GGSCI Command History

24: stats rtest
25: info er *
26: h
27: h 10
28: h 5

GGSCI (oelr5u7) 29>
As there are now twenty-eight elements in our sample history buffer, executing "h 29" will display all of the commands executed thus far.
GGSCI (oelr5u7) 29> h 29
GGSCI Command History

1: status all
2: start mgr
3: start er *
4: status all
5: view report rbatch
6:  all
7: edit param rbatch
8: stats ebatch
9: view report etest
10: status all
11: start rtest
12: view report rtestb
13: q
14: status all
15: start er *
16: view report rtest
17: info exttrail *
18: info etest detail
19: stats etest
20: add extract myext, tranlog, begin now
21: dblogin userid gguser, password Oracle1
22: info trandata east.*
23: delete extract myext
24: stats rtest
25: info er *
26: h
27: h 10
28: h 5
29: h 29

GGSCI (oelr5u7) 30>
You may notice that our history buffer contains multiple status, info, view, and start commands. We can use our next two commands, ! and FC, to execute and modify commands in the buffer.

The ! Command

The !, commonly referred to as Bang, command is used to execute a previous GGSCI command without modification. Specifying "!" by itself will execute the last command in the history buffer; while "!" followed by a number will execute the specified buffer item. Using our sample history buffer, "!" will execute the "h 29" command because it is the last command in the buffer; while "! 4" will execute the command "status all".
GGSCI (oelr5u7) 30> !
 h 29

GGSCI Command History

    2: start mgr
    3: start er *
    4: status all
    . . .

   29:  h 29
   30:  h 29

GGSCI (oelr5u7) 31> !4
status all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING                                           
EXTRACT     RUNNING     EBATCH      00:00:00      00:00:02    
EXTRACT     RUNNING     ETEST       00:00:00      00:00:03    
REPLICAT    RUNNING     RBATCH      00:00:00      00:00:04    
REPLICAT    RUNNING     RTEST       00:00:00      00:00:05    
REPLICAT    RUNNING     RTESTA      00:00:00      00:00:01    
REPLICAT    RUNNING     RTESTB      00:00:00      00:00:00    

GGSCI (oelr5u7) 32>

 The FC Command

The FC, short for Fix/Change, command is used to modify and execute a previously issued GGSCI command. If you are not familiar with Unix or HP NonStop systems you have probably never used this command as its inclusion in GGSCI comes from Oracle GoldenGate's origins in the (Tandem) NonStop Guardian Operating System. The execution syntax for FC is:
FC [<n> | -<n> | <string>]
  Specifying "FC" by itself displays the last item in the history buffer. Executing "FC" followed by a number will display the specified entry from the history buffer; while "FC -" followed by a number displays the command that was issued <n> lines before the current line. Entering "FC" followed by text displays the last command that starts with the specified text string. FC has four editor options:
i
Inserts text.
r
Replaces text.
d
Deletes a single character.
<text overwrite>
Overwrites characters with the ones specified.
Using the sample history buffer, lets see how FC works. Entering "FC" will display the last entry in the history buffer.
GGSCI (oelr5u7) 33> fc  
GGSCI (oelr5u7) 33> status all
GGSCI (oelr5u7) 33..
The command "status all" is displayed, along with a new line starting with two dots. Lets replace the text "all" with the text "er *". Using the space bar, move the cursor to be positioned under the "a" in "all". Now enter the character "r", followed by the text "er *". Then depress the Enter key, the new command "status er *" is displayed. Depress the Enter key again to execute the command.
GGSCI (oelr5u7) 33> fc  
GGSCI (oelr5u7) 33> status all
GGSCI (oelr5u7) 33..       rer *
GGSCI (oelr5u7) 33> status er * 
GGSCI (oelr5u7) 33..
EXTRACT EBATCH: RUNNING
EXTRACT ETEST: RUNNING
REPLICAT RBATCH: RUNNING
REPLICAT RTEST: RUNNING
REPLICAT RTESTA: RUNNING
REPLICAT RTESTB: RUNNING

GGSCI (oelr5u7) 34>
Entering "FC 19" will display the nineteenth command in the history buffer "stats etest".
GGSCI (oelr5u7) 34> fc 19
GGSCI (oelr5u7) 34> stats etest
GGSCI (oelr5u7) 34..
Lets change this command to be "status etest". Using the space bar, place the cursor under the last "s" in the word "stats". Type the character "i", followed by "u". Depressing the Enter key will display the new command, and depressing the Enter key a second time will execute the command.
GGSCI (oelr5u7) 34> fc 19
GGSCI (oelr5u7) 34> stats etest
GGSCI (oelr5u7) 34..    iu
GGSCI (oelr5u7) 34> status etest
GGSCI (oelr5u7) 34..
EXTRACT ETEST: RUNNING
Entering "FC -19" will display the sixteenth command in the history buffer, "view report rtest"
GGSCI (oelr5u7) 35> fc -19
GGSCI (oelr5u7) 35> view report rtest
GGSCI (oelr5u7) 35..
Lets change this command to "view report etest" by combining the character delete and insert commands. Using the space bar, place the cursor under the "r" in the word "rtest". Enter the character "d" to delete the r, followed by the character "i" to insert text, and finally the character "e". Depress Enter twice to execute the command.
GGSCI (oelr5u7) 35> fc -19
GGSCI (oelr5u7) 35> view report rtest
GGSCI (oelr5u7) 35..            die
GGSCI (oelr5u7) 35> view report etest 
GGSCI (oelr5u7) 35..

***********************************************************************
                 Oracle GoldenGate Capture for Oracle
    Version 11.2.1.0.0 OGGCORE_11.2.1.0.0_PLATFORMS_120131.1910_FBO
   Linux, x64, 64bit (optimized), Oracle 11g on Feb  1 2012 01:04:34

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

                    Starting at 2013-06-12 12:30:15
***********************************************************************

Operating System Version:
Linux
Version #1 SMP Tue Nov 29 13:32:55 EST 2011, Release 2.6.18-274.12.1.0.1.el5
Node: oelr5u7
Machine: x86_64
                         soft limit   hard limit
Address Space Size   :    unlimited    unlimited
Heap Size            :    unlimited    unlimited
File Size            :    unlimited    unlimited
CPU Time             :    unlimited    unlimited

--More--(10%)
Entering "FC add" will display the last executed add command in the history buffer, "add extract myext, tranlog, begin now".
GGSCI (oelr5u7) 36> fc add
GGSCI (oelr5u7) 36> add extract myext, tranlog, begin now
GGSCI (oelr5u7) 36..
Using the text overwrite feature, lets change this command to add the Extract Data Pump mypmp. Using the space bar, place the cursor under the "e" in the word "myext". Enter the text "pmp, exttrail ./dirdat/et", and select the Enter key. Select the Enter key again to execute the command.
GGSCI (oelr5u7) 36> fc add
GGSCI (oelr5u7) 36> add extract myext, tranlog, begin now
GGSCI (oelr5u7) 36..              pmp, exttrail ./dirdat/et
GGSCI (oelr5u7) 36> add extract mypmp, exttrail ./dirdat/et
GGSCI (oelr5u7) 36..
ERROR: Invalid parameter specified for ADD EXTRACT.

GGSCI (oelr5u7) 37>
Oops, we made a typo! The correct syntax to add an Extract Data Pump is "add extract mypmp, exttrailsource ./dirdat/et". So now you know how to fix the command without having to retype the entire entry! The last FC command you should know, but which is not documented is the "//" command, which means "do not execute". If you specify "//" on the line with the two dots, GGSCI does not execute the command. For example, "FC dblogin" will display the last "dblogin" command from the history buffer.
GGSCI (oelr5u7) 37> fc dblogin
GGSCI (oelr5u7) 37> dblogin userid gguser, password Oracle1
GGSCI (oelr5u7) 37..
Entering "//" followed by the Enter key will take us back to the GGSCI prompt.
GGSCI (oelr5u7) 37> fc dblogin
GGSCI (oelr5u7) 37> dblogin userid gguser, password Oracle1
GGSCI (oelr5u7) 37..//

GGSCI (oelr5u7) 37>

Summary

The Oracle GoldenGate Command Interpreter (GGSCI) contains three commands that can be used to reduce the amount of typing required to interact with the product. These commands come in handy when troubleshooting, monitoring, and configuring large environments. In this article we presented the History, !, and FC commands with usage examples.

Viewing all articles
Browse latest Browse all 255

Latest Images

Trending Articles



Latest Images