中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Oracle Study之--NLS_DATE_FORMAT

發布時間:2020-07-22 09:45:25 來源:網絡 閱讀:1103 作者:客居天涯 欄目:關系型數據庫

Oracle Study之--NLS_DATE_FORMAT


系統環境:

     操作系統:RedHat EL6

     數據庫:    Oracle 11gR2

在RMAN中設置時間格式時,報錯:


Oracle Study之--NLS_DATE_FORMAT

Oracle中 NLS_DATE_FORMAT的設置方法 

分類:
Oracle中 NLS_DATE_FORMAT的設置方法
Oracle日期格式默認為:DD-MON-YY,以下是3種方法可以修改使之永久生效;


1、修改glogin.sql文件,這個文件的路徑為:
Windows下:
%ORACLE_HOME\sqlplus\admin\
Unix下:
$ORACLE_HOME/sqlplus/admin/
在文件中加入:
alter session set nls_date_format = 'yyyy-mm-dd hh34:mi:ss';


2、修改注冊表(windows平臺)
開始-->運行-->regedit-->HKEY_LOCAL_MACHINE-->SOFTWARE-->ORACLE-->KEY_ORADb10g_home1
新建字符串值:
NLS_DATE_FORMAT,并設置其值為:YYYY-MM-DD:HH24:MI:SS


3、修改用戶環境變量(Unix平臺)
export NLS_DATE_FORMAT =AMERICAN
export NLS_DATE_FORMAT ='YYYY-MM-DD HH24:MI:SS'
RMAN會話中設置NLS_DATE_FORMAT 和NLS_LANG
run {
...........
sql 'alter session set NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS";
sql 'alter session set NLS_LANG ="AMERICAN";
...........
}

Oracle 官方解釋:


Explanation 

part1:
     NLS_DATE_FORMAT is client centric, not server centric. This way each client can see dates the way he/she needs to. For example clent in Europe is used to dates in DD/MM/YY format while clients in the US are used to MM/DD/YY. Therefore, each client needs to set NLS_DATE_FORMAT on the client box. In Windows, start regedit, go to HKEY_Local_Machine, Software, Oracle and add entry NLS_DATE_FORMAT = 'MM/DD/YYYY'. On Unix set environment variable NLS_DATE_FORMAT.

part2:
part1 is not entirely true.
     NLS_DATE_FORMAT is not that straight forward. And explanation I gave you is not entirely true. There is a lot of articles in Oracle's MetaLink on that topic. If you are MetaLink customer check http://support.oracle.com.sg/met ... OT&p_id=74375.1

     NLS_DATE_FORMAT is used if a date format mask is not specified in application code. The effective NLS_DATE_FORMAT is determined by the following (in order of precedence): 

1. Session NLS_DATE_FORMAT (via ALTER SESSION command) 
2. Client side NLS_DATE_FORMAT (from client environment variables/registry settings) 
3. Instance NLS_DATE_FORMAT (from init.ora file) 
4. Database NLS_DATE_FORMAT 


     Session NLS_DATE_FORMAT is set to client side NLS_DATE_FORMAT (explicit or implicit) ONLY if NLS_LANG is set. Another words, if NLS_LANG is set, then session NLS_DATE_FORMAT will be taken from the client. If clent NLS_LANG is set and client NLS_DATE_FORMAT is not, session NLS_DATE_FORMAT will default to DD-MON-YY (and that was exactly what you experienced). If NLS_LANG is not specified on the client side, NLS_DATE_FORMAT will be taken from instance NLS_DATE_FORMAT which is NLS_DATE_FORMAT from INIT.ORA. If NLS_DATE_FORMAT is not set in INIT.ORA, session NLS_DATE_FORMAT will default to DD-MON-YY.


向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

黑龙江省| 吉木乃县| 色达县| 两当县| 壶关县| 东乡县| 宜宾市| 凤凰县| 渝北区| 嵊州市| 磐石市| 抚松县| 太谷县| 巧家县| 成武县| 务川| 泰安市| 舒兰市| 湛江市| 廊坊市| 大荔县| 苏尼特右旗| 韶山市| 凉山| 西丰县| 武宣县| 乌鲁木齐市| 葫芦岛市| 瓦房店市| 上犹县| 蛟河市| 灌南县| 长宁区| 长海县| 麟游县| 沈丘县| 武川县| 普兰县| 中牟县| 洛川县| 葫芦岛市|