Plugin Information |
---|
View SQLPlus Script Runner on the plugin site for more information. |
Older versions of this plugin may not be safe to use. Please review the following warnings before using an older version:
Releases
- 1.x - For Jenkins 1.x
- 2.x - For mainly Jenkins 2.x, credentials plugins implemented and pipeline support
Migration Guide
To migrate your workspace from version 2 is very simple, all you need to do is:
- Create a credential for your user and password;
- Edit you job configuration and select one credential;
- Save your changes and you are good to go!
Summary
This plugin enables you run Oracle SQL*Plus scripts on your Jenkins jobs ( Oracle SQL*Plus installation required! ).
Configuration
Global
All you have to do is check the auto detect ORACLE_HOME option ( or a valid ORACLE_HOME ) and you are in business:
If you are having problems try to enable Debug info to see what is going on.
By Job
You can run a script inside your workspace or a user defined for every job:
Version 1.x:
Version 2.x :
Environment variables
Pay attention to what version you are using in order to work with variables:
variable | Version 1.x | Version 2.x |
---|---|---|
user | ok | replaced by credentials |
password | ok | replaced by credentials |
instance | ok | ok |
You can use global variables for user and instance, first creating it in Jenkins→ configuration :
You user global variable can hold username and password as well like this (username/password):
And then using it:
Running
You can check later all SQL*Plus output inside your build output:
Pipeline
User defined script
node { echo 'SQLPlusRunner running user define script for system@xe' step([$class: 'SQLPlusRunnerBuilder',credentialsId:'system', instance:'xe',scriptType:'userDefined', script: '',scriptContent: 'select * from v$version']) }
File script
node { echo 'SQLPlusRunner running file script for system@xe' step([$class: 'SQLPlusRunnerBuilder',credentialsId:'system', instance:'xe',scriptType:'file', script: 'start.sql',scriptContent: '']) }
Optional pipeline parameters
- customOracleHome
- customSQLPlusHome
- customTNSAdmin
Download the last release and give it a try!
Reported problems
my script takes forever to execute...
Windows users sometimes get a running script stuck on build, even though they run everything on Oracle.
In that case you should use Build Time Out plugin together to get everything working fine.
I have an error ORA-????
You should try running manually SQL*Plus before use Jenkins.
Sometimes on Linux Jenkins has his own Operation System user with his own variables.
Every time I get this error: cannot find sqlplus
Jenkins plugin can't find SQL*Plus executable file.
You should do in this order:
- Stop Jenkins;
- Find where are sqlplus executable file (usually at $ORACLE_HOME);
- Check if they have proper permissions (chmod 755 *);
Create a global environment variable ORACLE_HOME like this:
export ORACLE_HOME=/oracle/app/oracle/product/12.1.0/dbhome_1/ or export ORACLE_HOME=<your-sqlplus-directory>Test your environment with: sqlplus -v , should return SQL*Plus version like SQL*Plus: Release 12.1.0.1.0 Production
Start Jenkins;
Use the try to detect ORACLE_HOME option;
Retry your SQL*Plus operation.
Every time I get this error: libsqlplus.so: cannot open shared object file: No such file or directory or SP2-0667: Message file sp1.msb not found
SQL*Plus need its library and its message file to work properly.
You should do in this order:
- Stop Jenkins;
- Find where are libsqlplus.so files (usually at $ORACLE_HOME\lib );
- Check if they have proper permissions (chmod 755 *);
Create a global environment variable LD_LIBRARY_PATH like this:
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH or export LD_LIBRARY_PATH=<your-libsqlplus-directory>:$LD_LIBRARY_PATHTest your environment with: sqlplus -v , should return SQL*Plus version like SQL*Plus: Release 12.1.0.1.0 Production
Start Jenkins;
Use the try to detect ORACLE_HOME option;
Retry your SQL*Plus operation.
I want to hide my user / password from Console Output
Install Mask Passwords Plugin;
Setup to hide everything you want.
I have a bug to report
Please open a new issue and inform:
- Jenkins server Operation System;
- Jenkins version ;
- Where SQLPlus Script Runner is running (local machine or slave machine);
- Slave machine Operation System (if applicable);
- Oracle Database version;
- Oracle SQL*Plus version;
- Build log with debug info enabled.
Attachments:
setup-by-project.png (image/png)
script-running.png (image/png)
global-setup.png (image/png)
custom-setup.png (image/png)
COB.PNG (image/png)
COB.PNG (image/png)
COB.PNG (image/png)
image2017-5-31 14:46:54.png (image/png)
image2017-6-5 13:0:7.png (image/png)
main-setup.png (image/png)
setup-by-project.png (image/png)
global-var.png (image/png)
global-var2.png (image/png)
userpwd.png (image/png)
sqlplus.png (image/png)
image2018-9-13_0-33-6.png (image/png)
main-setup.png (image/png)
main-setup.png (image/png)