docker-oracle-xe-11g
docker-oracle-xe-11g copied to clipboard
Customize Database Character Set
It does not seem that there is a way to set the character set of the database upon creation or I just don't understand how to do so with the setup. Is there a way to install the database with a custom database character set?
I think an initial script will help.
Add the following to the Dockerfile to set UTF8:
ENV NLS_LANG .AL32UTF8
Not working here.
# Dockerfile
FROM wnameless/oracle-xe-11g
ADD init.sql /docker-entrypoint-initdb.d/
ENV NLS_LANG .WE8MSWIN1252
Then after build and run:
SELECT * FROM nls_database_parameters WHERE parameter LIKE '%CHARACTERSET%';
NLS_CHARACTERSET AL32UTF8
NLS_NCHAR_CHARACTERSET AL16UTF16
If I'm not wrong Oracle 11G XE for Linux supports only UTF-8 as character-set. So unfortunately you can't change it at all!
But if you still want to change it to another character-set different from UTF-8 you must use another edition, like Standard Edition 2 and Enterprise Edition.
you can try this docker https://hub.docker.com/r/babim/oracledatabase/
with standard version i saw we can set ORACLE_CHARACTERSET
or try to change (need to carefull, it can make database corruption and can't rollback)
alter system enable restricted session;
ALTER DATABASE CHARACTER SET INTERNAL_USE TH8TISASCII;
alter system disable restricted session;
i final resolves it with other docker
- check out jaspeen to folder [oracle-11g]
- go back 1 commit (use commit c1b3f721 because latest public install of oracle 11 is 11.2.0.2, but latest commit is for 11.2.0.4 a private update version for oracle CUSTOMER)
- download oracle 11.2.0.2.0 from oracle-database-software-downloads and unzip to [oracle-11g]/install we has [oracle-11g]/install/database
- open [oracle-11g]/assets/dbca.rsp find CHARACTERSET="AL32UTF8" and change to your characterset. mine is CHARACTERSET="TH8TISASCII"
- build docker
docker build -f [oracle-11g]/Dockerfile -t oracle11/local [oracle-11g] - run docker and it will install database for you
docker run --privileged --name oracle11 -p 1523:1521 -v /mnt/data/1Dev/project/docker/oracle-11g/install:/install oracle11/local
I successfully changed default charset for Oracle docker image of 11g using this SO answer (see comment for how exactly to apply it). I didn't check applicability to wnameless image, however.