积极答复者
请教在不同网段如何实现数据库镜像!

问题
答案
-
那我是不是可以只对这个数据镜像这个功能使用证书,其它的功能都不使用呢,或者说是如果我的证书遗失了,我主数据库上的数据查询和写入什么的功能都没有影响吧,最多就是数据镜像这个功能不能继续了?如果主服务器挂了,我在镜像数据库上依然可以 强制使数据库可用呢?
rickroot
1. 镜像端点可以配置为 ip , 而没有强制要求是名称, 即使是, 你也可以通过 host 文件做名字与ip的映射
2. 镜像端点使用的端口要保证是没有被网络供应商禁用的
3. 使用证书加密. 证书你自己要保存好, 丢失了只是导致无法正常通信(和网络不通差不多)
主服务器和镜像服务器是可以随意切换的, 即使主服务器不可用, 也可以强制使镜像服务器工作, 但是, 如果主服务器有 transaction 还没有应用到镜像服务器的话, 这会导致没有传递的部分涉及的数据丢失, 并且导致镜像要重新配置- 已标记为答案 Hong-Gang Chen - MSFTModerator 2010年3月19日 1:50
-
Need certificate in this case, take look at 'How to: Allow Database Mirroring to Use Certificates for Outbound Connections' in books online. And ensure port 5022 is open on network.
- 已标记为答案 Hong-Gang Chen - MSFTModerator 2010年3月19日 1:50
-
You can change sql name with 'sp_dropserver oldname' and 'sp_addserver newname, local', new name will be effect after restarting sql.
- 已标记为答案 Hong-Gang Chen - MSFTModerator 2010年3月19日 1:50
全部回复
-
没有域,是在异地,静态的公网地址 ,我现在能够创建端点了,但开始镜像时,他报镜像服务器的端口不存在什么的,这两台之间的IPSEC防火墙之类我都是关闭了的,还是不行。我两台服务器的SQL服务都是以本地系统帐户启动了,
227这台是主数据库,30是镜像数据库。
报错信息如下:
===================================开始镜像时出错。
===================================
更改 对于 数据库“union”失败。 (Microsoft.SqlServer.Smo)
------------------------------
有关帮助信息,请单击: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.4035.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=更改+Database&LinkId=20476------------------------------
程序位置:在 Microsoft.SqlServer.Management.Smo.SqlSmoObject.AlterImpl()
在 Microsoft.SqlServer.Management.Smo.Database.Alter()
在 Microsoft.SqlServer.Management.SqlManagerUI.DBPropMirroring.StartMirroring(Object sender, EventArgs e)===================================
执行 Transact-SQL 语句或批处理时发生了异常。 (Microsoft.SqlServer.ConnectionInfo)
------------------------------
程序位置:在 Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType)
在 Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(StringCollection sqlCommands, ExecutionTypes executionType)
在 Microsoft.SqlServer.Management.Smo.ExecutionManager.ExecuteNonQuery(StringCollection queries)
在 Microsoft.SqlServer.Management.Smo.SqlSmoObject.ExecuteNonQuery(StringCollection queries, Boolean includeDbContext)
在 Microsoft.SqlServer.Management.Smo.SqlSmoObject.AlterImplFinish(StringCollection alterQuery, ScriptingOptions so)
在 Microsoft.SqlServer.Management.Smo.SqlSmoObject.AlterImplWorker()
在 Microsoft.SqlServer.Management.Smo.SqlSmoObject.AlterImpl()===================================
服务器网络地址 "TCP://218.30.79.30:5022" 无法访问或不存在。请检查网络地址名称,并检查本地和远程端点的端口是否正常运行。 (.Net SqlClient Data Provider)
------------------------------
有关帮助信息,请单击: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.3077&EvtSrc=MSSQLServer&EvtID=1418&LinkId=20476------------------------------
服务器名称: 61.152.98.227
错误号: 1418
严重性: 16
状态: 1
行号: 1
------------------------------
程序位置:在 System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
在 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
在 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
在 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
在 System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async)
在 System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
在 System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
在 Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType)
rickroot -
Need certificate in this case, take look at 'How to: Allow Database Mirroring to Use Certificates for Outbound Connections' in books online. And ensure port 5022 is open on network.
- 已标记为答案 Hong-Gang Chen - MSFTModerator 2010年3月19日 1:50
-
那我是不是可以只对这个数据镜像这个功能使用证书,其它的功能都不使用呢,或者说是如果我的证书遗失了,我主数据库上的数据查询和写入什么的功能都没有影响吧,最多就是数据镜像这个功能不能继续了?如果主服务器挂了,我在镜像数据库上依然可以 强制使数据库可用呢?
rickroot
1. 镜像端点可以配置为 ip , 而没有强制要求是名称, 即使是, 你也可以通过 host 文件做名字与ip的映射
2. 镜像端点使用的端口要保证是没有被网络供应商禁用的
3. 使用证书加密. 证书你自己要保存好, 丢失了只是导致无法正常通信(和网络不通差不多)
主服务器和镜像服务器是可以随意切换的, 即使主服务器不可用, 也可以强制使镜像服务器工作, 但是, 如果主服务器有 transaction 还没有应用到镜像服务器的话, 这会导致没有传递的部分涉及的数据丢失, 并且导致镜像要重新配置- 已标记为答案 Hong-Gang Chen - MSFTModerator 2010年3月19日 1:50
-
非常感谢说的这么全面,这个部署只是短期为了机房搬迁使用,之后会在同站点内实现。现在已经通过证书实现。不过在使用中有一点小问题,请帮助一下,
我镜像DB的主机名是在建完SQL后修改过。通过管理界面登录没问题,但在使用数据库镜像监视器时,他报目前的主机名还存在,要使用以前的主机名登录,同时还报如下错误。这该如何解决呢,
===================================“SQL Monitor 遇到错误。是否要继续?”
===================================
已存在具有相同键的条目。 (System)
------------------------------
程序位置:在 System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
在 System.Collections.Generic.SortedList`2.Add(TKey key, TValue value)
在 Microsoft.SqlServer.Management.UI.ReplRegistrationProvider.GetRegisterServerCollection(String groupName)
在 Microsoft.SqlServer.Management.UI.AddMirroredDatabase.AddMirroredDatabase_Load(Object sender, EventArgs e)
在 System.Windows.Forms.Form.OnLoad(EventArgs e)
在 System.Windows.Forms.Form.OnCreateControl()
在 System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
在 System.Windows.Forms.Control.CreateControl()
在 System.Windows.Forms.Control.WmShowWindow(Message& m)
在 System.Windows.Forms.Control.WndProc(Message& m)
在 System.Windows.Forms.ScrollableControl.WndProc(Message& m)
在 System.Windows.Forms.ContainerControl.WndProc(Message& m)
在 System.Windows.Forms.Form.WmShowWindow(Message& m)
在 System.Windows.Forms.Form.WndProc(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
rickroot -
You can change sql name with 'sp_dropserver oldname' and 'sp_addserver newname, local', new name will be effect after restarting sql.
- 已标记为答案 Hong-Gang Chen - MSFTModerator 2010年3月19日 1:50