1. Oracle server side character set query
select userenv('language') from dual
Where NLS_CHARACTERSET is the server side character set
NLS_LANGUAGE is the character display form on the server side
2. Query the character set of the oracle client side
$echo $NLS_LANG
If you find that the data you select is garbled, please configure the character set on the client side to the same character set as the Linux operating system. If there are still garbled characters, there may be a problem with the data in the database, or there is a problem with the configuration of the oracle server.
Three, server side character set modification
Change the character set step method (WE8ISO8859P1 --> ZHS16GBK)
start - run - enter cmd to enter the command prompt
Enter sqlplus /nolog
Log in to sqlplus as administrator
SQL> conn /as sysdba
Connected.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 236000356 bytes
Fixed Size 451684 bytes
Variable Size 201326592 bytes
Database Buffers 33554432 bytes
Redo Buffers 667648 bytes
Database mounted.
SQL> ALTER SYSTEM ENABLE RESTRICTED SESSION;
System altered.
SQL> ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
System altered.
SQL> ALTER SYSTEM SET AQ_TM_PROCESSES=0;
System altered.
SQL> alter database open;
Database altered.
SQL> ALTER DATABASE CHARACTER SET ZHS16GBK;
ALTER DATABASE CHARACTER SET ZHS16GBK
*
ERROR at line 1:
ORA-12712: new character set must be a superset of old character set
Prompt our character set: the new character set must be a superset of the old character set, then we can skip the superset check and make changes:
SQL> ALTER DATABASE character set INTERNAL_USE ZHS16GBK;
Database altered.
SQL> select * from v$nls_parameters;
slightly
19 rows selected.
Reboot to check if the changes are complete:
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 236000356 bytes
Fixed Size 451684 bytes
Variable Size 201326592 bytes
Database Buffers 33554432 bytes
Redo Buffers 667648 bytes
Database mounted.
Database opened.
SQL> select * from v$nls_parameters;
slightly
19 rows selected.
Fourth, modify the environment variables
Set the environment for the oracle user
Modify environment variables under linux (temporary)
export NLS_LANG=“SIMPLIFIED Chinese_CHINA.ZHS16GBK”
If it is Windows, add or modify it as follows, and add the following information to the system variable:
Variable name: NLS_LANG
Variable value: SIMPLIFIED Chinese_CHINA.ZHS16GBK