如何对镜像数据库进行架构更改?

发布于 2024-08-02 06:27:54 字数 221 浏览 7 评论 0原文

我有一个镜像数据库,我需要对其进行一些更改。主要是添加一个视图和一些存储过程。现在我知道,如果您进行架构更改,则应该删除镜像和镜像数据库,对主体进行更改,然后备份恢复主体并恢复镜像。存储过程和视图也是这种情况吗?我可以只对主体进行更改,然后进行故障转移并对镜像进行更改吗?这样做可能会出现哪些问题和后果?每次我们想要进行一个小的更改时,这似乎是一项非常繁琐的任务,主要是因为数据库超过 10 GB,因此需要一些时间来备份和恢复。

I have a mirrored database and I need to make some changes to it. Mainly, adding a view and some stored procedures. Now I know that if you make schema changes you are supposed to remove mirroring and the mirror database, make your changes to the principal, then backup-restore the principal and restore mirroring. Is this the case for stored procedures and views as well? Can I just make my changes to the Principal, then Failover and make my changes to the mirror as well? What are the possible issues and ramifications from doing something like this? It just seems like a very tedious task to have to do every time we want to make a small change, mainly because the database is over 10 gigs so it takes a little while to back up and restore.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

酷炫老祖宗 2024-08-09 06:27:54

如果您正在镜像,您应该能够将这些更改应用到主体,并且它们会显示在镜像端。如果您希望两者之间存在架构差异,则不能使用镜像。您是否希望仅对镜像数据库或两者应用架构更改?如果两者都是,那么您不必做任何特别的事情。

If you are mirroring, you should be able to apply those changes to the principal and they show up on the mirrored side. If you want there to be schema difference between the two, you can't use mirroring. Are you looking to apply schema changes on just the mirrored database or to both? If both then you don't have to do anything special.

难如初 2024-08-09 06:27:54

现在我知道如果你制作模式
你应该删除的更改
镜像和镜像数据库,
对主体进行更改,
然后备份恢复主体和
恢复镜像

这其实是错误的。主体数据库和镜像数据库实际上是存储在两个物理位置的单个数据库。发生在主体中的任何每一个变化也会发生在镜像中。它们在字面上始终是相同的。

因此,任何模式更改(包括表、视图、过程、函数、模式、数据库主体、程序集等)都会发生在主体和镜像上。

唯一需要特别注意的更改是与数据库相关但不在数据库中发生的更改:代理作业(它们位于 msdb 中)、服务器主体(登录名)、复制设置(它们数据库、msdb 和分发器中到处都是。

Now I know that if you make schema
changes you are supposed to remove
mirroring and the mirror database,
make your changes to the principal,
then backup-restore the principal and
restore mirroring

This is actually wrong. The principal and mirror database are in fact a single database that is stored in two physical locations. Any and every change that occurs in the principal, occurs also in the mirror. They are literarly identical all the time.

So any schema changes, including tables, views, procedures, functions, schemas, database principals, assemblies and so on and so forth occur on both the principal and the mirror.

The only changes that require special attentions are changes that are related to the database but don't occur in the database: Agent jobs (they are in msdb), server principals (logins), replication settings (they are all over the place in database, msdb and distributor.

乜一 2024-08-09 06:27:54

我们已将架构更改应用到日志传送数据库和镜像数据库,并且无需采取任何特殊操作。
但某些形式的复制需要特殊的措施。

We have applied schema changes to both a logshipped and mirrored database and not had to take any special action.
Some forms of replication require special mesaures though.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文