撤消对 SQL Server 2005 数据库的更改
我在数据库 [SQL Server Server 2005] 上运行了一些“ALTER”脚本,并覆盖了一些存储过程。 有什么方法可以撤消更改并恢复我的旧存储过程吗?
有没有办法获取从 .LDf 文件中执行的脚本? 这样我就可以为我的存储过程重新运行最初的“创建”脚本。
我没有旧存储过程的备份文件。
PS我按照@Gulzar的删除的答案备份了数据库,看起来我被“束缚”了。
@匹兹堡DBA:感谢解决方案,但备份后似乎不起作用。
道德:在尝试建议的答案之前等待 10 分钟
来自 Gulzar 的更新:我的意思是在尝试任何操作之前先进行文件备份(为了安全起见)。 不是 SQL Server 备份。
I've ran some "ALTER" scripts on the database [SQL Server Server 2005], and overwrote some sprocs. Is there any way to undo changes and get my old sprocs back?
Is there a way to get the scripts that were executed out of the .LDf file? That way i can re-run my initial "create" script for my sprocs.
I don't have a backup file with old sprocs.
p.s. i backed the DB up as per @Gulzar's deleted answer, and looks like I'm "hosed".
@Pittsburgh DBA: thanx for the solution, but it doesn't seem to work after the backup.
MORAL: Wait for 10 minutes before trying the suggested answers out
Update from Gulzar: What I meant was a file backup before trying anything (to be safe). Not a SQL Server backup.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
首先:暂时不要进行任何备份。
市场上有多种工具可以完成此类操作。
您可以尝试这个:
ApexSQL Log
FIRST: DO NOT TAKE ANY BACKUPS JUST YET.
There are several tools on the market to do this sort of thing.
You might try this one:
ApexSQL Log
如果其他人也遇到同样的问题 - 您是否每 X 分钟进行一次事务日志备份? 如果是这样,您可以使用 Quest LiteSpeed 的日志阅读器或 Quest Toad for SQL Server 的日志阅读器来读取日志文件备份。 它也为日志备份或 ldf 中的任何事务提供撤消/重做脚本。
In case anybody else has the same problem - Were you doing transaction log backups every X minutes? If so, you can use Quest LiteSpeed's log reader or Quest Toad for SQL Server's log reader to read the log file backups. It gives undo/redo scripts too for any transaction in the log backups or the ldf.
之后,考虑使用 ApexSQLScript 定期编写数据库脚本(并存储在版本控制中)。
And after that, look into using ApexSQLScript to script out your databases on a regular basis (and store in version control).
哟可以!!
转到sql server管理工作室,连接到您的数据库,左键单击您的数据库并转到“任务”。
选择恢复-> 数据库。
然后单击“时间线”按钮并选择“特定日期”并选择出错前的一天。
必须关闭所有有权访问数据库的程序。
它对我有用,我也有同样的问题。
yo do can!!
go to sql server managment studio,connect to your db, left click on your db and go to "tasks".
select restore -> database.
then click the "timeline" button and select 'especific date' and select the day before your mistake.
All programs that have access to your db mus be closed.
It worked for me, i had this very same probelm.