Home > Article > Operation and Maintenance > Solution to Oracle Chinese garbled code in Linux
The root cause of the garbled code problem is the modification of the character set. Let's take a look at the solution to Oracle Chinese garbled code in Linux.
Check the client’s language encoding settings:
Configuration in the configuration file: cat ~/.bash_profile
Pay attention to modifying the configuration information:
export PATH
export ORACLE_HOME=/usr/lib/oracle/11.2/client64/
export LD_LIBRARY_PATH=:$ORACLE_HOME/lib:/usr/local/lib:$LD_LIBRARY_PATH:.
export TNS_ADMIN=$ORACLE_HOME
export PATH=$PATH:$ORACLE_HOME/bin:
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
After configuration, check whether the configuration is successful, sql statement: select userenv('language' ) from dual
View the encoding used by the database: modify the default language of the linux oracle database
linux The default language for installing oracle is:
AMERICAN_AMERICA.WE8MSWIN1252
The Chinese display in this language is garbled.
After logging in to the Linux system through oracle, perform the following operations:
Modification method (taking changing to UTF8 as an example)
Log in to sqlplus with system DBA authority
$ sqlplus / as sysdba; select userenv('language') from dual;
For example: AMERICAN_AMERICA.WE8MSWIN1252
Modify:
SQL> shutdown immediate; SQL> startup mount; SQL> alter system enable restricted session; SQL> alter system set job_queue_processes=0; SQL> alter database open; SQL> alter database character set internal_use AL32UTF8; 或者 ALTER DATABASE character set INTERNAL_USE ZHS16GBK; SQL> shutdown immediate; SQL> startup SQL>alter system disable restricted session;
Free video tutorial sharing: linux video tutorial
The above is the detailed content of Solution to Oracle Chinese garbled code in Linux. For more information, please follow other related articles on the PHP Chinese website!