gvenzl / oci-oracle-xe

Build scripts for Oracle Database XE container/docker images
Apache License 2.0
270 stars 76 forks source link

ORA-65040: operation not allowed from within a pluggable database #206

Closed indiVar0508 closed 1 year ago

indiVar0508 commented 1 year ago

Hi ,

I am using gvenzl/oracle-xe:latest image to do developer testing for my codebase, here is my docker command that i am using

docker run -d -p 1521:1521 -e ORACLE_DATABASE=testing_db -e APP_USER=user1 -e APP_USER_PASSWORD=my_password -e ORACLE_RANDOM_PASSWORD=true --health-cmd healthcheck.sh gvenzl/oracle-xe

i have a testcase where i have to drop entire DB but i get this error

ORA-65040: operation not allowed from within a pluggable database

is there a way to address this issue?, like grant user1 drop privilege? if it can be done + if it's applicable for pluggable DB(s)?

i eventually also want to use https://github.com/gvenzl/setup-oracle-free for my CI i see it has ability to give scripts so where i can grant this user drop privilege

can you help me address this issue i am not much aware of DB(s) not sure if drop privilege exists for oracle pluggable DB(s)?.

thanks!

indiVar0508 commented 1 year ago

Hi @gvenzl ,

do you have any inputs for this one to point me in right direction

gvenzl commented 1 year ago

Hey @indiVar0508,

First of all, thanks for using these images!

It will depend on what your test case for dropping the entire DB looks like. Yes, with pluggable databases you cannot drop a pluggable database with the DROP DATABASE command:

SQL> alter session set container = xepdb1;

Session altered.

SQL> drop database;
drop database
*
ERROR at line 1:
ORA-65040: operation not allowed from within a pluggable database

If you want to drop the PDB, you have to use DROP PLUGGABLE DATABASE.

Also check out the Multitenant Admin Guide for more info.

indiVar0508 commented 1 year ago

Thanks @gvenzl , Closing this ticket able to make it work now!

gvenzl commented 1 year ago

Glad to hear that! :)