Oracle¿Í»§¶ËNLS_LANGÉèÖÃ
1. NLS_LANG
²ÎÊý×é³É
NLS_LANG
²ÎÊýÓÉÒÔϲ¿·Ö×é³É:
NLS_LANG
=<Language>_<Territory>.<Clients
Characterset>
NLS_LANG
¸÷²¿·Öº¬ÒåÈçÏÂ:
LANGUAGEÖ¸¶¨:
-OracleÏûϢʹÓõÄÓïÑÔ
-ÈÕÆÚÖÐÔ·ݺÍÈÕÏÔʾ
TERRITORYÖ¸¶¨
-»õ±ÒºÍÊý×Ö¸ñʽ
-µØÇøºÍ¼ÆËãÐÇÆÚ¼°ÈÕÆÚµÄÏ°¹ß
CHARACTERSET:
-¿ØÖÆ¿Í»§¶ËÓ¦ÓóÌÐòʹÓõÄ×Ö·û¼¯
ͨ³£ÉèÖûòÕßµÈÓÚ¿Í»§¶Ë(ÈçWindows)´úÂëÒ³
»òÕ߶ÔÓÚunicodeÓ¦ÓÃÉèÖÃΪUTF8
ÔÚWindowsÉϲ鿴µ±Ç°ÏµÍ³µÄ´úÂëÒ³¿ÉÒÔʹÓÃchcpÃüÁî:
E:\>chcp
»î¶¯µÄ´úÂëÒ³: 936
´úÂëÒ³936Ò²¾ÍÊÇÖÐÎÄ×Ö·û¼¯ GBK,ÔÚMicrosoftµÄ¹Ù·½Õ¾µãÉÏ£¬ÎÒÃÇ¿ÉÒÔÔâµ½¹ØÓÚ936´úÂëÒ³µÄ¾ßÌå±àÂë¹æÔò,Çë²Î¿¼ÒÔÏÂÁ´½Ó:
http://www.microsoft.com/globaldev/reference/dbcs/936.htm
2. ²é¿´ NLS_LANG
µÄ·½·¨
WindowsʹÓÃ:
echo %NLS_LANG
%
Èç:
E:\>echo %NLS_LANG
%
AMERICAN_AMERICA.ZHS16GBK
UnixʹÓÃ:
env|grep NLS_LANG
Èç:
/opt/oracle>env|grep NLS_LANG
NLS_LANG
=AMERICAN_CHINA.ZHS16GBK
Windows¿Í»§¶ËÉèÖÃ,¿ÉÒÔÔÚ×¢²á±íÖиü¸ÄNLS_LANG
,¾ßÌå¼üֵλÓÚ:
HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\HOMExx\
xxÖ¸´æÔÚ¶à¸öORACLE_HOMEʱϵͳ±àºÅ¡£
3. ²é¿´Êý¾Ý¿âµ±Ç°×Ö·û¼¯²ÎÊýÉèÖÃ
SELECT * from v$nls_parameters;
»ò
select * from nls_database_parameters
»ò
select userenv(‘language’) from dual;
4. ²é¿´Êý¾Ý¿â¿ÉÓÃ×Ö·û¼¯²ÎÊýÉèÖÃ
SELECT * from v$nls_valid_values;
5. ¿Í»§¶Ë NLS_LANG
µÄÉèÖ÷½·¨
Windows:
# ³£ÓÃÖÐÎÄ×Ö·û¼¯
set NLS_LANG
=SIMPLIFIED
CHINESE_CHINA.ZHS16GBK
# ³£ÓÃunicode×Ö·û¼¯
set NLS_LANG
=american_america.AL32UTF8
¿ÉÒÔͨ¹ýÐÞ¸Ä×¢²á±í¼üÖµÓÀ¾ÃÉèÖÃ
HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\HOMExx\NLS_LANG
Unix:
# ³£ÓÃunicode×Ö·û¼¯
export NLS_LANG
=american_america.AL32UTF8
# ³£ÓÃÖÐÎÄ×Ö·û¼¯
export NLS_LANG
="Simplified
Chinese_china".ZHS16GBK
¿ÉÒԱ༠bash_profile Îļþ½øÐÐÓÀ¾ÃÉèÖÃ
vi .bash_profile
NLS_LANG
="Simplified
Chinese_china".ZHS16GBK export NLS_LANG
# ʹ bash_profile ÉèÖÃÉúЧ
source .bash_profile
Ïà¹ØÎĵµ£º
Ò»£¬¼òµ¥½éÉÜ
ÔÚoracleÖÐsequence¾ÍÊÇËùνµÄÐòÁкţ¬Ã¿´ÎÈ¡µÄʱºòËü»á×Ô¶¯Ôö¼Ó£¬Ò»°ãÓÃÔÚÐèÒª°´
ÐòÁкÅÅÅÐòµÄµØ·½¡£
1¡¢ create sequence
ÄãÊ×ÏÈÒªÓÐcreate sequence»òÕßcreate any sequenceȨÏÞ£¬
create sequence emp_sequence
&n ......
Êý¾ÝÎļþ
¡¡¡¡Ã¿Ò»¸öOracleÊý¾Ý¿â¶¼ÓÐÒ»¸ö»ò¶à¸öÎïÀíµÄÊý¾ÝÎļþ,Êý¾Ý¿âÐÅÏ¢(½á¹¹,Êý¾Ý)¶¼±£´æÔÚÕâЩÊý¾ÝÎļþÖÐ,²¢ÇÒÕâЩÎļþÒ²Ö»Oracle²ÅÄܹ»½âÊÍÓë¹ÜÀíÕâЩ´æ´¢.OracleÊý¾ÝÎļþ¾ßÓÐÒÔÏÂһЩÌØÐÔ:
¡¡¡¡1.Ò»¸öÊý¾ÝÎļþ½ö½ö¹ØÁªÒ»¸öÊý¾Ý¿â,Êý¾ÝÎļþÓëÊý¾Ý¿âÖ®¼ä¶ÔÓ¦¹ØϵÊÇÒ»¶ÔÒ»¹Øϵ,µ±È»·´¹ýÊý¾Ý¿âÓëÊý¾ÝÎļþÊÇÒ»¶Ô¶à¹Øϵ. ......
ÔÚÊý¾Ý¿âÖУ¬ÓÐÁ½¸öÓû§usera£¬userb£¬Èç¹ûÔÚbÖÐÓиö´æ´¢¹ý³Ì£¬ÐèÒªÓÃaµÄÓû§È¥µ÷Ó㬣¨±ÈÈçbÊÇȨÏ޺ܸߵÄÓû§£¬¶øaÖ»ÊÇÆÕͨÓû§£¬ÎªÁËÆÁ±Î¸øa×îСµÄȨÏÞÖ»ÄÜÈç´Ë£©¡£ÓÚÊÇ£¬ÎÒ¾ÍÓÃgrant execute on ´æ´¢¹ý³ÌÃû to usera¡£ÕâÑù£¬ÔÚaµÄÓû§ÏÂÃæ¾ÍÄÜ¿´µ½´æ´¢¹ý³ÌÁË£¬µ«ÊÇÎÒÖ´ÐÐÒԺ󣬻¹ÊDZ¨ora-1031£¬ËµÊÇûÓÐȨÏÞ£¬¾¹ýÓ ......
»ØÊÕÕ¾,´ÓÔÀíÉÏÀ´Ëµ¾ÍÊÇÒ»¸öÊý¾Ý×Öµä±í,·ÅÖÃÓû§DropµôµÄÊý¾Ý¿â¶ÔÏóÐÅÏ¢.Óû§½øÐÐDrop²Ù×÷µÄ¶ÔÏó²¢Ã»Óб»Êý¾Ý¿âɾ³ý,ÈÔÈ»»áÕ¼Óÿռä.³ý·ÇÊÇÓÉÓÚÓû§ÊÖ¹¤½øÐÐPurge»òÕßÒòΪ´æ´¢¿Õ¼ä²»¹»¶ø±»Êý¾Ý¿âÇåµô.Êý¾Ý¿âÓÐÁËÕâÑùµÄ¹¦ÄÜ,Äܹ»¼õÉٺܶ಻±ØÒªµÄÂé·³.¾³£¿´µ½¿ª·¢ÈËÔ±Îó°Ñ±íɾ³ý,¼±¼±Ã¦Ã¦ÕÒDBAÀ´Ïë°ì·¨µÄÇé¿ö,ÏàÐÅ,Ëæ×Å10G ......