Skip to content

Commit fe94cbf

Browse files
committed
Oracle user creation with custom bash script.
Additional option for makefile. #2183
1 parent 661b209 commit fe94cbf

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
# adding users through compose does not work
4+
# tried different options, this is the one that finally worked...
5+
6+
# Wait for the Oracle database to fully initialize
7+
echo "Waiting for the Oracle database to start..."
8+
sleep 30
9+
10+
SQL0='alter session set "_ORACLE_SCRIPT"=true;
11+
CREATE USER compose IDENTIFIED BY password1;
12+
GRANT ALL PRIVILEGES TO compose;
13+
exit;
14+
'
15+
docker exec -it -e SQL0="$SQL0" oracle bash -c 'echo "$SQL0" | sqlplus SYS/Oradoc_db1 AS SYSDBA'
16+

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ connect-%:
3434

3535
db-start:
3636
docker-compose up -d --force-recreate
37+
./.github/oracle_helpers/file.sh
3738
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")'
3839
R -q -e 'suppressMessages(pkgload::load_all()); DBI::dbExecute(test_src_mssql(FALSE)$$con, "CREATE DATABASE test")'
3940

@@ -43,6 +44,10 @@ db-restart:
4344
db-stop:
4445
docker-compose down
4546

47+
db-reset:
48+
docker-compose down --volumes
49+
docker-compose build --no-cache
50+
4651
docker-build:
4752
docker build --platform linux/amd64 -t ghcr.io/cynkra/dm:main .
4853

0 commit comments

Comments
 (0)