wnameless / docker-oracle-xe-11g

Dockerfile of Oracle Database Express Edition 11g Release 2
Apache License 2.0
1.35k stars 800 forks source link

Customize Database Character Set #96

Open kylescott opened 6 years ago

kylescott commented 6 years ago

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?

wnameless commented 6 years ago

I think an initial script will help.

agustisanchez commented 5 years ago

Add the following to the Dockerfile to set UTF8:

ENV NLS_LANG .AL32UTF8
gustavoramos00 commented 5 years ago

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
rponte commented 5 years ago

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.

hieplq commented 4 years ago

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;

hieplq commented 4 years ago

i final resolves it with other docker

  1. check out jaspeen to folder [oracle-11g]
  2. 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)
  3. download oracle 11.2.0.2.0 from oracle-database-software-downloads and unzip to [oracle-11g]/install we has [oracle-11g]/install/database
  4. open [oracle-11g]/assets/dbca.rsp find CHARACTERSET="AL32UTF8" and change to your characterset. mine is CHARACTERSET="TH8TISASCII"
  5. build docker docker build -f [oracle-11g]/Dockerfile -t oracle11/local [oracle-11g]
  6. 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
tomaszalusky commented 3 years ago

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.