Sql-server – Databases missing after exporting server and rebuilding master DB

recoverysql server

We had a server running Microsoft SQL Server 2014 databases on Hyper-V. I exported it (with C: and D: drives) and opened on other machine.

I could not start the MSSQLSERVER service because it said the master db needed to be rebuilt.

I've rebuilt the master db, but now the databases are empty, I cannot see databases except master, model, msdb, and tempdb.

I have all databases (mdf and ldf files) in this folder D:\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA. How to restore them and not lose all functionality?

Best Answer

I have all Databases (mdf and ldf files) in this folder D:\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA how to restore them and not lose all functionality?

When you rebuild master, it loses track of where the user databases are. You just need to attach them, and recreate the logins for any orphaned users.

And also consider linked servers, scheduled jobs and everything else which is stored outside the user databases and was scratched by the rebuild.