Issue with remote script execution
I have a very simple script that creates another script that I want to copy over to my oracle server (on a separate machine from my resin server) and then execute. It looks like this:
Code:
#!/bin/bash ssh oracle@11.1.11.111 bash /tmp/script/trythis.sh and I get: Error 6 initializing SQL*Plus Message file sp1<lang>.msb not found SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory Any ideas? I'm pretty sure ORACLE_HOME is set on my oracle machine because, as I said, I can execute the exact same script fine when logged into my oracle machine. I read something about sourcing the bash profile but I couldn't figure out the details of what was being talked about and I also didn't know if it was relevant to my issue (came up when I searched for the error I was getting). |
Quote:
E. g. it looks like your script is starting up, but the user it is running as does not have permission to access some of the files the script (or binaries it starts up) need to be able to read to run. I'd try finding that file with something like (as root): Code:
find / -name sp1_en.msb |
Quote:
Code:
-bash-3.00$ find / -name sp1_en.msb |
1. you prob don't need to change perms on the msb file, but fyi, when running find across the whole system, re-direct errors to null eg
Code:
find / -name sp1_en.msb 2>/dev/null Code:
#!/bin/bash |
Quote:
As far as the ORACLE env variable thing goes... I'm a little confused. The ORACLE_HOME variable IS set on the oracle machine and as I said, the script that's copied over executes fine on the oracle machine. That being said, I did source the ORACLE environment as you suggested and I still get the same error. The other way I tried first was just running each sql command individually via ssh within the main script, example: Code:
ssh oracle@11.1.11.111 path/to/sqlplus user/pass @/path/to/sql/script/on/oracle/machine.sql Error 6 initializing SQL*Plus Message file sp1<lang>.msb not found SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory I think I've ruled out the ORACLE_HOME set issue but I'm open to suggestions. Any other reason you guys can think of that the script would execute fine on the oracle box but not via ssh from my resin box? OR, any suggestions as to how I can do something similar in another way? |
Well, I've been at this issue for 2 solid days now and am not getting anywhere. Does anyone know what the issue could be or have a better way for me to execute the sqlplus scripts from my resin machine (where no oracle instance is installed)?
|
[QUOTE=Orange Sunshine;4345414]Interesting...when I do what you said I get this:
Code:
-bash-3.00$ find / -name sp1_en.msb Quote:
|
Quote:
E. g. you still go ahead and copy your script over as required. However, you do NOT start it from your remote connection. How about setting up a script on the target machine, that is run by cron locally on that machine, that starts your script? E. g. setup a cron that runs each five minutes. All it does is call your script that has been copied in whenever like you detail in your above messages. This way, from everything on the target machine's viewpoint, the script starts up LOCALLY, via cron, so it should have all the permissions it needs? Just write the cron script locally "as" the user which runs Oracle. You can then add refinements such as having the cronned script just die quietly if your "command script" is not present in a certain folder. This way you can precisely control when and what is executed, simply by copying over the script, leaving for at least 6 minutes (thus ensuring execution somewhere in that time window, by cron, of the script) and then deleting it remotely? You can do all this quite easily with PHP for example, as regards making an FTP connection to copy the file to a certain location, then deleting it after a time delay... you can even farm that time delay functionality out to the cron on your remote system? The idea of course being to NOT try to run the script remotely, but having it run locally as the correct user Oracle runs as anyway. This should short-circuit any permission complaints, I hope... |
All times are GMT -5. The time now is 06:40 PM. |