Say you have 2 database servers, one database is the 'master' database where all write operations are performed, it is treated as the 'real/original' database. The other server's database is to be a mirror copy of the master database (slave?), which will be used for read only operations for a certain part of the application.
假设您有2个数据库服务器,一个数据库是执行所有写入操作的“主”数据库,它被视为“真实/原始”数据库。另一台服务器的数据库是主数据库(slave?)的镜像副本,它将用于应用程序某个部分的只读操作。
How do you go about setting up a slave database that mirrors the data on the master database? From what I understand, the slave/readonly database is to use the master db's transaction log file to mirror the data correct?
What options do I have in terms of how often the slave db mirrors the data? (real time/every x minutes?).
您如何设置镜像主数据库上的数据的从属数据库?根据我的理解,slave / readonly数据库是使用master db的事务日志文件来镜像数据吗?关于从数据库镜像数据的频率,我有哪些选项? (实时/每隔x分钟?)。
5 个解决方案
#1
7
What you want is called Transactional Replication in SQL Server 2005. It will replicate changes in near real time as the publisher (i.e. "master") database is updated.
您想要的是SQL Server 2005中的事务复制。当发布者(即“主”)数据库更新时,它将近乎实时地复制更改。
Here is a pretty good walk through of how to set it up.
以下是如何设置它的非常好的演练。
#2
3
SQL Server 2008 has three different modes of replication.
SQL Server 2008有三种不同的复制模式。
- Transactional for one way read only replication
- 单向只读复制的事务性
- Merge for two way replication
- 合并为双向复制
- Snapshot
- 快照
#3
2
From what I understand, the slave/readonly database is to use the master db's transaction log file to mirror the data correct? What options do I have in terms of how often the slave db mirrors the data? (real time/every x minutes?).
根据我的理解,slave / readonly数据库是使用master db的事务日志文件来镜像数据吗?关于从数据库镜像数据的频率,我有哪些选项? (实时/每隔x分钟?)。
This sounds like you're talking about log shipping instead of replication. For what you're planning on doing though I'd agree with Jeremy McCollum and say do transactional replication. If you're going to do log shipping when the database is restored every x minutes the database won't be available.
这听起来像是在谈论日志传送而不是复制。虽然我同意杰里米麦科勒姆并且说做交易复制,但你计划做什么。如果您要在每x分钟恢复数据库时进行日志传送,则数据库将不可用。
Here's a good walkthrough of the difference between the two. Sad to say you have to sign up for an account to read it though. =/ http://www.sqlservercentral.com/articles/Replication/logshippingvsreplication/1399/
这是两者之间差异的一个很好的演练。很遗憾,你必须注册一个帐户来阅读它。 = / http://www.sqlservercentral.com/articles/Replication/logshippingvsreplication/1399/
#4
0
The answer to this will vary depending on the database server you are using to do this.
答案取决于您用来执行此操作的数据库服务器。
Edit: Sorry, maybe i need to learn to look at the tags and not just the question - i can see you tagged this as sqlserver.
编辑:对不起,也许我需要学习查看标签而不仅仅是问题 - 我可以看到你将其标记为sqlserver。
#5
0
Transactional replication is real time.
事务复制是实时的。
If you do not have any updates to be done on your database , what you need is just retrieving of data say once a day : then use snapshot replication instead of transactional replication. In snapshot replication, changes will replicate when and as defined by the user say once in 24 hrs.
如果您没有对数据库进行任何更新,那么您所需要的只是每天检索一次数据:然后使用快照复制而不是事务复制。在快照复制中,更改将在用户定义的24小时内复制一次。
#1
7
What you want is called Transactional Replication in SQL Server 2005. It will replicate changes in near real time as the publisher (i.e. "master") database is updated.
您想要的是SQL Server 2005中的事务复制。当发布者(即“主”)数据库更新时,它将近乎实时地复制更改。
Here is a pretty good walk through of how to set it up.
以下是如何设置它的非常好的演练。
#2
3
SQL Server 2008 has three different modes of replication.
SQL Server 2008有三种不同的复制模式。
- Transactional for one way read only replication
- 单向只读复制的事务性
- Merge for two way replication
- 合并为双向复制
- Snapshot
- 快照
#3
2
From what I understand, the slave/readonly database is to use the master db's transaction log file to mirror the data correct? What options do I have in terms of how often the slave db mirrors the data? (real time/every x minutes?).
根据我的理解,slave / readonly数据库是使用master db的事务日志文件来镜像数据吗?关于从数据库镜像数据的频率,我有哪些选项? (实时/每隔x分钟?)。
This sounds like you're talking about log shipping instead of replication. For what you're planning on doing though I'd agree with Jeremy McCollum and say do transactional replication. If you're going to do log shipping when the database is restored every x minutes the database won't be available.
这听起来像是在谈论日志传送而不是复制。虽然我同意杰里米麦科勒姆并且说做交易复制,但你计划做什么。如果您要在每x分钟恢复数据库时进行日志传送,则数据库将不可用。
Here's a good walkthrough of the difference between the two. Sad to say you have to sign up for an account to read it though. =/ http://www.sqlservercentral.com/articles/Replication/logshippingvsreplication/1399/
这是两者之间差异的一个很好的演练。很遗憾,你必须注册一个帐户来阅读它。 = / http://www.sqlservercentral.com/articles/Replication/logshippingvsreplication/1399/
#4
0
The answer to this will vary depending on the database server you are using to do this.
答案取决于您用来执行此操作的数据库服务器。
Edit: Sorry, maybe i need to learn to look at the tags and not just the question - i can see you tagged this as sqlserver.
编辑:对不起,也许我需要学习查看标签而不仅仅是问题 - 我可以看到你将其标记为sqlserver。
#5
0
Transactional replication is real time.
事务复制是实时的。
If you do not have any updates to be done on your database , what you need is just retrieving of data say once a day : then use snapshot replication instead of transactional replication. In snapshot replication, changes will replicate when and as defined by the user say once in 24 hrs.
如果您没有对数据库进行任何更新,那么您所需要的只是每天检索一次数据:然后使用快照复制而不是事务复制。在快照复制中,更改将在用户定义的24小时内复制一次。