Jon
Jon

Reputation: 1727

SQL Server 2017 - copy entire DB to another server on an ongoing basis via a script

I need to copy an entire DB from 1 server to another on a daily/scheduled basis. Can't use replication - can't add GUIDs to the DB (Source DB - is based on a going restore).

How can I write a script to copy the entire DB + logins etc to another server. I can drop the destination DB if needed each time.

Any ideas on a script?

thanks in advance!

Upvotes: 0

Views: 38

Answers (1)

Martin Cairney
Martin Cairney

Reputation: 1767

Because you need to also copy any logins across as well, I would look at doing this with the dbatools PowerShell module

Check out the Copy-DbaDatabase and Copy-DbaLogin cmdlets

Upvotes: 1

Related Questions