您的位置:首页 > 运维架构 > Shell

有用的Goldengate命令-SHELL, OBEY, HELP, HISTORY,VERSIONS

2012-03-06 20:35 225 查看
http://hi.baidu.com/myitil/blog/item/e5bff986a41db92467096ef8.html
2011-08-04 21:00
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.oncalldba.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.oncalldba.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.oncalldba.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.oncalldba.com) 11> dblogin userid ggs_owner, password ggs_owner

Successfully logged into database.

GGSCI (linux01.oncalldba.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.oncalldba.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.oncalldba.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.oncalldba.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, INFOGGSEVT VIEW
MANAGER INFO, REFRESH, SEND, START, STOP, STATUSMARKER INFO PARAMS EDIT, VIEW REPLICAT ADD, ALTER, CLEANUP, DELETE, INFO, KILL, LAG, SEND, START, STATS, STATUS, STOPREPORT VIEW RMTTRAIL ADD, ALTER, DELETE, INFOTRACETABLE ADD, DELETE, INFO TRANDATA ADD, DELETE,
INFODatabase DBLOGIN, LIST TABLES, ENCRYPT PASSWORDDDL 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.oncalldba.com) 1> GGSCI
(linux01.oncalldba.com) 2> START MANAGERManager started. GGSCI (linux01.oncalldba.com) 3> START EXTRACT EXT3 EXTRACT EXT3 is already running. GGSCI (linux01.oncalldba.com) 4> START EXTRACT DPUMP EXTRACT DPUMP is already running.GGSCI (linux01.oncalldba.com)
5> INFO ALL Program Status Group Lag Time Since Chkpt MANAGER RUNNINGEXTRACT 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

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: