| 
                
Please start any new threads on our new 
    site at https://forums.sqlteam.com.  We've got lots of great SQL Server
    experts to answer whatever question you can come up with. 
    
        | 
                
                    | 
                            
                                | Author | Topic |  
                                    | matttPosting Yak  Master
 
 
                                        194 Posts | 
                                            
                                            |  Posted - 2011-01-14 : 10:04:38 
 |  
                                            | Hi,I've written a script that's supposed to set up database mirroing between two servers using security certificates.For the most part, it works. It creates backups of the target DB and the log, copies then to the secondary server and does a restore with norecovery. It creates users and security certificates on both servers, copies the certificates each way and associates them with the user.So far, so good.When I come to the last point, running the alter database commands first on the secodary, then on the primay, the secondary works but the final set - setting up on the primary - returns the error:"The server network address "tcp://mymachine.myaddress.co.uk:5022" can not be reached or does not exist. Check the network address name and that the ports for the local and remote endpoints are operational"Now I've run through all the likely causes of this, I think:1) The DB on the secondary is indeed in "Restoring .." mode, up until the point you run the ALTER DATABASE [] SET PARTNER on that DB, at which point it becomes "In Recovery" (I assume this is right as it's waiting for data).2) The first part of the script runs backups and restores of the DB's so the log and the data should be up to date.3) I can indeed telnet to the target address & port of the secondary machine that I'm using in my final ALTER DATABASE [] SET PARTNER command.4) Firewalls are off on both machines5) Endpoints exist on both machines and are listening on the right ports with the right users6) I have tried changing the port numbers from the default and ensured that both servers are using a different port (they're virtual machines, both on the same box so I thought that might possibly conflict otherwise).I'm out of ideas as to what the problem might be. Can anyone suggest a way forward?Cheers,Matt |  |  
                                    | robvolkMost Valuable Yak
 
 
                                    15732 Posts | 
                                        
                                          |  Posted - 2011-01-14 : 10:53:11 
 |  
                                          | I had the same problem recently where I specified a distinct listening port for the mirroring endpoint.  I changed it back to "ALL" and it worked fine.  Give that a shot. |  
                                          |  |  |  
                                    | matttPosting Yak  Master
 
 
                                    194 Posts | 
                                        
                                          |  Posted - 2011-01-14 : 11:27:22 
 |  
                                          | quote:Haven't tried this yet - been experimenting - and I've found the following error in the log:"Database mirroring connection error 4 'An error occurred while receiving data: '10054(failed to retrieve text for this error. Reason: 15105)'.' for 'tcp://mySecondaryServer.MyDomain:5022'."Does this shed any light on the subject - googling it doesn't seem massively helpful?Originally posted by robvolk
 I had the same problem recently where I specified a distinct listening port for the mirroring endpoint.  I changed it back to "ALL" and it worked fine.  Give that a shot.
 
 |  
                                          |  |  |  
                                    | robvolkMost Valuable Yak
 
 
                                    15732 Posts | 
                                        
                                          |  Posted - 2011-01-14 : 11:42:50 
 |  
                                          | Google didn't help me with that one either.  Of course you can't blame Google for Microsoft's shitty error messages. |  
                                          |  |  |  
                                    | matttPosting Yak  Master
 
 
                                    194 Posts | 
                                        
                                          |  Posted - 2011-01-14 : 11:45:52 
 |  
                                          | quote:Heh, sadly not.What's the syntax for making the endpoint listen on all ports - as far as I can see from the documentation it requires a specific port?Originally posted by robvolk
 Google didn't help me with that one either.  Of course you can't blame Google for Microsoft's shitty error messages.
 
 |  
                                          |  |  |  
                                    | robvolkMost Valuable Yak
 
 
                                    15732 Posts | 
                                        
                                          |  Posted - 2011-01-14 : 11:46:58 
 |  
                                          | [code]CREATE ENDPOINT [Mirroring] 	AUTHORIZATION [sa]	STATE=STARTED	AS TCP (LISTENER_PORT = 5022, LISTENER_IP = ALL)	FOR DATA_MIRRORING (ROLE = ALL, AUTHENTICATION = WINDOWS NEGOTIATE, ENCRYPTION = DISABLED)[/code]edit: Make sure to grant appropriate Connect permissions on that endpoint after you recreate it. |  
                                          |  |  |  
                                    | Peter99Constraint Violating Yak Guru
 
 
                                    498 Posts | 
                                        
                                          |  Posted - 2011-02-14 : 14:43:35 
 |  
                                          | check if endpoint is enable. |  
                                          |  |  |  
                                |  |  |  |  |  |