When I am trying to move msdb database from it's default location (C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA) to another drive(E:). After moving the database I am getting error as shown below.(the error I am getting while expanding database node in SSMS and now I am not able to access any database.)
Failed to retrieve data for this request. (Microsoft.SqlServer.Management.Sdk.Sfc)
------------------------------ ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
Database 'msdb' cannot be opened due to inaccessible files or insufficient memory or disk space. See the SQL Server errorlog for details. (Microsoft SQL Server, Error: 945)
The procedure I followed to shift msdb database is as follows:
- For each file to be moved, run the following statement.
ALTER DATABASE msdb
MODIFY FILE ( NAME = MSDBData , FILENAME = 'E:\MSDBData.mdf' )
ALTER DATABASE msdb MODIFY FILE ( NAME = MSDBLog , FILENAME = 'E:\MSDBLog.ldf' )
- Stop the instance of SQL Server to perform maintenance.
- Move the file or files to the new location.
- Restart the instance of SQL Server or the server. Also i did confirm the path by running following query
SELECT name, physical_name AS CurrentLocation, state_desc
WHERE database_id = DB_ID(N'msdb');
And output was showing current location of both MSDBdata and MSDBLog as E:\
This error happened while I did it for testing server. I want to do it for a production server. So please help me on this error. How exactly to move msdb database?