attach mdf and ldf file to sql server 2012 - sql-server

hi friends i have mdf and ldf file for database. I am going to attach this files to sql server 2012 but this error is occured:
TITLE: Microsoft SQL Server Management Studio
Attach database failed for Server 'IMAN-PC\TESTSQL'. (Microsoft.SqlServer.Smo)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=11.0.3000.0+((SQL11_PCU_Main).121019-1325+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Attach+database+Server&LinkId=20476
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
Unable to open the physical file "C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\GISTrec.FileStrem". Operating system error 2: "2(The system cannot find the file specified.)".
A file activation error occurred. The physical file name 'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\GISTrec.FileStrem' may be incorrect. Diagnose and correct additional errors, and retry the operation.
Could not open new database 'GISTrec'. CREATE DATABASE is aborted. (Microsoft SQL Server, Error: 5120)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&ProdVer=11.00.2100&EvtSrc=MSSQLServer&EvtID=5120&LinkId=20476
what can I do for attaching this file?

Related

Restore DataBase error - RESTORE HEADERONLY terminated abnormally

i'm getting this error when i'm trying to restore a database with a .bak extension file.
TITLE: Microsoft SQL Server Management Studio
------------------------------
An exception occurred while executing a batch or Transact-SQL statement. (Microsoft.SqlServer.ConnectionInfo)
------------------------------
ADDITIONAL INFORMATION :
The media family on media '****.bak' is incorrect. SQL Server cannot process it.
RESTORE HEADERONLY terminated abnormally. (Microsoft SQL Server, Error: 3241)
Any help and thanks.

Trying to attach Adventureworks2012 on SQL Server 2019 gives error

I am trying to install AdventureWorks2012 data file on my system using SQL Server 2019. I am getting below error message.
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
CREATE FILE encountered operating system error 5(Access is denied.) while attempting to open or create the physical file 'C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\DATA\AdventureWorks2012.mdf'. (Microsoft SQL Server, Error: 5123)
Any help or pointers how to resolve this ?

SQL server 2008 restore .bak file failure

I have problem when trying to restore .bak file to SQL server 2008
it is the error message.
"The volume on device 'C:...\test.bak' is empty.
RESTORE HEADERONLY is terminating abnormally. (Microsoft SQL Server, Error:3254)"
what does it mean? is it this file has corrupted?
Thanks.
There are several regions for this error.
One cause of a error is version of your SQL Server.
Before further check you must go through this Artical.

Could not open new database 'DB Name'. CREATE DATABASE is aborted (SQL Server, Error: 948)

*Hi,
The Case:
I am trying to move a database from one server to another, source server has SQL Server 2008 R2, destination server has SQL Server 2008.
I copied the .mdf file only I tried to use query sp_attach_db and wizard attach but the was an error, as follows:
Attach database failed for Server
'SERVER_NAME'.
(Microsoft.SqlServer.Smo)
----------------------- ADDITIONAL INFORMATION:
An exception occurred while executing
a Transact-SQL statement or batch.
(Microsoft.SqlServer.ConnectionInfo)
The database 'DB_Name' cannot be
opened because it is version 661. This
server supports version 655 and
earlier. A downgrade path is not
supported. Could not open new database
'DB_Name'. CREATE DATABASE is aborted.
(Microsoft SQL Server, Error: 948)
I dont think its possible to attach a database from a higher version of SQL server to a lower version.
Eg 2008 to 2003 is not ok,
going from 2003 to 2008 is ok.
You could try doing an import export data but I have not worked out how to attach it so far.

Error when restore sql database from .bak file

When I restore SQL database by using Microsoft SQL Server Management Studio, it fails and give me this message:
TITLE: Microsoft SQL Server Management Studio
Restore failed for Server 'app1'.
(Microsoft.SqlServer.Smo)
For help, click:
http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.1399.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Restore+Server&LinkId=20476
------------------------------ ADDITIONAL INFORMATION:
An exception occurred while executing
a Transact-SQL statement or batch.
(Microsoft.SqlServer.ConnectionInfo)
The file or filegroup
"SilosFollow_log" cannot be selected
for this operation. RESTORE DATABASE
is terminating abnormally. (Microsoft
SQL Server, Error: 3219)
For help, click:
http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.1399&EvtSrc=MSSQLServer&EvtID=3219&LinkId=20476
------------------------------ BUTTONS:
OK
NB Database owner is not the backup user name.
When you configure the restore, make sure you aren't using data/log files that are in use by a database that is currently running (probably the database you're restoring on top of).
It makes the data directory a mess, but I give my data/log files a Rev. number when I restore databases so I don't run into that issue.
Are you sure SilosFollow_log is a database backup and not a transaction log backup?
In order to restore transaction log backups you must first have restored a full database backup and any differential backups. Then you can restore the transaction log backups in turn.

Resources