The certificate, asymmetric key, or private key file is not valid or does not exist

Hello,

We have migrated a old server to a new server with a side by side migration. Server with the same name, and the copy the system and the production databases to the new server. It seems that everything its working fine, also replication that we have in some tables.
We also have a linked server to a sql server outside our organization and now we have some issues with this linked server. We tryed to rebuild the connection but we always get the The certificate, asymmetric key, or private key file is not valid or does not exist message. Also with the job notifications by mail we are getting the same error.
Can someone help my with the solution to this problem?

I don't think it is related to the Certificate error you are getting, but how did you "copy" the databases?

SQL Service STOPPED on both servers and then COPY the raw files?

Or Backup / Restore maybe?

Something else perhaps? :slight_smile:

Hi Kristen,

SQL Service STOPPED on both servers and then COPY the raw files from old server to the new one.

Thanks (best way I reckon, if you can afford the downtime for the COPY).

Certificates is not skillset, but I would have thought that would have sorted that out - and also the CONFIG for Linked Server.

is there anything about Encrypt on the linked server connection settings?

No, nothing about encrypt...

were you the one that setup the original linked server to the external server?

Yes, and he worked fine. I made another test. I configured the linked server on my one terminal using a local sql instance and it works fine. It has to be something with the change or server. We didn't exported or imported any key or certificate. Could that be the problem?

that was my next question but why would it work on the other ones? did you export and import key and certificate on the ones that did work?

No, the only diference is that the other servers are in the same domain and the user admin in the sql is the same with the same password.

You are going to have to export the certificate and recreate it. or start everything from scratch as far as certificates is concerned. Which you will probably have to create both on the server that has linked server and on the server that is outside your domain. But not sure how much control you have on the other domain's server that you are linking to.
It could be you will have to contact their DBA, and as DBA to give you cert and key and you create it on your new machine.

https://docs.microsoft.com/en-us/sql/t-sql/statements/backup-certificate-transact-sql

Yosiasz, thanks for the replies, you mean, from my old server? right?

i guess so. depends who iriginally authored them.