After restart of a sql server instance one of the databases was no more accessible. SQL Server Maangement studio shows the database status "In recovery (pending)". I tried a lot of suggestions but the only one that worked for me was:
--grant alter privileges to your user GRANT ALTER ON DATABASE:: your_database_name TO [your_user] --change the status of the database ALTER DATABASE your_database_name SET EMERGENCY --change the mode of the database ALTER DATABASE your_database_name SET MULTI_USER --detach it EXEC sp_detach_db your_database_name --and reatach it EXEC sp_attach_single_file_db @dbname = your_database_name , @physname = N'path_to_mdf.mdf' --now you can use your database again
It's always good practice to create a backup of your database files before you manipulate them.