a few minutes ago I had a discussion with my boss and want now more meanings, if I am wrong or he is.
几分钟前,我与老板讨论过,如果我错了,或者他是,我现在想要更多的意思。
Following problem is given: After a fast change from a colleague a stored procedure went wrong. (I think for the theory here is no more information requiered)
出现以下问题:从同事快速更改后,存储过程出错了。 (我认为这里的理论不再需要更多的信息)
We decide to provide the correct version in an Update Script:
我们决定在更新脚本中提供正确的版本:
IF EXIST PROCEDURE X .... DROP PROCEDURE X .... CREATE PROCEDURE X ....
如果存在程序X .... DROP PROCEDURE X ....创建程序X ....
For the DBO that the correcture will be execute, we must (should) prepare an rollback mechanism. My Boss comes to me and ask me for preparing an rollback script. I tell him, that we don't have one: Because when the main script failed, there is no option. It went now completly wrong, we can't rollback to the wrong one. It's senseless.
对于将要执行更正的DBO,我们必须(应该)准备一个回滚机制。我的老板来找我并要求我准备一个回滚脚本。我告诉他,我们没有:因为当主脚本失败时,没有选择。它现在完全错了,我们不能回滚到错误的。这是毫无意义的。
He told me, that we need it and it is not senseles..
他告诉我,我们需要它,而不是感觉......
When I asked for a reason, he goes away.
当我问起一个理由时,他就走了。
I am wrong?
我错了?
4 个解决方案
#1
If this is a production server, where you wouldn't want downtime, you should have a rollback procedure. Even if that procedure is to just back the database up before the upgrade and restore from backup on failure.
如果这是一个生产服务器,您不希望停机,那么您应该有一个回滚过程。即使该过程仅在升级之前备份数据库并在失败时从备份恢复。
You also imply that 'create procedure' will either work or not. This is true, but it doesn't mean the procedure will actually work. You can create a stored procedure (at least on SQL Server) that references a table that doesn't exist, and it will compile just fine.
你还暗示'创建程序'将起作用或不起作用。这是事实,但这并不意味着程序实际上会起作用。您可以创建一个引用不存在的表的存储过程(至少在SQL Server上),它将编译得很好。
#2
There is some logic to what you're saying, but I could agree with your boss if the argument is tantamount to saying "we don't need to back up code that isn't working"
你所说的有一些逻辑,但我可以同意你的老板,如果这个论点等于说“我们不需要备份不起作用的代码”
It's still somebody's expensive hours put into that, and the flaw may be a minor one. If it is conceivable that further updates could somehow make things even more wrong, then it is reasonable to request the ability to roll back to the less broken state.
这仍然是某人的昂贵时间,而这个缺陷可能是一个小问题。如果可以想象进一步的更新可能会使某些事情变得更加错误,那么请求能够回滚到较不破碎的状态是合理的。
#3
Two wrongs don't make a right.
两个错误并不是正确的。
If the previous change to the SP had a rollback option then you wouldn't be in this situation. So even though you know that any rollback will go to a "bad" version. It should still be there.
如果之前对SP的更改有回滚选项,那么您将不会处于这种情况。所以即使你知道任何回滚都会变成“坏”版本。它应该还在那里。
The update you do here could break things a lot more than they currently are.
你在这里做的更新可能比现在更容易破坏。
#4
After a fast change from a colleague a stored procedure went wrong. (I think for the theory here is no more information requiered)
从同事快速更改后,存储过程出错了。 (我认为这里的理论不再需要更多的信息)
More information is required.
需要更多信息。
When changing a script, your colleague did two things:
更改脚本时,您的同事做了两件事:
- He did (or did not) improve a stored procedure he fixed
- He introduced a bug in this stored procedure
他介绍了这个存储过程中的一个错误
他做了(或没有)改进他修复的存储过程他在这个存储过程中引入了一个bug
Whether you should or should not write this script, depends on these factors:
是否应该编写此脚本取决于以下因素:
- How significant the improvement was (if any)
- How severe is the bug, and
- How hard is to write this script.
这个bug有多严重,而且
写这个脚本有多难。
改进的重要性(如果有的话)错误有多严重,编写此脚本有多难。
#1
If this is a production server, where you wouldn't want downtime, you should have a rollback procedure. Even if that procedure is to just back the database up before the upgrade and restore from backup on failure.
如果这是一个生产服务器,您不希望停机,那么您应该有一个回滚过程。即使该过程仅在升级之前备份数据库并在失败时从备份恢复。
You also imply that 'create procedure' will either work or not. This is true, but it doesn't mean the procedure will actually work. You can create a stored procedure (at least on SQL Server) that references a table that doesn't exist, and it will compile just fine.
你还暗示'创建程序'将起作用或不起作用。这是事实,但这并不意味着程序实际上会起作用。您可以创建一个引用不存在的表的存储过程(至少在SQL Server上),它将编译得很好。
#2
There is some logic to what you're saying, but I could agree with your boss if the argument is tantamount to saying "we don't need to back up code that isn't working"
你所说的有一些逻辑,但我可以同意你的老板,如果这个论点等于说“我们不需要备份不起作用的代码”
It's still somebody's expensive hours put into that, and the flaw may be a minor one. If it is conceivable that further updates could somehow make things even more wrong, then it is reasonable to request the ability to roll back to the less broken state.
这仍然是某人的昂贵时间,而这个缺陷可能是一个小问题。如果可以想象进一步的更新可能会使某些事情变得更加错误,那么请求能够回滚到较不破碎的状态是合理的。
#3
Two wrongs don't make a right.
两个错误并不是正确的。
If the previous change to the SP had a rollback option then you wouldn't be in this situation. So even though you know that any rollback will go to a "bad" version. It should still be there.
如果之前对SP的更改有回滚选项,那么您将不会处于这种情况。所以即使你知道任何回滚都会变成“坏”版本。它应该还在那里。
The update you do here could break things a lot more than they currently are.
你在这里做的更新可能比现在更容易破坏。
#4
After a fast change from a colleague a stored procedure went wrong. (I think for the theory here is no more information requiered)
从同事快速更改后,存储过程出错了。 (我认为这里的理论不再需要更多的信息)
More information is required.
需要更多信息。
When changing a script, your colleague did two things:
更改脚本时,您的同事做了两件事:
- He did (or did not) improve a stored procedure he fixed
- He introduced a bug in this stored procedure
他介绍了这个存储过程中的一个错误
他做了(或没有)改进他修复的存储过程他在这个存储过程中引入了一个bug
Whether you should or should not write this script, depends on these factors:
是否应该编写此脚本取决于以下因素:
- How significant the improvement was (if any)
- How severe is the bug, and
- How hard is to write this script.
这个bug有多严重,而且
写这个脚本有多难。
改进的重要性(如果有的话)错误有多严重,编写此脚本有多难。