Skip to main content

Oracle CLI (SQLcl)

Execute queries to oracle instances with sqlcl.

Type: bash

Configuration

NameRequiredDescription
SQLCL_URIyesThe connect identifier. Example: myusername/mypassword@Host/ORCL
TERMyesThe name of terminal setting

In order to configure this type, it's necessary to create the target directly from the API

runops login
CONNECTION_NAME=sqlcl-test
TAGS=test-agent
# for updating it, just change the from POST to PUT
curl -XPOST https://api.runops.io/v1/targets \
-H "Authorization: $(cat ~/.runops/config)" \
-H 'content-type: application/json' -d@- <<EOF
{
"tags": "$TAGS",
"secret_provider": "env-var",
"secret_path": "SQLCL_ENV",
"name": "$CONNECTION_NAME",
"type": "bash",
"custom_command": "sqlcl -S -nohistory -noupdates [[SQLCL_URI]]"
}
EOF
tip

In this example, the agent needs to be configured with the environment variable SQLCL_ENV as json, example:

SQLCL_ENV='{"SQLCL_URI":"<USER>/<PASSWD>@<HOST>:<PORT>","TERM":"xterm"}'

To add more options to the command line, update the custom command.

Examples

Then it's possible to run queries into a oracle database

runops tasks create --target $CONNECTION_NAME --script 'SELECT SYSDATE, CURRENT_TIMESTAMP FROM DUAL'