3

I have created a docker container, containing an Oracle 18 XE instance with a container database and a pluggable database. The application I want to test with this pluggable database requires the database to have national character set UTF8. I can not change this, it is just a requirement.

The (empty) database is created and up and running. The character set however is AL16UTF16. I tried several options to change the national character set of both the container database and the pluggable database, all without success.

The procedure I followed, is described here. The docker images I downloaded from github, and the installer for Oracle 18c Express Edition from Oracle.

I tried to add the parameter to the docker run command: -e ORACLE_NLS_NCHAR_CHARACTERSET=UTF8, without success.

Before creating the docker image, I tried adding the setting NLS_NCHAR_CHARACTERSET=UTF8 to the configuration file oracle-xe-18c.conf, without success.

I tried the instructions from this site, without success. While the database is empty, trying to change the national character set results in the message ORA-12717: Cannot issue ALTER DATABASE NATIONAL CHARACTER SET when NCLOB, NCHAR or NVARCHAR2 data exists. I checked columns affected by the change of national character set with select owner, table_name, column_name from dba_tab_columns where (data_type = 'NCHAR' or data_type = 'NVARCHAR2' or data_type = 'NCLOB') and owner != 'SYS' and owner != 'SYSTEM';, and then a select * on all columns found. They all contained no data.

How can I create an Oracle database in docker, using the national character set UTF8?

George
  • 315
  • 3
  • 15
  • 1
    Check this [link](https://sujeetdba.blogspot.com/2017/06/changing-national-character-set.html) same as you tried with instructions except it involves updating properties –  Jul 02 '20 at 18:46

1 Answers1

0

Your version of Oracle is 18 which directly supports setting default charset via environment variable. I didn't try it but I guess just calling docker run -e ORACLE_CHARACTERSET=AL32UTF8 ... could be sufficient.

I solved this problem on 11g using ALTER DATABASE CHARACTER SET INTERNAL_USE .... This command must be run on db in restricted mode (see original answer, my application on docker scripts is in comment, it should be applicable to Oracle 18 too).

Tomáš Záluský
  • 10,735
  • 2
  • 36
  • 64
  • 2
    I solved it by changing the line `nationalCharacterSet=AL16UTF16` in `docker-images\OracleDatabase\SingleInstance\dockerfiles\19.3.0\dbca.rsp.tmpl` into `nationalCharacterSet=UTF8`. And yes, I am using Oravcle 19 now. – George Jun 08 '22 at 09:10