I have a SQL Server Restore Database action that has been working fine for years. However, we just upgraded our test environment (where the restore happens) to SQL Server 2017. Now, I am getting an error that the database cannot be restored because the current session is connected to it:
Could not restore backup: RESTORE cannot process database ‘-removed dbname-’ because it is in use by this session. It is recommended that the master database be used when performing this operation
However, I cannot specify that I am connecting to the master database while restoring the test database, and even if I try, I am told that the database needs to be in single-user mode to do the restore, and you cannot set the master database to be in single-user mode. It thinks that I need to restore the master database.
How do I connect to SQL Server 2017 with Automise to do a database restore? I have always configured the database restore the same way, and have never run into this problem before.