1

I'm running oracle database in docker like this

docker run -d --rm --name oracle_online -e ORACLE_SID=xxx -e ORACLE_PDB=xxx -e ORACLE_PWD=xxx -v /home/data/oracle:/opt/oracle/oradata -it -p 1521:1521 container-registry.oracle.com/database/enterprise:12.2.0.1

When it's started, the ORACLE_SID is unchanged, it's always ORCLCDB:

TNSLSNR for Linux: Version 12.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/12.2.0/dbhome_1/admin/ORCLCDB/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/95c1ad3d33bd/listener/alert/log.xml

...

#ip-address : IP address of the host where the container is running.
#port       : Host Port that is mapped to the port 1521 of the container.
#
# The mapped port can be obtained from running "docker port <container-id>"
# ===========================================================================
Completed:     alter pluggable database ORCLPDB1 open
2020-11-14T05:42:36.136965+00:00
    alter pluggable database all save state
Completed:     alter pluggable database all save state
2020-11-14T05:42:36.426957+00:00
ALTER SYSTEM SET encrypt_new_tablespaces='DDL' SCOPE=BOTH;
2020-11-14T05:42:38.664560+00:00

Does anyone know how to change the SID?

2 Answers 2

1

Sure, you need to change pfile/spfile and set ORACLE_SID before the startup of the database to change the name of the instance. Meaning you need to change how the docker image starts the database, if you want this done automatically.

Simply passing some environment variables through docker after the database was started will not change anything.

1

Oracle provides only 12.X and latest (19.X at this moment), I've took at look at the docker entrypoint and the conclusion is:

  1. For 12.X use -e DB_SID=XXX -e DB_PASSWD=XXX to change SID and password (From paramChk.sh)
  2. For latest version use -e ORACLE_SID=XXX -e ORACLE_PWD=XX (From setPassword.sh)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.