Unable to change Oracle SID with Net::SSH::Perl [message #429421] |
Tue, 03 November 2009 11:53 |
fairgame
Messages: 29 Registered: October 2008
|
Junior Member |
|
|
Hi,
I am running a Perl code from Linux machine and doing SSH to Windows machine.
When I am trying to change SID with this command, it's not working. The SID does not change and it keeps the default SID.
#-- set up a new connection
my $ssh = Net::SSH::Perl->new($host);
#-- authenticate
$ssh->login($user, $password);
#-- execute the command
$ssh->cmd('SET ORACLE_SID=testsid');
|
|
|
|
|
Re: Unable to change Oracle SID with Net::SSH::Perl [message #429425 is a reply to message #429424] |
Tue, 03 November 2009 13:05 |
ThomasG
Messages: 3212 Registered: April 2005 Location: Heilbronn, Germany
|
Senior Member |
|
|
Does the script also print the output of the commands? (If Net::SSH is anything like Net::FTP, maybe there is an additional "Debug" parameter that can be set in the connect command)
If so, try an additional just "set" command, to see how the variables are actually set.
|
|
|
Re: Unable to change Oracle SID with Net::SSH::Perl [message #429433 is a reply to message #429425] |
Tue, 03 November 2009 15:24 |
fairgame
Messages: 29 Registered: October 2008
|
Junior Member |
|
|
@Thomas Yes, the script gives the standard output.
Now, as you said I tried to SET some variable and it didn't work.
my $cmd1 = 'set TEST=Success && echo %TEST%';
my($stdout, $stderr, $exit) = $ssh->cmd($cmd1);
print "$stdout, $stderr, $exit \n";
And my out put is
%TEST%, ,0
|
|
|
|
Re: Unable to change Oracle SID with Net::SSH::Perl [message #429512 is a reply to message #429444] |
Wed, 04 November 2009 05:13 |
ThomasG
Messages: 3212 Registered: April 2005 Location: Heilbronn, Germany
|
Senior Member |
|
|
Hmmmmm... What's more even the "Windows Way" of piping commands doesn't seem to work, without involving an SSH connection.
If you run
(
echo This is an test > test.out
set VAR=yo >>test.out
echo %VAR% >>test.out
) | cmd.exe /c
Directly under Windows, that also doesn't set the variable:
C:\>(
Mehr? echo This an test > test.out
Mehr? set VAR=yo >>test.out
Mehr? echo %VAR% >>test.out
Mehr? ) | cmd.exe /c
U:\>type test.out
This an test
%VAR%
C:\>
The other workaround I could imagine would be to put everything in a batch file that you can then call with the parameters you want in one command line.
|
|
|