- You have a database with a defunct filegroup which you are trying to add to an Always On availability group (AG) in Microsoft SQL Server 2014, 2016 and 2017.
- You are able to add the database to the primary replica and restore the full and log backups with NORECOVERY on the secondary replica without issue.
## spid## Starting up database 'DatabaseName'.
## spid## Error: 17207,Severity: 16, State: 1.
## spid## FileMgr::StartSecondaryDataFiles: Operating system error 2(The systemcannot find the file specified.) occurred while creating or opening file'FilePath'. Diagnose and correct theoperating system error, and retry the operation.
## spid## Error: 5120,Severity: 16, State: 5.
## spid## Unable to openthe physical file "FilePath".Operating system error 2: "2(The system cannot find the filespecified.)".
You will also see the database go into Not Synchronizing/Recovery Pending mode on the secondary replica after the ALTER DATABASEcommand is executed.
This issue is fixed in the following cumulative updates for SQL Server:
- Cumulative Update 15 for SQL Server 2017
- Cumulative Update 7 for SQL Server 2016 SP2
- Cumulative Update 15 for SQL Server 2016 SP1
- Cumulative Update 4 for SQL Server 2014 SP3
- Cumulative Update 17 for SQL Server 2014 SP2
About cumulative updates for SQL Server:
Each new cumulative update for SQL Server contains all the hotfixes and all the security fixes that were included with the previous cumulative update. Check out the latest cumulative updates for SQL Server: