I
I
Igor Krivintsov2019-01-29 07:44:11
SQL Server
Igor Krivintsov, 2019-01-29 07:44:11

How to attach database to MS sql server 2012?

Hello,
There is such a situation, I disconnected the database from the sql server, where it could be a little more for a couple of months, since it was not needed, when it was needed, I refused to join, referring to a log file error, supposedly the file does not match the database, but I did not change the log file, even took other files from backups (did backup HDD) but the situation is the same, what could be the matter? and how to fix it, I saw the instruction on the Internet www.googli.com.ua/sol/122_123 , but can it be done on a production server? maybe there are some other options?
5c4fda6bda10a271041326.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Igor Krivintsov, 2019-01-29
@wizart23

You need to run the command:
use master
go
create database new_database_name
on (filename = 'D:\Data\database.Mdf')
for attach
go

C
CHolfield, 2019-01-29
@CHolfield

Backups should not just be done, but sometimes it is necessary to check whether infa is restored from them.
Here we see that the database is in an inconsistent state. The backup that you made HDD - it does not guarantee the integrity of the database, the database must be backed up using the DBMS.
I think it's time for the person responsible for this database and backup to smear his ass with Vaseline.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question