login script [message #169352] |
Wed, 26 April 2006 06:54  |
ranajay_das
Messages: 6 Registered: April 2006
|
Junior Member |
|
|
Hi,
In one of the script i have to enter to a different box which have a different userid and password. Can the loginid and password be passed in the script itself, so that it don't prompt for the userid and password.
Can anyone please help?
Ta,
|
|
|
|
|
Re: login script [message #169386 is a reply to message #169376] |
Wed, 26 April 2006 10:19   |
chaitanya_n
Messages: 16 Registered: January 2006 Location: Hyderabad
|
Junior Member |
|
|
Hi
Try pasting the below line in your script to login to any box.
sqlplus -s Userid/Password@DBSchema @/(Path of the '.sql' file) >> (path for output redirection)
Before running it, you also need to Export Oracle Enviornment variables in your script. For that, Please see the format below and try adding it in your script with appropriate path of oracle.
# Set up Oracle environment variables
export ORACLE_HOME=/(path of oracle in your unix server)
export ORACLE_SID=(DB Schema name)
PATH=$PATH:$ORACLE_HOME/bin
Cheers
|
|
|
Re: login script [message #169387 is a reply to message #169352] |
Wed, 26 April 2006 10:25   |
ranajay_das
Messages: 6 Registered: April 2006
|
Junior Member |
|
|
Thanks for the reply,
But actually i didn't meant to say i want to enter in sql, its a unix box where i wanted to login and nothing related to sql.
|
|
|
Re: login script [message #169390 is a reply to message #169352] |
Wed, 26 April 2006 10:58   |
chaitanya_n
Messages: 16 Registered: January 2006 Location: Hyderabad
|
Junior Member |
|
|
rajan,
i understand that you have a requirement to go enter into a different box, but i am not clear what exactly you want to do after that. Is it for running a command ? if that's the case then
you can use 'rsh' command to execute any command in that box.
rsh - Executes a specified command on a remote host or logs into a remote host
The usage is :
rsh [-dfnx] [-l user] remote_host [command] [argument...]
dfnx = current host name from where the script will be executed.
|
|
|
Re: login script [message #169394 is a reply to message #169352] |
Wed, 26 April 2006 11:07   |
ranajay_das
Messages: 6 Registered: April 2006
|
Junior Member |
|
|
Hi,
Sorry for the confusion!!
Ya, i want to run the command 'df -lk' inside that box.
rsh is one option, but i believe ssh is the modern version of rsh, and if i use ssh then the syntax would be,
ssh -l <userid> <target box> <command>
But there is the problem, it asks for the password which i don't want. I want that password to supply via script.
Thanks,
|
|
|
|
|
Re: login script [message #169402 is a reply to message #169396] |
Wed, 26 April 2006 11:39   |
chaitanya_n
Messages: 16 Registered: January 2006 Location: Hyderabad
|
Junior Member |
|
|
That's because your current user id is different to the userid of the remote login, that you have mentioned in the command. You need to have the same username for both the hosts.
|
|
|
|
Re: login script [message #169405 is a reply to message #169352] |
Wed, 26 April 2006 11:49   |
chaitanya_n
Messages: 16 Registered: January 2006 Location: Hyderabad
|
Junior Member |
|
|
what is the error now ?? is it permission denied a again ? One thing i observed is , 'df -lk' is not correct usage. instead 'df -k' can be used.
|
|
|
Re: login script [message #169495 is a reply to message #169405] |
Thu, 27 April 2006 04:06  |
chaitanya_n
Messages: 16 Registered: January 2006 Location: Hyderabad
|
Junior Member |
|
|
hi rajan,
one more thing to note in this context.
The host name that you are calling from the script should be present in your current hosts '/etc/hosts' file. You need to add it as shown in below formatt:
hostIP hostName userID
example:
47.49.181.73 hwnfmpms2.nat.bt.com hwnfmpms2
Take help of your Unix admin to do this if you don't have permissions.
Please confirm when done.
|
|
|