Closed rweisleder closed 2 years ago
Hi @rweisleder,
Thanks a lot for using these images!
The reason for this behavior is that createAppUser
defaults to the pluggable database XEPDB1
:
Usage:
createAppUser APP_USER APP_USER_PASSWORD [TARGET_PDB]
APP_USER: the user name of the new user
APP_USER_PASSWORD: the password for that user
TARGET_PDB: the target pluggable database the user should be created in, default XEPDB1 (ignored for 11g R2)
However, any script in initdb
(or startdb.d
) will be run against the container database (CDB) XE
:
The` .sql, .sql.gz and .sql.zip files will be executed in SQLPlus as the SYS user connected to the Oracle instance (XE).
So what happened is that you created a user TEST01
in the CDB XE
and a user TEST02
in the PDB XEPDB1
. Then, when the script tried to create the views in the CDB, it worked for TEST01
but not for TEST02
because there is no user TEST02
in the CDB.
Thank you for the explanation, @gvenzl!
Well, I didn't know the difference between CDB and PDB before. This explains why the scripts behave differently.
From my point of view, the issue can be closed.
You are very welcome, @rweisleder!
I have created three files inside /container-entrypoint-initdb.d to create new users and a view for each user.
01-create-user.sql
02-create-user.sh
03-create-tables.sql
I would expect that when I start the container, the two users are created and the view is present in both schemas. However, when I start gvenzl/oracle-xe:latest I face a ORA-01917 error. The output is:
What did I miss?
For a complete example, see rweisleder/test-oracle-xe-with-multiple-users