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
已提问 3 年前257 查看次数
1 回答
0

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

Savvyp
已回答 3 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则