如何通过未知文件在SQL Server中设置数据库?
也许这是最蹩脚的问题>><
我正在使用 SQL Server 数据库开发 ASP.net Web 应用程序。当客户要求我开发系统时,他提供了数据库的文件。
我认为该文件是一个转储文件(如果您熟悉 oracle 或 mysql,您可以使用转储文件复制数据库,这基本上是文本文件中的一堆查询)。
令我惊恐的是,加上我对 SQL Server 很陌生,我发现它不是一个转储文件。该文件被重命名为 .bak,这实际上并不是 SQL Server 的正确扩展名。我尝试将其重命名为 .mdf,但没有成功。
我应该怎么办?客户去某个岛屿度假,暂时无法联系?
Probably this is the lamest question ><
I am developing an ASP.net web app with SQL Server database. When the client asked me to develop the system, he provided a file for the database.
I thought the file was a dumpfile (if you familiar with oracle or mysql, you can replicate database with dumpfile, which is basically bunch of queries inside a text file).
To my horror, plus with my noobity in SQL Server, I found out that it was NOT a dumpfile. The file is rename to .bak which is not really the correct extension for SQL Server. I tried to rename it to .mdf, but no luck.
What should I do? The client is out for vacation on some island and cannot be contacted at the moment?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是备份文件,您需要从备份中恢复数据库。
如何:还原数据库备份 (SQL Server Management Studio)
This is backup file, you need to restore database from backup.
How to: Restore a Database Backup (SQL Server Management Studio)
这是 SQL Server 备份数据库文件。您可以按照以下步骤恢复它: http://msdn.microsoft.com/ en-us/library/ms177429.aspx
This is SQL Server backup database file. You can restore it by following these steps: http://msdn.microsoft.com/en-us/library/ms177429.aspx
亚历克斯·阿扎有正确的答案。但请记住在恢复提供的 .bak 文件之前为数据库创建用户。备份文件仅保存用户 ID——完整的用户定义保存在服务器实例中。因此,最好在从另一个服务器实例恢复备份之前创建所需的用户,就像您的项目中的情况一样。
Alex Aza has the right answer. But remember to create users for the database, before you restore the provided .bak file. A backup file only hold a user id -- the complete user definition is held in the server instance. Thus, it is better to create the users needed before restoring a backup from another server instance which is the case in your project.