Sql-server – unable to bring database online from recovery pending

corruptionrecoverySecuritysql-server-2008

I am trying to bring a SQL Server database online and accessible that is in Recovery Pending state.
The SQL Server service uses an Active directory account that is a domain administrator and a member of sysadmin on sql server. The SQL Server account should have rights in the SQL file folders as it is a domain admin. It is however not a local administrator in the SQL Server.

The error messages are:

Msg 5120, Level 16, State 101, Line 1 Unable to open the physical file
"F:\Program Files\Microsoft SQL
Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\DBName.ndf". Operating system
error 5: "5(Access is denied.)". Msg 5120, Level 16, State 9, Line 1
Unable to open the physical file "F:\Program Files\Microsoft SQL
Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\DBName.ndf". Operating system
error 5: "5(Access is denied.)".

While

alter database [DBName] set online;

results in the error below:

Msg 945, Level 14, State 2, Line 1 Database 'databs' cannot be opened
due to inaccessible files or insufficient memory or disk space. See
the SQL Server errorlog for details. Msg 5069, Level 16, State 1, Line
1 ALTER DATABASE statement failed.

Can you think of a solution?

Best Answer

The first issue was someone denied the SQL Server Services in the NDF and MDF files and once that denied was removed and granted appropriate access, the first issue was resolved. The second solution was that corrupt NDF file had no data so I removed it and database was back online.