解決ORA-01861 literal does not match format string

數據腳本里面的時間是'2010-12-12',結果導進去說linux

ORA-01861 literal does not match format string

數據庫裏面的字段是date型的,而後linux安裝的oracel時間格式,根據:sql

 

select * from nls_database_parameters;數據庫

 

SQL> select * from nls_database_parameters;bash

PARAMETER
------------------------------
VALUE
--------------------------------------------------------------------------------
NLS_LANGUAGE
AMERICANspa

NLS_TERRITORY
AMERICAorm

NLS_CURRENCY
$get


PARAMETER
------------------------------
VALUE
--------------------------------------------------------------------------------
NLS_ISO_CURRENCY
AMERICAstring

NLS_NUMERIC_CHARACTERS
.,it

NLS_CHARACTERSET
ZHS32GB18030io


PARAMETER
------------------------------
VALUE
--------------------------------------------------------------------------------
NLS_CALENDAR
GREGORIAN

NLS_DATE_FORMAT
DD-MON-RR

NLS_DATE_LANGUAGE
AMERICAN


PARAMETER
------------------------------
VALUE
--------------------------------------------------------------------------------
NLS_SORT
BINARY

NLS_TIME_FORMAT
HH.MI.SSXFF AM

NLS_TIMESTAMP_FORMAT
DD-MON-RR HH.MI.SSXFF AM


PARAMETER
------------------------------
VALUE
--------------------------------------------------------------------------------
NLS_TIME_TZ_FORMAT
HH.MI.SSXFF AM TZR

NLS_TIMESTAMP_TZ_FORMAT
DD-MON-RR HH.MI.SSXFF AM TZR

NLS_DUAL_CURRENCY
$


PARAMETER
------------------------------
VALUE
--------------------------------------------------------------------------------
NLS_COMP
BINARY

NLS_LENGTH_SEMANTICS
BYTE

NLS_NCHAR_CONV_EXCP
FALSE


PARAMETER
------------------------------
VALUE
--------------------------------------------------------------------------------
NLS_NCHAR_CHARACTERSET
AL16UTF16

NLS_RDBMS_VERSION
11.2.0.4.0

 

NLS_TIME_FORMAT就是日期格式,這裏爲 HH.MI.SSXFF AM ,

NLS_LANGUAGE 爲 AMERICA ,字符集也不對,致使生成的一堆數據庫表有不少亂碼。

 

在當前用戶下 修改 .bash_profile,增長三個:

export LANG=C
export NLS_DATE_FORMAT=YYYY-MM-DD
export NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS32GB18030"

[test@rhel675771 bb]$ 

Last login: Thu Jul 14 20:09:17 2016 from 10.187.191.55

 

test

[test@rhel675771 ~]$ 

[test@rhel675771 ~]$ test

[test@rhel675771 ~]$ pwd
/datafs/fs

[test@rhel675771 ~]$ vi .bash_profile;

 

PATH=$PATH:$HOME/bin

export PATH

export PATH

export LANG=C
export NLS_DATE_FORMAT=YYYY-MM-DD
export NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS32GB18030"

保存修改後退出,另起一個會話,登進SQL

 

[test@rhel675771 ~]$ test
[test@rhel675771 ~]$ pwd
/datafs/fs
[test@rhel675771 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on 星期五 7月 15 08:45:16 2016

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

 

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

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

 

字符集已經改變,數據也能夠成功導入。

相關文章
相關標籤/搜索