当前位置: 首页 > 图文教程 > 数据库 > DB2 > WIN2000下使用SQL Server错误一例

DB2
DB2常用傻瓜问题1000问(四)
DB2常用傻瓜问题1000问(三)
DB2常用傻瓜问题1000问(二)
JSP如何连接DB2数据库
常见数据库系统比较 DB2数据库
DB2数据库的备份和恢复
DB2个人版(Linux)安装
IBM DB2 基本性能调整
DB2 UDB V8.1管理学习笔记(三)
DB2 UDB V8.1管理学习笔记(一)
DB2数据同步方面的经验
DB2编程序技巧 (十)
DB2编程序技巧 (九)
DB2编程序技巧 (八)
DB2编程序技巧 (七)
DB2编程序技巧 (六)
DB2编程序技巧 (五)
DB2编程序技巧 (三)
DB2编程序技巧 (一)
IBM DB2 日常维护汇总(九)

DB2 中的 WIN2000下使用SQL Server错误一例


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-10-31   浏览: 41 ::
收藏到网摘: n/a

在Win2000 Server & Professional不能Attach DB File的原因和解决方法。


    yy的SQL Server因为Master DB损坏,在没有Backup的情况下,无法修复和Restore,无奈只能Reinstall SQL Server,然后用Sp_attach_db来附加原来的应用DB File(xxx.mdf and xxx.ldf)。
为了保险起见,准备现在一台双平台的电脑上面试验。这台电脑c:\为简体中文win98,然后从win98安装了简体中文Win2000 Server到D:\
在中文Win2000下,以Default方式安装了SQL Server English Standard edition,Restarting Computer,一切正常。
进入Programs \ Microsoft SQL Server 7.0 \ Query Analyzer,在Master DB中执行如下命令:
Exec sp_attach_db ‘xxx’, ‘d:\Mssql7\data\xxx_data.mdf’, ‘d:\Mssql7\data\xxx_log.ldf’
随即出现错误提示:
Server: Msg 1816, Level 16, State 1, Line 1
Could not attach the database because the character set, sort order, or Unicode collation for the database differs from this server.
Server: Msg 1816, Level 16, State 1, Line 1
Could not attach the database because the character set, sort order, or Unicode collation for the database differs from this server.
Warning: sort order 52 in database differs from server sort order of 199.
Warning: Unicode language locale 1033 in database differs from server Unicode language locale of 2052.
Warning: sort
错误信息指出:因为字符集设置、排序或者Unicode collation和本服务器不一致,所以无法附加数据库。
MS SQL Server 安装时如果选择Default安装的话,Default字符集是Chinese,考虑可能是这里的问题,yy为此再次Uninstall SQL Server,并且在Install的时候选手动设置了字符集为ISO Charact Set, Sort Order为Dictionary order, case-insensitive, Unicode Collation为General.
安装完毕再次执行sp_attach_db,仍然提示出错,错误仍然不变。
这下百思不得其解,多方询问朋友仍然不能解决。突然想到,是不是因为从中文98种安装win2000致使win2000的字符集无法和SQL Server以致呢?虽然不能肯定是这样,但是抱着试试看的一丝希望在一台直接安装win2000的机器上重复上述步骤,完全成功。然后再返回出错的机,从dos Reinstall Win2000,删除以前的Win2000, 重复上述步骤,也完全成功。
证明问题出在从中文win98升级或者安装的win2000字符集将和英文SQL Server和其下建立的DB不一致,相信除了不能Attach DB外,可能应用的时候还会出现其他问题。
相信朋友们很少有象我这样恢复数据库的,也不大可能遇上这个问题,但是我还是愿意写出来给大家参考。至于产生这个问题的更深层的原因,我现在也不大清楚,如果哪位朋友知道,请帖出来,ok?呵呵


作者:yy   E-mail: [email protected] or [email protected]