简体   繁体   English

数据库镜像在 SQL Server 中显示错误消息

[英]Database Mirroring shows error message in SQL Server

I have two instance of SQL server 2014 Standard edition我有两个 SQL Server 2014 标准版实例

  1. MSSQLSERVER(PRIMARY) MSSQLSERVER(主)
  2. 192.168.10.131/MIRROR(MIRROR) 192.168.10.131/镜像(镜像)

All database on same machine of WINDOWS SERVER 2012 R2 WINDOWS SERVER 2012 R2 同一台机器上的所有数据库

First i backup AdventureWorks2014 from MSSQLSERVER(PRIMARY) and restore database in首先我从MSSQLSERVER(PRIMARY)备份AdventureWorks2014并在
192.168.10.131/MIRROR with RESTORE WITH NO RECOVERY 192.168.10.131/MIRROR with RESTORE WITH NO RECOVERY

in Restore Database-> Option ->Recovery State ->RESTORE WITH NO RECOVERY .Restore Database-> Option ->Recovery State ->RESTORE WITH NO RECOVERY中。

Then i take backup of log MSSQLSERVER(PRIMARY)然后我备份日志MSSQLSERVER(PRIMARY)

backup log [AdventureWorks2014] to disk ='c:\LOGBACKUP\AdventureWorks2014.trn'

then i restore the log to 192.168.10.131/MIRROR(MIRROR)然后我将日志恢复到192.168.10.131/MIRROR(MIRROR)

restore log [AdventureWorks2014] from disk ='c:\LOGBACKUP\AdventureWorks2014.trn' with norecovery

Ok fine .Then MSSQLSERVER(PRIMARY) in AdventureWorks2014好的,然后AdventureWorks2014中的MSSQLSERVER(PRIMARY)

RIGHT CLICK->TASK->MIRROR and CONFIGURE SECURITY option

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

BUT WHEN i start Mirror it shows following windows但是当我启动镜像时,它显示以下窗口

在此处输入图像描述

After clicking Yes the the error message单击是后出现错误消息在此处输入图像描述

What is wrong in my process???我的过程有什么问题??? What configuration should i do?我应该做什么配置?

You May also want to check to see that port 5023 is open.您可能还想查看端口 5023 是否打开。

  1. From command prompt - type the following.从命令提示符 - 键入以下内容。

Telnet Waltonserver 5023远程登录沃尔顿服务器 5023

2 . 2. If you don't have telnet installed do the following first, here are the directions.如果您没有安装 telnet,请先执行以下操作,以下是说明。

https://technet.microsoft.com/en-us/library/cc771275(v=ws.10).aspx https://technet.microsoft.com/en-us/library/cc771275(v=ws.10).aspx

  1. After installing telnet, Test your telnet on a server you know is running on port 1433安装 telnet 后,在您知道在端口 1433 上运行的服务器上测试您的 telnet

Telnet ServerName 1433远程登录服务器名称 1433

If this works, you'll get an open box pop up that you can type into.如果这可行,您将弹出一个打开的框,您可以在其中输入。 If it fails you will get a message....could not open connection to host on port 1433. If you can telnet to other servers on port 1433 but not to port 5023, then you know the port isn't open.如果失败,您将收到一条消息....无法在端口 1433 上打开与主机的连接。如果您可以 telnet 到端口 1433 上的其他服务器但不能连接到端口 5023,那么您知道该端口未打开。 then ask your admin to open port 5023.然后让您的管理员打开端口 5023。

Goto services.msc and check the sql server is running under which account.转到 services.msc 并检查 sql server 在哪个帐户下运行。 Make sure that sql server and sql server agent services should run with same credentials.确保 sql server 和 sql server 代理服务应该使用相同的凭据运行。

in the mirror database server you should do the same step as step 1. Give the same credentials as in principal server.在镜像数据库服务器中,您应该执行与步骤 1 相同的步骤。提供与主体服务器中相同的凭据。 If that user is not present create a new one on the both servers with same credentials.如果该用户不存在,则使用相同的凭据在两台服务器上创建一个新用户。

Now got principal server and in sql server add the new login under Security-->Login.现在得到了主体服务器,并在 sql server 中添加新的登录名在 Security-->Login 下。 Give the server roles as Sysadmin and public.将服务器角色指定为 Sysadmin 和 public。 Add the same user on the mirror server also.在镜像服务器上也添加相同的用户。

Now do the mirror in the principal database.现在在主体数据库中做镜像。 You did not get any error there.你在那里没有得到任何错误。

Here are a few things you may want to try:以下是您可能想尝试的几件事:

1) Make sure firewall is not blocking your SQL ports. 1) 确保防火墙没有阻止您的 SQL 端口。 Go to Windows Firewall with Advanced Security -> Inbound\Outbound Rules -> New Rule -> Port -> Specific local ports : Set 5022,5023 -> Allow the connection转到具有高级安全性的 Windows 防火墙 -> 入站\出站规则 -> 新规则 -> 端口 -> 特定本地端口:设置 5022,5023 -> 允许连接

2) Check if the Login created on each instance has sysadmin role : In Management Studio connect to each instance -> Security -> "your_login" -> Properties -> Server Roles -> sysadmin. 2) 检查在每个实例上创建的登录名是否具有 sysadmin 角色:在 Management Studio 中连接到每个实例 -> 安全 -> “your_login” -> 属性 -> 服务器角色 -> sysadmin。 Also when you configure mirroring , in the Service accounts tab, you should put your account credential in the Principal and Mirror boxes.此外,当您配置镜像时,在“服务帐户”选项卡中,您应该将您的帐户凭据放在“主体”和“镜像”框中。

3) Go to SQL Server Configuration Manager and make sure that both your instances and SQL agent run under the same account (preferably yours). 3) 转到 SQL Server 配置管理器并确保您的实例和 SQL 代理都在同一帐户下运行(最好是您的)。 Also check in SQL Server Network Configuration for each instance if TCP\IP protocol is enabled.如果启用了 TCP\IP 协议,还要检查每个实例的 SQL Server 网络配置。

4) On each instance try to drop and recreate your mirror endpoint. 4)在每个实例上尝试删除并重新创建您的镜像端点。 Run the following script on both instances with the appropriate port number:使用适当的端口号在两个实例上运行以下脚本:

DROP ENDPOINT  Mirroring
GO

CREATE ENDPOINT Mirroring
STATE = STARTED
AS TCP ( LISTENER_PORT = 5022 )
FOR DATABASE_MIRRORING 
(ENCRYPTION = DISABLED,ROLE=ALL)
GO

Hope one of this suggestions help.希望其中一个建议有所帮助。 Good luck!祝你好运!

Error 1418, The network address can not be reached or does not exist.错误 1418,网络地址无法访问或不存在。 Check the network address name and that the ports for the local and remote endpoints are operational.检查网络地址名称以及本地和远程端点的端口是否可操作。

If you have this error message, you can try and verify some following steps:如果您有此错误消息,您可以尝试并验证以下一些步骤:

  1. Verify that the Mirror Server Restore Database is in No-Recovery Mode (Full and Log Backup).验证镜像服务器还原数据库是否处于无恢复模式(完整和日志备份)。
  2. Check and verify the Port is working or not.检查并验证端口是否正常工作。
  3. If the port is not working, that means you have to manually give the TCP Port.如果端口不工作,这意味着您必须手动提供 TCP 端口。
  4. verify the all instances in administrator logon or not (go to SQL Server services, select SQL Server (MSSQLSERVER), Properties, check logon and browse the administrator login).验证所有实例是否在管理员登录(转到 SQL Server 服务,选择 SQL Server (MSSQLSERVER),属性,检查登录并浏览管理员登录)。

Recently I faced this problem and resolved with these steps.最近我遇到了这个问题并通过这些步骤解决了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM