From fe94cbf52a9c0426848b6332baf564e80a635e7a Mon Sep 17 00:00:00 2001 From: aavanesy Date: Thu, 18 Jan 2024 16:10:24 +0400 Subject: [PATCH] Oracle user creation with custom bash script. Additional option for makefile. #2183 --- .github/oracle_helpers/create_oracle_users.sh | 16 ++++++++++++++++ Makefile | 5 +++++ 2 files changed, 21 insertions(+) create mode 100755 .github/oracle_helpers/create_oracle_users.sh diff --git a/.github/oracle_helpers/create_oracle_users.sh b/.github/oracle_helpers/create_oracle_users.sh new file mode 100755 index 0000000000..1c9031e69b --- /dev/null +++ b/.github/oracle_helpers/create_oracle_users.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# adding users through compose does not work +# tried different options, this is the one that finally worked... + +# Wait for the Oracle database to fully initialize +echo "Waiting for the Oracle database to start..." +sleep 30 + +SQL0='alter session set "_ORACLE_SCRIPT"=true; +CREATE USER compose IDENTIFIED BY password1; +GRANT ALL PRIVILEGES TO compose; +exit; +' +docker exec -it -e SQL0="$SQL0" oracle bash -c 'echo "$SQL0" | sqlplus SYS/Oradoc_db1 AS SYSDBA' + diff --git a/Makefile b/Makefile index 07adf2d81d..5c3e047650 100644 --- a/Makefile +++ b/Makefile @@ -34,6 +34,7 @@ connect-%: db-start: docker-compose up -d --force-recreate + ./.github/oracle_helpers/file.sh R -q -e 'suppressMessages(pkgload::load_all()); DBI::dbExecute(test_src_maria(root = TRUE)$$con, "GRANT ALL ON *.* TO '"'"'compose'"'"'@'"'"'%'"'"';"); DBI::dbExecute(test_src_maria()$$con, "FLUSH PRIVILEGES")' R -q -e 'suppressMessages(pkgload::load_all()); DBI::dbExecute(test_src_mssql(FALSE)$$con, "CREATE DATABASE test")' @@ -43,6 +44,10 @@ db-restart: db-stop: docker-compose down +db-reset: + docker-compose down --volumes + docker-compose build --no-cache + docker-build: docker build --platform linux/amd64 -t ghcr.io/cynkra/dm:main .