If the two servers are not in the same domain, and the SQL Server service does not use the domain user as the startup Service identity. In this case, you may receive an error as shown in the title when creating a database image.
In this case, you must use the certificate for the authentication of the endpoint to run the database image.
Now assume the environment:
Host_a is the master server and host_ B is the backup server.
The target database of host_a has been backed up as required and restored in host_ B.
The image has been configured through the UI. The ports on both sides of the endpoint are 5022 and the names are [images].
The firewall port is enabled, and the SQL Server TCP/IP protocol is enabled.
Step 1
Run Use Master;
Go
// In the master database, create the master key of the database (if needed ).
Create Master Key Encryption By Password = ' Password ' ;
Go
Create Certificate host_a_cert
With Subject = ' Host_a Certificate ' ;
Go
/* * *** Object: endpoint [Image] script Date: 09/01/2009 17:44:54 ***** */
If Exists ( Select * From SYS. endpoints E Where E. Name = N ' Images ' )
Drop Endpoint [ Images ]
Go
/* * *** Object: endpoint [Image] script Date: 09/01/2009 17:44:54 ***** */
Create Endpoint [ Images ]
Authorization [ SA ]
State = Started
As TCP (listener_port = 5022 , Listener_ip = All )
For Data_grouping ing (Role = Partner, Authentication = Certificate host_a_cert
, Encryption = Required algorithm RC4)
Go
Backup Certificate host_ B _cert To File = ' D: \ data \ host_a_cert.cer ' ;
Step 2
Run // In the master database, create the master key of the database (if needed ).
Create Master Key Encryption By Password = ' Password ' ;
Go
Create Certificate host_ B _cert
With Subject = ' Host_ B Certificate ' ;
Go
/* * *** Object: endpoint [Image] script Date: 09/01/2009 17:44:54 ***** */
If Exists ( Select * From SYS. endpoints E Where E. Name = N ' Images ' )
Drop Endpoint [ Images ]
Go
/* * *** Object: endpoint [Image] script Date: 09/01/2009 17:44:54 ***** */
Create Endpoint [ Images ]
Authorization [ SA ]
State = Started
As TCP (listener_port = 5022 , Listener_ip = All )
For Data_grouping ing (Role = Partner, Authentication = Certificate host_ B _cert
, Encryption = Required algorithm RC4)
Go
Backup Certificate host_ B _cert To File = ' D: \ data \ host_ B _cert.cer ' ;
Go
Step 3
Copy host_a_cert.cer to host_ B, and copy host_ B _cert.cer to host_a.
Step 4
Run Use Master;
Create Login host_ B _login With Password = ' Password ' ;
Go
Create User Host_ B _user For Login host_ B _login;
Go
Create Certificate host_ B _cert
Authorization Host_ B _user
From File = ' D: \ backup \ host_ B _cert.cer '
Go
Grant Connect On Endpoint :: [ Images ] To [ Host_ B _login ] ;
Step 5
Run Use Master;
Create Login host_a_login With Password = ' Password ' ;
Go
Create User Host_a_user For Login host_a_login;
Go
Create Certificate host_a_cert
Authorization Host_a_user
From File = ' D: \ backup \ host_a_cert.cer '
Go
Grant Connect On Endpoint :: [ Images ] To [ Host_a_login ] ;
Start the image!