如何一次性在ggsci中执行两个命令?
我想使用dblogin
登录,然后在同一个shell中,我想运行info all
命令。
echo "dblogin userid abc password 123" | echo "info all"
此管道不起作用。
答案 0 :(得分:3)
您是否需要在一条线上进行此操作?
这里的文件适用于我
ggs> ggsci <<HERE
> DBLOGIN USERID abc, PASSWORD 123
> INFO ALL
> HERE
Oracle GoldenGate Command Interpreter for Oracle
Version 11.2.1.0.6_02 16874194 OGGCORE_11.2.1.0.7_PLATFORMS_130530.0600.1_FBO
Solaris, sparc, 64bit (optimized), Oracle 11g on Jun 5 2013 01:15:20
Copyright (C) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
GGSCI (foo01) 1>
Successfully logged into database.
GGSCI (foo01) 2>
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
REPLICAT ABENDED PERF1REP 00:00:00 01:54:59
GGSCI (foo01) 3>
ggs>
答案 1 :(得分:3)
尝试这样的事情:
echo obey "obey_cmds.txt" | ./ggsci
您的服从文件包含dblogin
和info all
命令。
我在我的脚本中执行类似的操作,脚本动态生成服从文件,然后执行它。
例如,给定此服从文件obey_cmds.txt
:
dblogin userid ggsadmin password s3cr3t
info all
执行看起来像这样:
$ echo obey /apps/ggsadmin/goldengate/monitoring/scripts/obey_cmds.txt | $GG_HOME/ggsci
Oracle GoldenGate Command Interpreter for Oracle
Version 11.2.1.0.1 OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230
AIX 5L, ppc, 64bit (optimized), Oracle 11g on Apr 23 2012 05:03:51
Copyright (C) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
GGSCI (aixorad02) 1>
GGSCI (aixorad02) 2> dblogin userid ggsadmin password s3cr3t
Successfully logged into database.
GGSCI (aixorad02) 3> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING EQBTTC 00:00:00 00:00:01
EXTRACT RUNNING PQBTTC 00:00:00 00:00:01
GGSCI (aixorad02) 4> exit
答案 2 :(得分:0)
参加派对的时间较晚,但在我的牌照上并在稍宽的范围内使用此类内容:
- 示例脚本片段
pushd .
cd $GG_HOME
./ggsci -s <<EOF>>gg.out
start manager
start extract *
start rep *
send *,status
EOF
gg_retval=$?
popd
然后通过retval返回或输出文件处理。显然,你可以做各种各样的事情。小心翼翼。我只是推了一些示例 - 可能无法提供您正在寻找的返回值或输出文件。
哦,分手镜头:重复ggsci任务的方便别名alias cdgg='pushd . ; cd $GG_HOME'
alias gg='cdgg;./ggsci;popd'