将系统数据库恢复到具有不同名称的 SQL Server 时会发生什么情况?
我目前正在研究灾难恢复计划并恢复 master/msdb/model 的备份。
理论上,如果我将 master、msdb、模型和用户数据库恢复到新安装的服务器上(使用相同的服务包等),那么我将拥有原始服务器的精确副本,其中包含所有维护计划、作业和所有内容。
但是如果新服务器名称与原始服务器名称不同会发生什么情况? 它只是应付,还是在这种情况下需要一些额外的步骤?
(MSDN 文档在这些方面有点简短)
我正在使用 SQL 2005。
编辑:下面有几个答案很有帮助,但据我所知,它们都没有清楚地回答问题。 我的问题是:在恢复 master、msdb 等之后(假设我没有使用任何 SQL 加密内容),如果新服务器和 SQL 实例的名称与原始服务器和 SQL 实例的名称不同,一切都会正常吗? 或者我必须保持相同的名字吗? 已接受的答案仍然有待争夺!
I'm currently looking at disaster recovery plans and restoring backups of master/msdb/model.
In theory if I restore master, msdb, model and the user databases onto a fresh server install (with the same service packs etc) then I will have an exact copy of the original server, with all the maintenance plans and jobs and everything.
But what happens if the new server name is different to the original? Does it just cope, or are there some extra steps needed in this case?
(The MSDN documentation is a bit brief in these areas)
I'm on SQL 2005.
edit: there's a couple of answers below that are helpful, but neither of them clearly answers the question as far as I can tell. My question was: after restoring master, msdb etc, (and assuming I'm not using any of that SQL encryption stuff) will everything work OK if the new server and SQL instance has a different name to the original? Or do I have to keep the same name? The accepted answer tick is still up for grabs!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正确的,一切都应该是相同的并且准备就绪。
服务器名称更改如下所述:如何:重命名托管 SQL Server 2005 独立实例的计算机
根据评论编辑:
当您还原到 BCP 服务器时,您实际上是在更改托管 SQL Server 实例的服务器名称。 您执行
sp_dropserver/sp_addserver
位以使所有内容对齐(基本上,您修复@SERVERNAME)再次编辑:
为了回答您的问题,SQL Server 将直接运行。
任何依赖于与物理服务器名称匹配的 @@SERVERNAME 的代码除外。
@@SERVERNAME 从主数据库获取信息。 如果您恢复 master,则实例会认为它具有旧名称。 所以这是一个有效的重命名。
然而,任何客户端都不关心:他们使用 DNS/物理服务器名称来查找服务器。
@@SERVERNAME 下的详细信息有所不同从 SERVERPROPERTY 中获取物理服务器名称。
Correct, everything should be identical and ready to go.
The server name change is described here: How to: Rename a Computer that Hosts a Stand-Alone Instance of SQL Server 2005
Edit, based on comment:
When you restore onto the BCP server, then you are effectively changing the server name that hosts the SQL Server instance. You do the
sp_dropserver/sp_addserver
bit to make everything line up (basically, you fix @SERVERNAME)Edit, again:
To answer your question, SQL Server will just run.
Except for any code that relies on @@SERVERNAME matching the physical server name.
@@SERVERNAME takes it's information from the master database. If you restore master, then the instance thinks it has the old name. So it's an effective rename.
However, any clients don't care: they use DNS/physical server name to find the server.
More info under @@SERVERNAME about this differs from SERVERPROPERTY that will pick up the physical server name.
如果您的数据库使用 SQL 加密功能或链接服务器(其凭据在内部加密),那么您必须确保计算机 SID 或 AD 域保持不变,或者您需要备份“服务主密钥”(SMK)。
我们曾经遇到过这样的问题(当然是在灾难之后:))。 尽管我们没有使用损坏的数据,但我们无法链接到远程服务器; 唯一的可能性是删除旧的加密 SMK 并生成新的。 如果我们在该服务器上有加密数据,那么它们就会丢失。
MSDN:备份服务主密钥 (Transact-SQL)(以及其他相关文章)
If your database uses SQL encryption functions or linked servers (thier credentials are internally crypted), then you must ensure that either computer SID or AD domain remains same OR you need to have backup of "service master key" (SMK).
We have once stuck with such problem (after disaster of course :)). Although we didn't use encrupted data, we couldn't link to remote servers; only possibility was to drop old encrypted SMK and generate new. If we had encrypted data on that server, then they would be lost.
MSDN: BACKUP SERVICE MASTER KEY (Transact-SQL) (and other related articles)