oracle 11g change charset on docker

## get docker list

[root@localhost ~]# docker ps
CONTAINER ID        IMAGE                   COMMAND             CREATED             STATUS              PORTS                                            NAMES
08d434228dfe        jaspeen/oracle-xe-11g   "/entrypoint.sh "   5 weeks ago         Up 9 days           0.0.0.0:1521->1521/tcp, 0.0.0.0:9000->8080/tcp   db

## get docker list

[root@localhost ~]# docker exec -it db sqlplus

SQL*Plus: Release 11.2.0.2.0 Production on Thu Aug 6 13:15:38 2020

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Enter user-name: system
Enter password:

Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

SQL> SELECT name, value$ FROM sys.props$ WHERE name = 'NLS_CHARACTERSET';
SELECT name, value$ FROM sys.props$ WHERE name = 'NLS_NCHAR_CHARACTERSET';

NAME
------------------------------
VALUE$
--------------------------------------------------------------------------------
NLS_CHARACTERSET
AL32UTF8


SQL>
NAME
------------------------------
VALUE$
--------------------------------------------------------------------------------
NLS_NCHAR_CHARACTERSET
AL16UTF16



## error
SQL> UPDATE sys.props$ SET value$ = 'KO16KSC5601' WHERE name = 'NLS_CHARACTERSET';
UPDATE sys.props$ SET value$ = 'KO16KSC5601' WHERE name = 'NLS_CHARACTERSET'
           *
ERROR at line 1:
ORA-01031: insufficient privileges
## change charset
[root@localhost ~]# docker exec -it db /bin/bash
root@08d434228dfe:/# sqlplus /nolog

SQL*Plus: Release 11.2.0.2.0 Production on Thu Aug 6 13:18:15 2020

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

SQL> conn sys/oracle as sysdba
Connected.
SQL>  UPDATE sys.props$ SET value$ = 'KO16KSC5601' WHERE name = 'NLS_CHARACTERSET';

1 row updated.

SQL> UPDATE sys.props$ SET value$ = 'KO16KSC5601' WHERE name = 'NLS_NCHAR_CHARACTERSET';

1 row updated.

SQL> SELECT name, value$ FROM sys.props$ WHERE name = 'NLS_CHARACTERSET';
SELECT name, value$ FROM sys.props$ WHERE name = 'NLS_NCHAR_CHARACTERSET';

NAME
------------------------------
VALUE$
--------------------------------------------------------------------------------
NLS_CHARACTERSET
KO16KSC5601


SQL>
NAME
------------------------------
VALUE$
--------------------------------------------------------------------------------
NLS_NCHAR_CHARACTERSET
KO16KSC5601


SQL> exit
Disconnected from Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
[root@localhost ~]#


## add...
 SHUTDOWN IMMEDIATE;
   STARTUP MOUNT;
   ALTER SYSTEM ENABLE RESTRICTED SESSION;
   ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
   ALTER SYSTEM SET AQ_TM_PROCESSES=0;
   ALTER DATABASE OPEN;
   COL VALUE NEW_VALUE CHARSET
   SELECT VALUE FROM NLS_DATABASE_PARAMETERS WHERE PARAMETER='NLS_CHARACTERSET';
   COL VALUE NEW_VALUE NCHARSET
   SELECT VALUE FROM NLS_DATABASE_PARAMETERS WHERE PARAMETER='NLS_NCHAR_CHARACTERSET';
   ALTER DATABASE CHARACTER SET INTERNAL_USE &CHARSET;
   ALTER DATABASE NATIONAL CHARACTER SET INTERNAL_USE &NCHARSET;
   SHUTDOWN IMMEDIATE;
   STARTUP;
   -- yes, 2 times startup/shutdown . This is not a typo
   SHUTDOWN IMMEDIATE;
   STARTUP;

root@08d434228dfe:/# sqlplus /nolog

SQL*Plus: Release 11.2.0.2.0 Production on Fri Aug 7 02:42:23 2020

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

SQL> conn sys/oracle as sysdba
Connected.
SQL>  SHUTDOWN IMMEDIATE;
   STARTUP MOUNT;
   ALTER SYSTEM ENABLE RESTRICTED SESSION;
   ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
   ALTER SYSTEM SET AQ_TM_PROCESSES=0;
   ALTER DATABASE OPEN;
   COL VALUE NEW_VALUE CHARSET
   SELECT VALUE FROM NLS_DATABASE_PARAMETERS WHERE PARAMETER='NLS_CHARACTERSET';
   COL VALUE NEW_VALUE NCHARSET
   SELECT VALUE FROM NLS_DATABASE_PARAMETERS WHERE PARAMETER='NLS_NCHAR_CHARACTERSET';
   ALTER DATABASE CHARACTER SET INTERNAL_USE &CHARSET;
   ALTER DATABASE NATIONAL CHARACTER SET INTERNAL_USE &NCHARSET;
   SHUTDOWN IMMEDIATE;
   STARTUP;
   -- yes, 2 times startup/shutdown . This is not a typo
   SHUTDOWN IMMEDIATE;
   STARTUP;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> ORACLE instance started.

Total System Global Area  601272320 bytes
Fixed Size                  2228848 bytes
Variable Size             381685136 bytes
Database Buffers          213909504 bytes
Redo Buffers                3448832 bytes
Database mounted.
SQL>
System altered.

SQL>
System altered.

SQL>
System altered.

SQL>
Database altered.

SQL> SQL>
VALUE
--------------------------------------------------------------------------------
KO16KSC5601

SQL> SQL>
VALUE
--------------------------------------------------------------------------------
KO16KSC5601

SQL> old   1:    ALTER DATABASE CHARACTER SET INTERNAL_USE &CHARSET
new   1:    ALTER DATABASE CHARACTER SET INTERNAL_USE KO16KSC5601

Database altered.

SQL> old   1:    ALTER DATABASE NATIONAL CHARACTER SET INTERNAL_USE &NCHARSET
new   1:    ALTER DATABASE NATIONAL CHARACTER SET INTERNAL_USE KO16KSC5601
   ALTER DATABASE NATIONAL CHARACTER SET INTERNAL_USE KO16KSC5601
*
ERROR at line 1:
ORA-12714: invalid national character set specified


SQL> Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> ORACLE instance started.

Total System Global Area  601272320 bytes
Fixed Size                  2228848 bytes
Variable Size             381685136 bytes
Database Buffers          213909504 bytes
Redo Buffers                3448832 bytes
Database mounted.
Database opened.
SQL> SQL> Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> ORACLE instance started.

Total System Global Area  601272320 bytes
Fixed Size                  2228848 bytes
Variable Size             381685136 bytes
Database Buffers          213909504 bytes
Redo Buffers                3448832 bytes
Database mounted.
Database opened.
SQL>





댓글

이 블로그의 인기 게시물

[!] CDN: trunk URL couldn't be downloaded: https://cdn.cocoapods.org/CocoaPods-version.yml Response: URL using bad/illegal format or missing URL

starcraft map

Data Analysis with Superset - boardless chart