|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
导致了一个使用几乎和mSQL一样的API接口的用于他们的数据库的新的SQL接口的产生,这样,这个API被设计成允许为用于mSQL而写的第三方代码更容易移植到MySQL。
Characterset字符集
zyqin
创立:2005-03-25
英文:http://www.dbonline.cn
Ifthedatabasehasbeencreatedwiththewrongcharacterset,usethefollowingtochangethecharacterset
UPDATESYS.PROPS$
SETVALUES$=WE8ISO8859P1
WHERENAME=NLS_CHARACTERSET;
ItisVERYimportanttospecifythecharactersetnamecorrectly.IftheNLS_CHARACTERSETisupdatedtoaninvalidvalue,itwillnotthenbepossibletorestartthedatabaseonceithasbeenshutdown.
假如已创立的数据库利用了毛病的字符集,你可使用上面的办法修正字符集:
UPDATESYS.PROPS$
SETVALUES$=WE8ISO8859P1
WHERENAME=NLS_CHARACTERSET;
注重:确保字符集称号的正确性长短常主要的。假如NLS_CHARACTERSET被更新成一个毛病的值,数据库封闭后就没法从头启动了。
Update
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
Fromversion8youcannowupdatethecharactersetusingthealterdatabasecommand.Anextractfromthedocumentationisincludedbelow,thebasicrulebeingthatthenewcharactersetmustbeasupersetofthecurrentset.Interestinglyenough,Itriedtheaboveupdatewithacharactersetthatviolatedthatrule,itstillworks-ofcourse,anycharactercodedifferenceswillwouldinevitablycausesomeproblems,soitwouldbesafesttousethesupportedsyntax.
Quotefromthe(8.1.6)documentationreveals:
Oracle8今后的数据库能够经由过程利用alterdatabase命令修正字符集。援用文档中的一句话:新的字符集必需是本来字符集的一个超集。成心思的是,我已经更新字符集是违背了这一准绳,数据库还是事情;固然了,任何字符码都大概招致一样的成绩,以是最平安的办法仍是依照划定规矩做事。
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
"ChangingtheCharacterSetAfterDatabaseCreation
Insomecases,youmaywishtochangetheexistingdatabasecharacterset.Forinstance,youmayfindthatthenumberoflanguagesthatneedtobesupportedinyourdatabasehaveincreased.Inmostcases,youwillneedtodoafullexport/importtoproperlyconvertalldatatothenewcharacterset.However,ifandonlyif,thenewcharactersetisastrictsupersetofthecurrentcharacterset,itispossibletousetheALTERDATABASECHARACTERSETtoexpeditethechangeinthedatabasecharacterset.
偶然候,你大概必要修正以后数据库的字符集。这时候你会发明你必要增添数据库撑持的缘故原由的品种。多半情形下,你大概必要经由过程完整的export/import导进/导出来完成。假如,仅仅是假如,新的字符集是以后字符集的一个严厉的超集,利用ALTERDATABASECHARACTERSET命令是一个可行的办法。
Thetargetcharactersetisastrictsupersetifandonlyifeachandeverycodepointinthesourcecharactersetisavailableinthetargetcharacterset,withthesamecorrespondingcodepointvalue.ForinstancethefollowingmigrationscenarioscantakeadvantageoftheALTERDATABASECHARACTERSETcommandsinceUS7ASCIIisastrictsubsetofWE8ISO8859P1,AL24UTFFSS,andUTF8:
CurrentCharacterSetNewCharacterSetNewCharacterSetisstrictsuperset?
US7ASCIIWE8ISO8859P1yes
US7ASCIIALT24UTFFSSyes
US7ASCIIUTF8yes
假如A字符会合的每个codepoint在B字符会合都有不异的无效值,那末B字符集就能够成为A字符集的一个超集。比方,上面的迁徙计划可使用ALTERDATABASECHARACTERSET命令,由于US7ASCII是WE8ISO8859P1,AL24UTFFSS和UTF8的超集。
以后字符集新字符集新字符集是不是为超集
US7ASCIIWE8ISO8859P1是
US7ASCIIALT24UTFFSS是
US7ASCIIUTF8是
WARNING:Attemptingtochangethedatabasecharactersettoacharactersetthatisnotastrictsupersetcanresultindatalossanddatacorruption.Toensuredataintegrity,whenevermigratingtoanewcharactersetthatisnotastrictsuperset,youmustuseexport/import.ItisessentialtodoafullbackupofthedatabasebeforeusingtheALTERDATABASE[NATIONAL]CHARACTERSETstatement,sincethecommandcannotberolledback.Thesyntaxis:
ALTERDATABASE[<db_name>]CHARACTERSET<new_character_set>;
ALTERDATABASE[<db_name>]NATIONALCHARACTERSET<new_NCHAR_character_set>;
Thedatabasenameisoptional.Thecharactersetnameshouldbespecifiedwithoutquotes,forexample:
ALTERDATABASECHARACTERSETWE8ISO8859P1;
Tochangethedatabasecharacterset,performthefollowingsteps.Notallofthemareabsolutelynecessary,buttheyarehighlyrecommended:
SQL>SHUTDOWNIMMEDIATE;--orNORMAL
<doafullbackup>
SQL>STARTUPMOUNT;
SQL>ALTERSYSTEMENABLERESTRICEDSESSION;
SQL>ALTERSYSTEMSETJOB_QUEUE_PROCESSES=0;
SQL>ALTERDATABASEOPEN;
SQL>ALTERDATABASECHARACTERSET<new_character_set_name>;
SQL>SHUTDOWNIMMEDIATE;--orNORMAL
SQL>STARTUP;
Tochangethenationalcharacterset,replacetheALTERDATABASECHARACTERSETstatementwithALTERDATABASENATIONALCHARACTERSET.Youcanissuebothcommandstogetherifdesired."
这类操作的执行过程是,1)按照新的表定义建立一个临时表tmpa,2)将原表数据拷贝到临时表,3)将原始表改名tmpb,4)将tmpa改名为原表名,5)将tmpb删除。 |
|