I have my MS SQL server installed at a virtual Hard disk (D:) as my machine under Win 11 environment. The data file attached with my database is located at the same installation folder. I want to move my database' data files to another disk with more free space. I have copied the .mdf and .ldf files to the new path physically.
However, it prompted the following error:
MODIFY FILE failed. File 'MyDataBase' does not exist.
MODIFY FILE failed. File 'MyDataBase_Log' does not exist.
When i check the disk manager, my SQL is located at Disk 0, while the other disks are located in Disk 1. Is it because of the VHD which SQL is installed at and thus it is not able to identify the files in another disk?
i have use the follow script in SQL:
USE master;
GO
ALTER DATABASE MyDataBase
MODIFY FILE ( NAME = MyDataBase,
FILENAME = 'P:\NEW_PATH\MyDataBase.mdf');
GO
ALTER DATABASE MyDataBase
MODIFY FILE ( NAME = MyDataBase_Log,
FILENAME = 'P:\NEW_PATH\MyDataBase_Log.ldf');
GO