I have one shell script test.sh that displays 'WELCOME' and kept in unix server /home/xxx/
Now, I want to execute this from Sql prompt.
I tried with some code with sys priviledge.but could work and getting error like ORA-29540: class does not exist
and I think there is error while executing shell command.
Here, I have created all objects in the database.
can any one help me on this please ?.
So, what I understand is you need to execute a shell script from sql prompt.
From the SQL*Plus prompt, do !sh script_name. (! is used to temporarily exit out of SQL*Plus and execute a shell command)
I created a sample.sh file on the home directory and it contains echo "welcome";
I started SQL*Plus and did
SQL> !sh sample.sh
The output is welcome
Also, when you get an ORA error, it is generally an Oracle error.
Related
I have a shell script at Unix Server which contain sqlplus commands to do some validation.and I can run script using putty and see required result.In Unix server I have set up Oracle path and Library path in .bash_profile file. So when I start putty , it get loaded and can understand sqlplus command.
Now Challenge is
when I call that shell script from Jenkins(Windows node) then I get error "sqlplus command not found". Here I call .bash_profile file first then my shell script which have sqlplus commands.
Please help.
Set up the PATH as an environment variable in your Jenkins job definition. More details here:
How to set up environment variables in Jenkins
Using Robotframework automation with ssh library, i am trying to execute a shell script with one argument (-a), on a remote UNIX box
The test steps are as follows:
Login to the UNIX box
Go to the directory where the shell script with argument (-a) is present
Execute the shell script
Please note:
Since 'SSHLibrary' keywords like 'Execute command' or 'Write' and 'Read' work in a single shell, i am passing multiple commands separated by a semicolon
In the series of commands, i also tried turning ON the shell using command shopt login_shell but this too did not work. Also note that the command shopt login_shell is not turning ON the shell when executed with 'Execute command' keyword. It works fine with 'Write' keyword
The following command to check if JAVA is loaded in the automation shell, returns a correct output (path to JAVA).
Write $JAVA_HOME
${Op_java}= Read
Problem:
Following robotframework test step after logging in to the UNIX box fails with exit code 127 and error 'java: command not found'
Method 1 that I tried:
Write shopt login_shell
${Op_Shopt}= Read
${Op_rc} ${Op_err}= Execute Command cd /home/xyz/abc; ./shell_script.sh -a return_stderr=True
Here the login_shell is turned ON but somewhere within the shell script the Execute Command keyword exits with code 127 and error 'java: command not found'
Method 2 that I tried:
Write shopt login_shell; cd /home/xyz/abc; ./shell_script.sh -a
${Op_shell}= Read
Here the login_shell is NOT turned ON and even here too the Execute Command keyword exits with code 127 and error 'java: command not found'.
As mentioned below, i also tried the same approach with the keyword 'Start Command', but still the same issue.
Start Command shopt login_shell; cd /home/xyz/abc; ./shell_script.sh -a
${Op_rc} ${Op_err}= Read Command Output return_stderr=True
Can someone please help me to resolve this problem?
I am trying to execute a simple db2 command in Linux command prompt. but Linux command prompt is not recognizing the command it is giving - bash db2 command not found. but db2 is installed in the Linux machine.
command I am trying to execute from Linux command line processor is db2 "create database smaple"
Error I am getting is below "If db2 in not a typo you can run the following command to lookup the package that contains the binary" command-not-found db2 -bash: db2: command not found"
Is this because of environment variable problem ?? or there is only one instance of db2 ie db2inst1 is running in the machine.my user name in appsusr and db2 instance name is db2inst1 are different is this causing problem?? and I am not having super user access.Is this is causing any problem?? do I need super user access is required ??
Just type, echo $PATH in your command prompt , where you can see all the exported paths in your system.
If the db2 path is not found in your environment variable list, then do the following.
export PATH=$PATH:/opt/IBM/db2/V10.1/bin
and then press enter.
I hope this will resolve your issue.
On Linux and UNIX DB2 platforms, the proper way to set your environment variables to run DB2 commands is to source the sqllib/db2profile script belonging to the local DB2 instance owner. That will set not only your PATH but also other important variables that DB2 requires.
In your case, the instance is owned by the db2inst1 user, so your login startup file or batch script should run this command:
. ~db2inst1/sqllib/db2profile
The leading dot is necessary to set the variables in your current shell process, not the sub-process that quickly vanishes after db2profile finishes.
It's more than likely that, if DB2 is installed, it's simply not in your path.
Your path should contain something like:
/opt/IBM/db2/V10.1/bin
which is where the executables live (depending on which version you're running).
Changing your path will probably entail changes to one of the startup files, such as .bashrc or .bash_profile.
I want to do some things with sqlite3.exe, the sqlite3 command line shell. After navigating to the directory in PowerShell ISE, I run the program with .\sqlite3.exe and get the expected output from SQLite:
___________________________________________________________
PS [path]\SQLite shell> .\sqlite3.exe
SQLite version 3.7.14 2012-09-03 15:42:36
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
However, if I try typing .help after this, or any other command for that matter, nothing happens and the bottom taskbar says "Already running a command. Please wait.". Of course, there is nothing to wait for, because clearly sqlite3.exe is waiting for input from me.
I cannot get PowerShell ISE to respond to any further commands after this point unless I quit SQLite with Ctrl+Break.
What is wrong?
The problem is Powershell ISE isn't like the normal Powershell console. Powershell ISE is a host built on WPF which you'll find certain legacy exe commands do not work correctly in ISE. These are normally interactive exe commands and not just sqlite3.exe. For example I've had issues with logparser.exe in ISE also.
Try running it in poweshell.exe
I am using ssh exec ant task in my script for executing some commands in unix system(change permission,etc)
i am executing these scripts from a distributed system. After the execution of the script,
In case of changing file permissions, the permissions are not changed as in the script.
How can i capture the error message that has been thrown by the unix system in the system we have executed the script?
You can use the output or outputProperty attributes of the sshexec task.