I was attempting to move my database to a separate hard drive on the server, so I ran the following commands in the following order (I was following this question : How to change location of SQL Server 2012 database which is already configured with a merge replication):
use master; ALTER DATABASE db_name MODIFY FILE (NAME = db_name, FILENAME = 'E:\Data\db_name.mdf');
ALTER DATABASE db_name MODIFY FILE (NAME = db_name_log, FILENAME = 'E:\Data\db_name_log.ldf');
Here is where my mistake happened: I either did one or both of the following mistakes:
- I may have input the incorrect
Nameparameter above (Would the mdf/ldf files be dropped in this case?)
- I also did not do step 2 in the answer referenced above (
Stop log reader agent, distribution and merge agent (if they are running).
Then I brought the database offline:
alter database db_name set offline
Now when I try to connect to the database server, I get the error I described in this question. How can I remedy this? Do I need the sa login? Or is there something else I can do?
Other users are unable to connect to the database also, getting the same error. Did I actually corrupt the master db somehow?
I've been researching the causes of this error and they all seem to point to the need to restore access using sa login or something to that effect.