Share via

DB recovery in a semi-annual SQL plan

זהבה אורן 0 Reputation points
2025-10-26T09:55:18.3466667+00:00

I accidentally downloaded SQL Server and SSMS to a computer for a half-year plan and suddenly I can't connect to the localhost server because half a year has passed.

My problem is that I have a very important DB that I don't have access to now.

Is there an option to restore it?

Can someone in your support team restore the DB for me urgently??

Thanks!

SQL Server Database Engine
0 comments No comments

Answer recommended by moderator
  1. Erland Sommarskog 133.6K Reputation points MVP Volunteer Moderator
    2025-10-26T12:55:05.13+00:00

    The database files are supposedly currently in C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\Data. I say "supposedly", because you might have opted to put the database files elsewhere or set different options when you installed SQL Server. Here I am assuming that you have gone with the defaults.

    You are likely to find a number of files here, but you should recognise the files for you critical database by the file names. There are at least two of them, one .mdf file and one .ldf file. There could be more than two files, but that is only if you have created multiple files.

    Copy these files to C:\Program Files\Microsoft SQL Server\MSSQL16.SQLEXREPSS\MSSQL\Data. (Again, I am making the assumption that you have gone with the default). Then run this in a query window:

    CREATE DATABASE yourdb ON (NAME = 'yourdb', FILENAME = '<path>.mdf') 
    LOG ON (NAME = 'yourdb_log', FILENAME = '<path>.ldf')
    FOR ATTACH
    

    I would not be surprised if this fails with the error Access is denied. In this case you need to change the ownership of the files to the account NT Service\MSSQL$SQLEXPRESS. (Again, assuming that you went with the defaults.)

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Erland Sommarskog 133.6K Reputation points MVP Volunteer Moderator
    2025-10-26T10:56:36.6966667+00:00

    There is no "half-year" plan for SQL Server, but there is an Evaluation Edition that runs for 180 days. As the name suggests, it is intended for evaluation, so you can decide whether you should get a license for SQL Server. It is not licensed for production use. The fact that you say that this database is very important to you, suggests that you have violated that license.

    Your options at this point are:

    1. Buy a license for SQL Server Standard Edition, and upgrade your instance to Standard. This is a simple manoeuvre.
    2. If the database is below 10 GB in size, you can download and install the free Express Edition. Express Edition is licensed for production use, but the database size is capped at 10 GB. You cannot run edition upgrade to get from Enterprise to Express, but you would need to install a new instance and then attach the database to the new instance.
    3. Find an already existing, properly licensed, instance of SQL Server in your organisation or on a hosting server and attach the database file there.
    4. Download and and run an edition upgrade to Developer Edition, which is a free edition. In difference to Express there is no limit on database size, but it is not licensed for production. I strongly recommend against this alternative.
    1 person found this answer helpful.

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.