CodeBuild disconnects sqlplus

0

Hi all,

I have created a test CodeBuild project which I want to connect to an RDS Oracle database and run a number of queries.

I have a zip which contains sqlplus, the project retrieves this from S3, extracts the contents and sets the necessary paths and permission. I can then connect to the database, however straight after it has connected, it disconnects. Have I missed something here? Any help will be much appreciated! Thank you!

Build spec:
version: 0.2
phases:
install:
commands:
- aws s3 cp s3://$MY_BUCKET/ . --recursive
- dpkg -i *.deb
- unzip sqlplus.zip
- cd sqlplus
- chmod +x sqlplus
- export PATH=$(pwd):$PATH
- export LD_LIBRARY_PATH=$(pwd):$LD_LIBRARY_PATH
build:
commands:
- echo connecting to $ORACLE_USER/$ORACLE_PASSWORD@$ORACLE_ENDPOINT:$ORACLE_PORT/$ORACLE_DB
- sqlplus $ORACLE_USER/$ORACLE_PASSWORD@$ORACLE_ENDPOINT:$ORACLE_PORT/$ORACLE_DB
- SELECT * FROM dba_data_files;

Output from build log:
[Container] 2021/08/20 09:32:03 Running command sqlplus $ORACLE_USER/$ORACLE_PASSWORD@$ORACLE_ENDPOINT:$ORACLE_PORT/$ORACLE_DB
SQL*Plus: Release 21.0.0.0.0 - Production on Fri Aug 20 09:32:03 2021
Version 21.3.0.0.0
Copyright (c) 1982, 2021, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Standard Edition 2 Release 19.0.0.0.0 - Production
Version 19.11.0.0.0
SQL> Disconnected from Oracle Database 19c Standard Edition 2 Release 19.0.0.0.0 - Production
Version 19.11.0.0.0
[Container] 2021/08/20 09:32:03 Running command SELECT * FROM dba_data_files;
/codebuild/output/tmp/script.sh: 4: SELECT: not found

Savvyp
gefragt vor 3 Jahren257 Aufrufe
1 Antwort
0

echo "select 1 from dual;" | sqlplus -s username/password@host:1521/service

Savvyp
beantwortet vor 3 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen