Skip to Main Content

Breadcrumb

Question and Answer

Sergiusz Wolicki

Thanks for the question.

Asked: June 03, 2021 - 9:23 am UTC

Last updated: June 10, 2021 - 12:16 pm UTC

Version: 10.2.0.1

Viewed 100+ times

You Asked

Hi,I'm using oracle 10.2.0.1 for studing, and I queried the v$session using pl/sql developer from a windows pc client ,but I found the garbled code from the results.just as following:

SQL> select osuser from v$session; 

OSUSER
--------
SYSTEM
????
SYSTEM
abc
??????????


then I ran the same command from the DB server,but I got the same results.

Here are the characterset:

SQL> select userenv('language') from dual;

USERENV('LANGUAGE')
----------------------------------------------------
SIMPLIFIED CHINESE_CHINA.ZHS16GBK

                      

SQL> select * from v$nls_parameters;

PARAMETER                                                        VALUE
---------------------------------------------------------------- ----------------------------------------------------------------
NLS_LANGUAGE                                                     SIMPLIFIED CHINESE
NLS_TERRITORY                                                    CHINA
NLS_CURRENCY                                                     ¥
NLS_ISO_CURRENCY                                                 CHINA
NLS_NUMERIC_CHARACTERS                                           .,
NLS_CALENDAR                                                     GREGORIAN
NLS_DATE_FORMAT                                                  DD-MON-RR
NLS_DATE_LANGUAGE                                                SIMPLIFIED CHINESE
NLS_CHARACTERSET                                                 ZHS16GBK
NLS_SORT                                                         BINARY
NLS_TIME_FORMAT                                                  HH.MI.SSXFF AM
NLS_TIMESTAMP_FORMAT                                             DD-MON-RR HH.MI.SSXFF AM
NLS_TIME_TZ_FORMAT                                               HH.MI.SSXFF AM TZR
NLS_TIMESTAMP_TZ_FORMAT                                          DD-MON-RR HH.MI.SSXFF AM TZR
NLS_DUAL_CURRENCY                                                ¥
NLS_NCHAR_CHARACTERSET                                           UTF8
NLS_COMP                                                         BINARY
NLS_LENGTH_SEMANTICS                                             BYTE
NLS_NCHAR_CONV_EXCP                                              FALSE

19 rows selected


I also set the environment variable in my windows os :
NLS_LANG=SIMPLIFIED CHINESE_CHINA.ZHS16GBK

What's more,I tested my db as following:
SQL> select '中文' from dual;

'中文'
----
中文


Now,Could you please help me,why I got some garbled codes such as ??? when querying osuser from v$session?

thanks a lot.


and we said...

Lots of moving parts there, including a tool that we don't make or support.

Can you try the same with SQL Developer, and let us know the results.

(Note: First read this https://www.thatjeffsmith.com/archive/2014/08/non-english-character-display-in-oracle-sql-developer/ )

Rating

  (1 rating)

Comments

garbled code of v$session

A reader, June 10, 2021 - 8:21 am UTC

I downloaded the latest version of oracle SQL developer,which is 20.4.1.407 , and got the same results as follows:

select '中文' from dual;
-------
'中文'
中文


SQL> select osuser from v$session; 

OSUSER
--------
SYSTEM
????
SYSTEM
abc
??????????


Please give me some advices, thanks
Sergiusz Wolicki
June 10, 2021 - 12:16 pm UTC

The best advice I can give is to use a more current database release than 10.2.0.1. We have improved the code responsible for getting the OSUSER from the Windows API and passing it to the database in 10.2.0.5 (bug #6994490). You really shouldn't use a non-patched, 16-years old release. Oracle Database 18c XE (18.4) is available for free.

For your old release to work, you probably need to change the system default locale to Chinese. If you open Command Prompt, issue the command CHCP, and do not see "Active code page: 936" out-of-the-box, then V$SESSION will not work with Simplified Chinese characters.