[原创]修改oracle 数据库默认时间格式
突然想修改下oracle默認的時間格式,在論壇搜索了一大圈,嘗試了很多答案,發現都是謬論,以下是oracle在linux環境下的解決方案。
linux下通過修改spfile文件可以解決,跟環境變量 NLS_DATE_FORMAT毛關系都沒有。另外,也測試了windows下只跟環境變量NLS_DATE_FORMAT有關系,跟spfile無關。
今天還搜索到一種方式,通過修改oracle參數文件$ORACLE_HOME/dbs/inita.ora來實現,未驗證通過,但按原理來說應該是可以的。這么一個簡簡單單的問題,耗費了我大量時間啊,一切都是不明白oracle體系結構,執行機制而產生的,要努力掌握這一塊!!。
實驗環境:linux+oracle 10.2.0.1
?????????????? windows+oracle 10.2.0.5
[oracle@gzsjmp ~]$ sqlplus sys/haitao88 as sysdba;
SQL*Plus: Release 10.2.0.1.0 - Production on Sun Mar 3 16:02:27 2013
Copyright (c) 1982, 2005, Oracle.? All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production With the Partitioning, OLAP and Data Mining options
SQL> select sysdate from dual;
SYSDATE ---------- 2013-03-03
SQL> alter system set nls_date_format='YYYY-MM-DD hh24:mi:ss' scope=spfile;
System altered.
SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL> startup; ORACLE instance started.
Total System Global Area? 599785472 bytes Fixed Size????????????????? 2022632 bytes Variable Size???????????? 234881816 bytes Database Buffers????????? 360710144 bytes Redo Buffers??????????????? 2170880 bytes Database mounted. Database opened. SQL> select sysdate from dual;
SYSDATE ------------------- 2013-03-03 16:04:38
SQL> show parameters nls
NAME???????????????????????????????? TYPE??????? VALUE ------------------------------------ ----------- ------------------------------ nls_calendar???????????????????????? string nls_comp???????????????????????????? string nls_currency???????????????????????? string nls_date_format????????????????????? string????? YYYY-MM-DD hh24:mi:ss nls_date_language??????????????????? string
SQL> exit Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production With the Partitioning, OLAP and Data Mining options [oracle@gzsjmp ~]$? echo $NLS_DATE_FORMAT; YYYY-MM-DD
轉載于:https://www.cnblogs.com/everchase/archive/2013/05/06/3062481.html
總結
以上是生活随笔為你收集整理的[原创]修改oracle 数据库默认时间格式的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 杀死木马进程
- 下一篇: ios url缓存策略——NSURLCa