Sample Header Ad - 728x90

Can't change _log database physical location in SQL Server

1 vote
2 answers
496 views
I just installed Microsoft ServiceBus and it created 5 databases. Now I want to move them to some specific location so I can join them to SQL Server AlwaysOn Availability group. I stopped service bus farm and tried to execute the following queries one by one: ALTER DATABASE [SbManagementDB] SET OFFLINE; ALTER DATABASE [SbManagementDB_log] SET OFFLINE; ALTER DATABASE [SbManagementDB] MODIFY FILE ( NAME = [SbManagementDB], FILENAME = 'C:\Program Files\Microsoft SQL Server\MyLocation\SbManagementDB.mdf' ); ALTER DATABASE [SbManagementDB_log] MODIFY FILE ( NAME = [SbManagementDB_log], FILENAME = 'C:\Program Files\Microsoft SQL Server\MyLocation\SbManagementDB_log.ldf' ); ALTER DATABASE [SbManagementDB] SET ONLINE; I brought SbManagementDB offline successfully, but when I tried to do that to SbManagementDB_log I've got the following error: Msg 5011, Level 14, State 5, Line 2 User does not have permission to alter database 'SbManagementDB_log', the database does not exist, or the database is not in a state that allows access checks. Msg 5069, Level 16, State 1, Line 2 ALTER DATABASE statement failed. I executed the following query SELECT name, physical_name AS CurrentLocation, state_desc FROM sys.master_files and made sure that this DB exists and I tried sa login, but got the same error. Any ideas what am I doing wrong?
Asked by Andrew (153 rep)
Apr 6, 2016, 04:04 PM
Last activity: Apr 6, 2016, 05:20 PM