When the shell script is run in command line mode, it works as
expected.
and running db2 -tvf ... in command line it also works.
The issue occurs when running using "plink"
start plink -pw <pwd> userid@db2_serv02 /home/userid/testsp.sh
The exact plink command worked with Linux but fails with AIX.
The error: db2: command not found.
... what is plink, what it does and why you think such command exists in
Aix?
Jan M. Nelken
Dont know plink, but if db2 cant be found its usually because
environment is not setup properly. Tru sourcing db2profile in your
script, I.e.
. ~<instanceowner>/sqllib/db2profile
db2 connect to ...
db2 -tvf callsp.sql
...
/Lennart
On May 14, 10:44 am, "Jan M. Nelken" <Unknown.U...@Invalid.Domain>
wrote:
> Jan M. Nelken- Hide quoted text -
>
> - Show quoted text -
You are correct. Added...
. /home/userid/sqllib/db2profile
to the script and everything is fine.
Seems only to be an issue with AIX not Linux.
-Kevin
Linux: Developed by the people for the people; AIX: Developed by IBM
- for IBM (not for the people)
> /Lennart- Hide quoted text -
>
> Plink is a utility to launch a unix session from dos. It is a sweet
> app.
More specifically, it's part of the PuTTY suite on Windows[1]. Plink[2]
is a command line telnet/rsh/ssh client. Very handy indeed.
[snip]
[1] http://www.chiark.greenend.org.uk/~sgtatham/putty/
[2] http://the.earth.li/~sgtatham/putty/0.60/htmldoc/Chapter7.html#plink
Dave.
--
> You are correct. Added...
> . /home/userid/sqllib/db2profile
> to the script and everything is fine.
>
> Seems only to be an issue with AIX not Linux.
That's strange. At least under v8 (may be different with v9),
db2profile had to be manually sourced by users wishing to access DB2,
or added to the profile so it got sourced automatically on login, under
both Linux and AIX (certainly I've had to manually add it to bashrc for
various users on my Linux server).
IIRC, the GUI setup adds it automatically to the instance owner's
profile, unless you use the manual (non-GUI) setup in which case it
still needs adding manually.
Dave.
--
> Justin wrote:
>
>>
>> Plink is a utility to launch a unix session from dos. It is a sweet
>> app.
>
> More specifically, it's part of the PuTTY suite on Windows[1]. Plink[2]
> is a command line telnet/rsh/ssh client. Very handy indeed.
Does it initiate a login shell? If not, then ~/.profile is not read and,
thus, the DB2 environment not set up because ~/sqllib/db2profile is not
sourced.
--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
Actually, db2icrt adds it - so it shouldn't matter whether you use the GUI
or not to create the instance. The instance owner should always get it, if
the instance owner even has a .profile/.login/.bashrc to modify.
> Dave Hughes wrote:
>
> > Justin wrote:
> >
> >>
> >> Plink is a utility to launch a unix session from dos. It is a
> sweet >> app.
> >
> > More specifically, it's part of the PuTTY suite on Windows[1].
> > Plink[2] is a command line telnet/rsh/ssh client. Very handy indeed.
>
> Does it initiate a login shell? If not, then ~/.profile is not read
> and, thus, the DB2 environment not set up because ~/sqllib/db2profile
> is not sourced.
Interesting point. PuTTY itself usually starts a login shell
(naturally). However, when called with a command line to execute, plink
DOES NOT start a login shell:
C:\>plink -ssh dave@nibbler echo $0
bash
(if it were a login shell, it ought to return -bash instead of bash).
If called with no command to execute (i.e. in interactive mode), plink
accepts input from stdin. In this case, it (unsurprisingly) DOES start
a login shell:
C:\>echo echo $0 | plink -ssh dave@nibbler
-bash
Despite the SSH documentation stating otherwise ("If command is
specified, it is executed on the remote host instead of a login shell")
it appears this is the opposite behaviour of the OpenSSH client under
Linux:
$ ssh dave@nibbler "echo $0"
-bash
$ echo 'echo $0' | ssh dave@nibbler
-bash
So, I guess the moral of the story is that if one wishes to run scripts
that access DB2 remotely over SSH, to ensure compatibility with
different SSH clients which may not start a full login shell, one
should ensure the script on the server sources
~db2inst1/sqllib/db2profile before attempting to access DB2.
Cheers,
Dave.
--
I am really new to DB2 (couple months) - so my knowledge of profile
management is near zero
:)