NLS 参数有数据库级别的和会话级别的。
数据库级别的 NLS 参数
查看数据库级别的 NLS 参数有两个方法:
- 通过 sys.nls_database_parameters 视图查看
obclient> select * from nls_database_parameters;
+-------------------------+------------------------------+
| PARAMETER | VALUE |
+-------------------------+------------------------------+
| NLS_DATE_FORMAT | DD-MON-RR |
| NLS_TIMESTAMP_FORMAT | DD-MON-RR HH.MI.SSXFF AM |
| NLS_TIMESTAMP_TZ_FORMAT | DD-MON-RR HH.MI.SSXFF AM TZR |
| NLS_TERRITORY | AMERICA |
| NLS_SORT | BINARY |
| NLS_COMP | BINARY |
| NLS_CHARACTERSET | AL32UTF8 |
| NLS_NCHAR_CHARACTERSET | AL16UTF16 |
| NLS_DATE_LANGUAGE | AMERICAN |
| NLS_LENGTH_SEMANTICS | BYTE |
| NLS_NCHAR_CONV_EXCP | FALSE |
| NLS_CALENDAR | GREGORIAN |
| NLS_NUMERIC_CHARACTERS | ., |
+-------------------------+------------------------------+
13 rows in set (0.00 sec)
- 使用 show global variables 方法
obclient> show global variables like 'nls_%';
+-------------------------+------------------------------+
| VARIABLE_NAME | VALUE |
+-------------------------+------------------------------+
| nls_calendar | GREGORIAN |
| nls_characterset | AL32UTF8 |
| nls_comp | BINARY |
| nls_date_format | DD-MON-RR |
| nls_date_language | AMERICAN |
| nls_length_semantics | BYTE |
| nls_nchar_characterset | AL16UTF16 |
| nls_nchar_conv_excp | FALSE |
| nls_numeric_characters | ., |
| nls_sort | BINARY |
| nls_territory | AMERICA |
| nls_timestamp_format | DD-MON-RR HH.MI.SSXFF AM |
| nls_timestamp_tz_format | DD-MON-RR HH.MI.SSXFF AM TZR |
+-------------------------+------------------------------+
13 rows in set (0.01 sec)
OceanBase 的 Oracle 租户的数据库级别的 NLS 参数是该租户的每个会话的 NLS 参数的初始值。如果会话自己不修改 NLS 参数的话,就沿用了数据库级别的 NLS 参数。
数据库级别的 NLS 参数也可以修改。不同租户的 NLS 参数可以不同,互不影响。
会话级别的 NLS 参数
查看会话级别的 NLS 参数有两种方法:
- 通过 sys.nls_session_parameters 视图查看
obclient> select * from nls_session_parameters;
+-------------------------+------------------------------+
| PARAMETER | VALUE |
+-------------------------+------------------------------+
| NLS_DATE_FORMAT | DD-MON-RR |
| NLS_TIMESTAMP_FORMAT | DD-MON-RR HH.MI.SSXFF AM |
| NLS_TIMESTAMP_TZ_FORMAT | DD-MON-RR HH.MI.SSXFF AM TZR |
| NLS_LANGUAGE | AMERICAN |
| NLS_TERRITORY | AMERICA |
| NLS_SORT | BINARY |
| NLS_COMP | BINARY |
| NLS_DATE_LANGUAGE | AMERICAN |
| NLS_LENGTH_SEMANTICS | BYTE |
| NLS_NCHAR_CONV_EXCP | FALSE |
| NLS_CALENDAR | GREGORIAN |
| NLS_NUMERIC_CHARACTERS | ., |
+-------------------------+------------------------------+
12 rows in set (0.00 sec)
- 通过 show session variables 方法
obclient> show session variables like 'nls_%';
+-------------------------+------------------------------+
| VARIABLE_NAME | VALUE |
+-------------------------+------------------------------+
| nls_calendar | GREGORIAN |
| nls_characterset | AL32UTF8 |
| nls_comp | BINARY |
| nls_date_format | DD-MON-RR |
| nls_date_language | AMERICAN |
| nls_language | AMERICAN |
| nls_length_semantics | BYTE |
| nls_nchar_characterset | AL16UTF16 |
| nls_nchar_conv_excp | FALSE |
| nls_numeric_characters | ., |
| nls_sort | BINARY |
| nls_territory | AMERICA |
| nls_timestamp_format | DD-MON-RR HH.MI.SSXFF AM |
| nls_timestamp_tz_format | DD-MON-RR HH.MI.SSXFF AM TZR |
+-------------------------+------------------------------+
14 rows in set (0.00 sec)