简体   繁体   English

删除数据库文件后,数据库已经存在

[英]Database already exists even after deleting the database files

I installed a trading software that uses pair specified and gives me details about it. 我安装了一个使用指定对的交易软件,并提供了有关它的详细信息。 For initiating the software I have to create a database that it uses to store and retrieve information from. 为了启动软件,我必须创建一个用于存储和检索信息的数据库。 Now I have deleted the database(mdf and ldf file) and now when I create it again it shows that database already exists error. 现在我已经删除了数据库(mdf和ldf文件),现在当我再次创建它时,它显示数据库已经存在错误。 Do I have to delete DSN or something? 我是否必须删除DSN或其他内容? I can do create database using another sql server instance, but I want to do on the same one. 我可以使用另一个sql server实例创建数据库,但我想在同一个实例上创建数据库。 I am clueless. 我很无能为力。 Thanks in advance. 提前致谢。

The database information is maintained by sql server express. 数据库信息由sql server express维护。 So just deleting the file doesn't remove the database from sql server. 因此,只删除该文件不会从sql server中删除数据库。 You need to detach the database and then your logic should work. 您需要分离数据库,然后您的逻辑应该工作。 Try sql server management studio express 2008. Or try connect to sql server express programmatically and execute sp_detach_db permissions. 尝试sql server management studio express 2008.或者尝试以编程方式连接到sql server express并执行sp_detach_db权限。

Source : MSDN 资料来源:MSDN

A Database is not only MDF and LDF files but also a record in the master database. 数据库不仅是MDF和LDF文件,还是主数据库中的记录。 So you should drop this record about your DB using DROP DATABASE command or through MSSQL Enterprise Manager. 因此,您应该使用DROP DATABASE命令或通过MSSQL企业管理器删除有关数据库的此记录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM