0

I am new as a DBA. I want to ask. I want to create new log shipping a database 17815 from server primary to server secondary. I create new log shipping with right-click on database 17815. when I click ok, but I get this error

System.Data.SqlClient.SqlError: The file 'M:\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\PREUATPSSHSOH123CAB_Data.mdf' cannot be overwritten.  It is being used by database '13722'.

So what can I do? I was trying to restore manually with the restore command, and restore was successful. However, when I try to create new log shipping again, the error is the same.

1
  • Are you setting up log shipping between two servers? Use this to check what database is using the same file. Jun 22, 2021 at 9:45

1 Answer 1

0

The problem is that the database 13722 is using the same data files. You have to rename the files of the 13722 database.

use this guide for file rename:

https://blog.sqlauthority.com/2018/09/01/sql-server-rename-physical-database-file-name-for-any-database/

Always backup before this kind of changes!

6
  • Thanks for your answer. i am confusing why 13722 is using the same data files. cause name data files is different M:\MyData\17815_Data.mdf -> database 17815 M:\MyData\13722_Data.mdf -> database 13722 Jun 22, 2021 at 6:26
  • who is using this PREUATPSSHSOH123CAB_Data.mdf?
    – MBuschi
    Jun 22, 2021 at 6:28
  • i dont know why the error say "System.Data.SqlClient.SqlError: The file 'M:\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\PREUATPSSHSOH123CAB_Data.mdf' cannot be overwritten. It is being used by database '13722'. (Microsoft.SqlServer.Smo)" sir Jun 22, 2021 at 6:30
  • can you share the logshipping script?
    – MBuschi
    Jun 22, 2021 at 6:32
  • this step that i use to create logshipping. 1. right click on database (on primary server) 2. click properties 3. click transaction log shipping, and edit backup setting, and another. Jun 22, 2021 at 7:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.