有没有办法取消删除SQL Server数据库和存储过程?
不,我没有备份。这就是我需要帮助的原因
答案 0 :(得分:8)
从备份恢复。
你有备份,对吧?
编辑: 我假设您可能在SQL Management Studio中右键单击“删除”?如果是这样,那实际上会对数据库进行“删除”,从字面上删除硬盘中的文件。如果是这种情况,您必须从最新的备份(如果有的话)恢复。
如果您刚刚执行了“分离”,则MDF和LDF文件仍在硬盘驱动器上,您只需附加它们即可。
答案 1 :(得分:3)
你究竟是如何删除它的。
如果从那时起你没有对磁盘文件系统进行任何更改(而不是defraged),则可能该文件仍将位于磁盘上,因为Windows不会完全删除文件,只是文件句柄。
查看类似的内容,您可以从HD恢复.mdf / .ldf文件。
http://www.undelete.com/file-recovery.aspx
如果没有,你将不得不从最后一次恢复。
如果你没有备份......你就搞砸了。
答案 2 :(得分:1)
If you accidently deleted the database in SQL Server Management Studio by right clicking and hitting delete in a hurry and you have no backup then there might still be a chance of getting back the database:
Don't do any save / delete file operations on the disk where the database file was stored, browsing should be ok.
Find the location where the .mdf file used to be. In my case it was "c:\Program Files\Microsoft SQL Server\MSSQL11.SQLEXPRESS2012\MSSQL\DATA". If you have multiple databases you can right click on an existing one, select properties and files. Find the location entry in the listbox under path (select and ctrl+c to copy it)
Download a portable undelete program e.g. Recuva to a USB drive/stick (unzip) and run it from the USB drive/stick.
Set the copied path as the "search location" in your undelete program (ctrl+v), recover "YOURDATABASE.mdf" and "YOURDATABASE_log.ldf" to the USB drive.
Copy the files from USB drive/stick to the original location.
In SQL Server Management Studio right click on "Databases" select "Attach.." click Add, select "YOURDATABASE.mdf".
Get some coffee and think about backups :-)
答案 3 :(得分:0)
您是丢弃数据库还是拆分数据库?如果你已经分离它,那么只需从mdf和ldf文件中重新连接它。