SQL Server Error 5184: Cannot use file ‘I:\Path\Techyaz.mdf’ for clustered server
Today, one of my team mate was trying to attach a database on one of the clustered SQL Server instance. He got error 5184 while attaching the database. The details about error 5184 is given below.
Msg 5184, Level 16, State 2, Line 1
Cannot use file ‘I:\Path\Techyaz.mdf’ for clustered server.
Only formatted files on which the cluster resource of the server has a dependency can be used. Either the disk resource containing the file is not present in the cluster group or the cluster resource of the Sql Server does not have a dependency on it.
Msg 1802, Level 16, State 1, Line 1
CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
While troubleshooting this error we came to know that the storage or LUN on which we have placed the database files are not added to cluster group. It means disk is not visible in failover cluster manager.
Solution – Error 5184
We performed below steps to fix this issue.
- Added the storage on which databases files are placed as shared storage in the failover cluster manager.
- Launch SQL Server properties window in Failover Cluster Manager.
- Added all newly added disks in Dependencies tab.
- Attached the database again.
Here i will explain above steps in detail with screenshots.
- We were attaching a database using T-SQL statement on one of the SQL Server cluster instance. While executing the command we get error 5184. Error details are given in below screenshot.
- As error suggests that “Either the disk resource containing the file is not present in the cluster group” so I checked cluster group for the disk and found that database files storage was not showing in failover cluster manager.
- Next step was to add these storage disks to the cluster group. Launch failover cluster manager. Click at Roles tab from left side pane. You can see SQL Server as role in right side pane. Right click at the SQL Server role and click at “Add Storage” option. You can see this in below screenshot.
- Once you will click at “Add Storage” option you will get below window to add the identified disks to cluster group. You can see I have selected all required disks in below screenshot. You can choose your disks where your database files are placed.
- Once you click at OK button post selecting all respective check boxes in above step, you will see all your storage disks in failover cluster manager under storage tab.
- Now again click at the SQL Server role and then go to “Resources” tab from down side pane where you can see SQL Server and all resources that are aligned for the SQL Server role. Here, right click at SQL Server and click at Properties tab as shown in below screenshot.
- Once you get SQL Server properties windows in failover cluster manager, next you should click at dependencies tab. Here, you need to insert one row for each disk system that you have added in above steps. Once you will insert dependencies for all newly added disks then it will look like below screenshot. Now click at OK button to apply this change.
- Now again go to SQL Server query window and run the T-SQL command to attach the database. This time you will successfully attach the database to the clustered SQL Server instance.
- Upgrade or Patch SQL Server Failover Cluster Instance Running with Availability Group
- How to Change Failover Mode of Availability Replica in AOAG?
- How to Prepare for a Job Interview?
- SQL Server DBA Interview Questions & Answers
- How to Fix SQL Error 1005: A Comprehensive Guide - April 9, 2023
- How to Fix SQL Server Error 207 – Invalid Column Name - April 9, 2023
- How to Fix SQL Error 1045: Resolving Access Denied Issues - April 8, 2023