Edit #GoldenGate commands from GGSCI
Ever get tired of typing the same command over and over again in Oracle GoldenGate GGSCI? Well, Oracle has provided a history recall function into GGSCI, I talked about his in an earlier post. This post on history recall can be found here.
In this post, lets take the command recall and how these commands can be edited. In Oracle GoldenGate 12c, Oracle has provided an GGSCI command called “FC”. The “FC” command is used to display/edit a previously issued GGSCI command and the execute it again. This command leverages the memory buffer the same was as the history command does within GGSCI.
Now the syntax for using this command is as follows:
FC [ n | -n | string ]
n – Displays the command from the line number provided
-n – Displays the command that was issued n lines before the current line
string – Displays the last command that starts with the specified string
Let’s take a look at an example of using “FC” within GGSCI.
In the below output, I have issued a series of commands and then listed these commands using this history function.
GGSCI (fred.acme.com) 6> history GGSCI Command History 1: info all 2: stats extract egg12c 3: info mgr 4: info pgg12c 5: info all 6: history
Using the “FC” command, I can edit and execute the edited command. If you take a look at command 4 (info pgg12c), I want to replace “pgg12c” with “egg12c”. this is done by using the “r” edit command as follows.
GGSCI 7> fc 4 GGSCI 7> info pgg12c GGSCI 7.. regg12c GGSCI 7> info egg12c GGSCI 7.. EXTRACT EGG12C Last Started 2016-08-12 17:06 Status RUNNING Description 'Integrated Extract' Checkpoint Lag 00:00:08 (updated 00:00:05 ago) Process ID 24082 Log Read Checkpoint Oracle Integrated Redo Logs 2016-08-15 10:14:45 SCN 0.51017268 (51017268)
By executing “fc 4” (fc n), I’m telling GGSCI to pull the fourth command from the memory buffer for editing. Then I use the “r” command to provide the text that I want to replace in the command. Notice the position of the “r”, it is lined up directly under the string I want to replace. Then I provide the replacement string. Before execution GGSCI provides you with an output of the changed command. After verifying the command, the command can be executed providing the output for the correct process.
Note: For more editing options with FC, you can find these here.
If you want to know what command was executed n commands before the previous command, you can use the -n option to “FC”. This makes the “FC” command act like the history command but only displays the command at the -n position. This can be seen if you do a history command prior to a fc -n command.
GGSCI (fred.acme.com) 11> history GGSCI Command History 2: stats extract egg12c 3: info mgr 4: info pgg12c 5: info all 6: history 7: info egg12c 8: info mgr 9: history 10: info egg12c 11: history GGSCI (fred.acme.com) 12> fc -4 GGSCI (fred.acme.com) 12> info mgr GGSCI (fred.acme.com) 12.. Manager is running (IP port fred.acme.com.15000, Process ID 12377).
You will notice, that I have eleven commands in the command history. By using “fc -4”, I’m able to retrieve the info mgr command and then execute it by simply by hitting return. Before hitting return, I could still edit the command as was shown previously.
Lastly, you can retrieve a previous command by searching for a specific string. The string has to be at the beginning of the command. In the below example, I’m searching for the last stats command that was ran.
GGSCI (fred.acme.com) 16> history GGSCI Command History 7: info egg12c 8: info mgr 9: history 10: info egg12c 11: history 12: info mgr 13: info all 14: history 15: stats extract egg12c 16: history GGSCI (fred.acme.com) 17> fc sta GGSCI (fred.acme.com) 17> stats extract egg12c GGSCI (fred.acme.com) 17.. Sending STATS request to EXTRACT EGG12C ... No active extraction maps DDL replication statistics (for all trails): *** Total statistics since extract started *** Operations 2.00 Mapped operations 2.00 Unmapped operations 0.00 Other operations 0.00 Excluded operations 0.00
As you can see, there is only one stats command in the command history. The “FC” command pulls this command and provides an opportunity to edit it. After hitting return, the command is executed.
Now that you know how to recall and edit Oracle GoldenGate commands from the GGSCI command prompt, hopefully, this will make your life with Oracle GoldenGate a bit easier.
Enjoy!!
@dbasolved
http://about.me/dbasolved
Current Oracle Certs
Bobby Curtis
I’m Bobby Curtis and I’m just your normal average guy who has been working in the technology field for awhile (started when I was 18 with the US Army). The goal of this blog has changed a bit over the years. Initially, it was a general blog where I wrote thoughts down. Then it changed to focus on the Oracle Database, Oracle Enterprise Manager, and eventually Oracle GoldenGate.
If you want to follow me on a more timely manner, I can be followed on twitter at @dbasolved or on LinkedIn under “Bobby Curtis MBA”.