Reputation: 1881
I am writing a service that creates a copy of a certain SQL Azure db every once in a while by issuing this:
CREATE DATABASE [copy] AS COPY OF [original]
I then periodically check the sys.dm_database_copies table to see if the copy is done. Basically, if the dm_database_copies entry is not there, it's done copying.
What concerns me is the following: What if the copy failed? Does the dm_database_copies entry get deleted? My feeling is that is should not get deleted, as it contains info about the error, but I can't be sure, because I've actually never had a db copy fail.
So the bottom line question is: does the dm_database_copies entry for a particular database id get deleted on anything else than a successful copy?
Many thanks in advance
Upvotes: 0
Views: 453
Reputation: 609
I had failures in copying large databases (> 100 GB) and the record is not deleted.
From the documentation I read that:
When the database copy completes successfully and the new database becomes ONLINE, the row in the sys.dm_database_copies view is removed automatically.
So it implicitly state that if the copy process fails the row is not deleted, according also to my experience.
Upvotes: 2