NLS 参数有数据库级别的和会话级别的。

数据库级别的 NLS 参数

查看数据库级别的 NLS 参数有两个方法:

  • 通过 sys.nls_database_parameters 视图查看
  1. obclient> select * from nls_database_parameters;
  2. +-------------------------+------------------------------+
  3. | PARAMETER | VALUE |
  4. +-------------------------+------------------------------+
  5. | NLS_DATE_FORMAT | DD-MON-RR |
  6. | NLS_TIMESTAMP_FORMAT | DD-MON-RR HH.MI.SSXFF AM |
  7. | NLS_TIMESTAMP_TZ_FORMAT | DD-MON-RR HH.MI.SSXFF AM TZR |
  8. | NLS_TERRITORY | AMERICA |
  9. | NLS_SORT | BINARY |
  10. | NLS_COMP | BINARY |
  11. | NLS_CHARACTERSET | AL32UTF8 |
  12. | NLS_NCHAR_CHARACTERSET | AL16UTF16 |
  13. | NLS_DATE_LANGUAGE | AMERICAN |
  14. | NLS_LENGTH_SEMANTICS | BYTE |
  15. | NLS_NCHAR_CONV_EXCP | FALSE |
  16. | NLS_CALENDAR | GREGORIAN |
  17. | NLS_NUMERIC_CHARACTERS | ., |
  18. +-------------------------+------------------------------+
  19. 13 rows in set (0.00 sec)
  • 使用 show global variables 方法
  1. obclient> show global variables like 'nls_%';
  2. +-------------------------+------------------------------+
  3. | VARIABLE_NAME | VALUE |
  4. +-------------------------+------------------------------+
  5. | nls_calendar | GREGORIAN |
  6. | nls_characterset | AL32UTF8 |
  7. | nls_comp | BINARY |
  8. | nls_date_format | DD-MON-RR |
  9. | nls_date_language | AMERICAN |
  10. | nls_length_semantics | BYTE |
  11. | nls_nchar_characterset | AL16UTF16 |
  12. | nls_nchar_conv_excp | FALSE |
  13. | nls_numeric_characters | ., |
  14. | nls_sort | BINARY |
  15. | nls_territory | AMERICA |
  16. | nls_timestamp_format | DD-MON-RR HH.MI.SSXFF AM |
  17. | nls_timestamp_tz_format | DD-MON-RR HH.MI.SSXFF AM TZR |
  18. +-------------------------+------------------------------+
  19. 13 rows in set (0.01 sec)

OceanBase 的 Oracle 租户的数据库级别的 NLS 参数是该租户的每个会话的 NLS 参数的初始值。如果会话自己不修改 NLS 参数的话,就沿用了数据库级别的 NLS 参数。

数据库级别的 NLS 参数也可以修改。不同租户的 NLS 参数可以不同,互不影响。

会话级别的 NLS 参数

查看会话级别的 NLS 参数有两种方法:

  • 通过 sys.nls_session_parameters 视图查看
  1. obclient> select * from nls_session_parameters;
  2. +-------------------------+------------------------------+
  3. | PARAMETER | VALUE |
  4. +-------------------------+------------------------------+
  5. | NLS_DATE_FORMAT | DD-MON-RR |
  6. | NLS_TIMESTAMP_FORMAT | DD-MON-RR HH.MI.SSXFF AM |
  7. | NLS_TIMESTAMP_TZ_FORMAT | DD-MON-RR HH.MI.SSXFF AM TZR |
  8. | NLS_LANGUAGE | AMERICAN |
  9. | NLS_TERRITORY | AMERICA |
  10. | NLS_SORT | BINARY |
  11. | NLS_COMP | BINARY |
  12. | NLS_DATE_LANGUAGE | AMERICAN |
  13. | NLS_LENGTH_SEMANTICS | BYTE |
  14. | NLS_NCHAR_CONV_EXCP | FALSE |
  15. | NLS_CALENDAR | GREGORIAN |
  16. | NLS_NUMERIC_CHARACTERS | ., |
  17. +-------------------------+------------------------------+
  18. 12 rows in set (0.00 sec)
  • 通过 show session variables 方法
  1. obclient> show session variables like 'nls_%';
  2. +-------------------------+------------------------------+
  3. | VARIABLE_NAME | VALUE |
  4. +-------------------------+------------------------------+
  5. | nls_calendar | GREGORIAN |
  6. | nls_characterset | AL32UTF8 |
  7. | nls_comp | BINARY |
  8. | nls_date_format | DD-MON-RR |
  9. | nls_date_language | AMERICAN |
  10. | nls_language | AMERICAN |
  11. | nls_length_semantics | BYTE |
  12. | nls_nchar_characterset | AL16UTF16 |
  13. | nls_nchar_conv_excp | FALSE |
  14. | nls_numeric_characters | ., |
  15. | nls_sort | BINARY |
  16. | nls_territory | AMERICA |
  17. | nls_timestamp_format | DD-MON-RR HH.MI.SSXFF AM |
  18. | nls_timestamp_tz_format | DD-MON-RR HH.MI.SSXFF AM TZR |
  19. +-------------------------+------------------------------+
  20. 14 rows in set (0.00 sec)