I need to restore a database from an MDF file. I got the mdf from another machine to be restored on a main machine.
When attaching, attaching the MDF file, an error occurs saying that the file can not be located, but the address of the displayed file is the address of the machine that retrieved the MDF file, not the address of the main machine.
I tried to attach via command specifying addresses via command:
sp_attach_single_file_db
As expl below:
exec sp_attach_single_file_db @dbname = 'base_recuperada',
@physname = 'C:\sqldata\dados.mdf'
When I ran the command, the following error occurred:
Mensagem 5120, Nível 16, Estado 5, Linha 15
Não é possível abrir o arquivo físico "I:\DADOS_SERVER\base.mdf". Erro do sistema operacional 2: "2(O sistema não pode encontrar o arquivo especificado.)".
Falha de ativação do arquivo. O nome do arquivo físico "I:\DADOS_SERVER\base.ldf" pode estar incorreto.
Mensagem 1813, Nível 16, Estado 2, Linha 15
Não foi possível abrir o novo banco de dados 'base_recuperada'. CREATE DATABASE foi anulado.
If you look at the address of the location in the message above you will see that the address you are referencing is still wrong and I can not set the correct location.
Even after this situation I tried a third alternative, I created a new bank and tried to link the mdf file I'm restoring to and the same problem with the wrong location occurred.
I can not recover a bank bkp or unzip the file from the bank of the other machine. Only with the mdf that I have restore on the main machine.
What do you suggest about procedure or what would be the correct one?