撤消对SQL Server 2005数据库的更改

时间:2021-04-03 16:27:42

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?

我在数据库[SQL Server Server 2005]上运行了一些“ALTER”脚本,并覆盖了一些sprocs。有没有办法撤消更改并让我的旧sprocs回来?

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.

有没有办法获取从.LDf文件中执行的脚本?这样我就可以为我的sprocs重新运行我的初始“创建”脚本。

I don't have a backup file with old sprocs.

我没有旧的sprocs的备份文件。

p.s. i backed the DB up as per @Gulzar's deleted answer, and looks like I'm "hosed".

附:我根据@ Gulzar删除的答案支持了数据库,看起来我已经“h”了。

@Pittsburgh DBA: thanx for the solution, but it doesn't seem to work after the backup.

@Pittsburgh DBA:thanx用于解决方案,但它在备份后似乎不起作用。

MORAL: Wait for 10 minutes before trying the suggested answers out

道德:等待10分钟,然后再尝试建议的答案


Update from Gulzar: What I meant was a file backup before trying anything (to be safe). Not a SQL Server backup.

来自Gulzar的更新:我的意思是在尝试任何事情之前备份文件(为了安全起见)。不是SQL Server备份。

4 个解决方案

#1


4  

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

#2


2  

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.

如果其他人遇到同样的问题 - 你每隔X分钟做一次事务日志备份吗?如果是这样,您可以使用Quest LiteSpeed的日志阅读器或Quest Toad for SQL Server的日志阅读器来读取日志文件备份。它还为日志备份或ldf中的任何事务提供撤消/重做脚本。

#3


1  

And after that, look into using ApexSQLScript to script out your databases on a regular basis (and store in version control).

之后,请考虑使用ApexSQLScript定期编写数据库脚本(并存储在版本控制中)。

#4


0  

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.

哟可以!!转到sql server管理工作室,连接到你的数据库,左键单击你的数据库并转到“任务”。选择恢复 - >数据库。然后单击“时间轴”按钮并选择“特定日期”并选择错误前一天。所有可以访问您的数据库的程序都将被关闭。它对我有用,我有同样的问题。

#1


4  

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

#2


2  

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.

如果其他人遇到同样的问题 - 你每隔X分钟做一次事务日志备份吗?如果是这样,您可以使用Quest LiteSpeed的日志阅读器或Quest Toad for SQL Server的日志阅读器来读取日志文件备份。它还为日志备份或ldf中的任何事务提供撤消/重做脚本。

#3


1  

And after that, look into using ApexSQLScript to script out your databases on a regular basis (and store in version control).

之后,请考虑使用ApexSQLScript定期编写数据库脚本(并存储在版本控制中)。

#4


0  

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.

哟可以!!转到sql server管理工作室,连接到你的数据库,左键单击你的数据库并转到“任务”。选择恢复 - >数据库。然后单击“时间轴”按钮并选择“特定日期”并选择错误前一天。所有可以访问您的数据库的程序都将被关闭。它对我有用,我有同样的问题。