Error 3241 when restore back up in sql server 2012 - sql-server-2012

when i was restore database in sql server 2012 this error happend
Msg 3241, Level 16, State 0, Line 3
The media family on device 'D:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Backup\Test.bak' is incorrectly formed. SQL Server cannot process this media family.
Msg 3013, Level 16, State 1, Line 3
RESTORE HEADERONLY is terminating abnormally.
what should i do?

What version of SQL Server did you take this backup from? Usually you get this error when you are trying to restore a backup taken on a higher version of SQL Server (Such as 2012) onto a lower version (Such as 2008 R2).
If that is the case, you will need to script out your database and recreate it on the new server rather than simply backing up and restoring.
If the file has not come from a newer version of SQL server than the one you are trying to restore it onto, it is possible that the file has simply been corrupted, at which point you should try to take a new backup if possible. If you are attempting to restore across the network, you should also check permissions to make sure that this is not causing your issue too.

Related

How convert SQL Server 2008 R2 database to SQL Server 2012 completely

How open my SQLServer2008R2 database in SQLServer2012. When I open the database these problems happened:
I can't edit and open tables because this error show:
Invalid prefix and suffix characters.
When I want design tables this error show:
The backend version isn't supported to design database diagram or tables.
When you detach and attach database, the compatibility level of old database is maintained. It is one of the limitations of detach and attach method.
Reference
If we attach a database having a higher version, SQL Server maintains
the database compatibility. We can change the compatibility level once
the database is online
Once you change the compatibility level to suit SQL Server 2012, you can use the new features of the SQL Server 2012.
Read more on upgrading database
ALTER DATABASE DatabaseName SET COMPATIBILITY_LEVEL = 110
GO

SQLVDI error when backing up to Azure Storage BLOB

I'm running a patched SQL 2014 trying to backup a database to one of our Azure Storage BLOBs, using:
BACKUP DATABASE [DB]
TO URL = N'https://storage.blob.core.windows.net/server-mssqlserver/DB.bak'
WITH CREDENTIAL = N'AzureCredential'
,NOFORMAT
,NOINIT
,NAME = N'DBA_DB-Full Database Backup'
,NOSKIP
,NOREWIND
,NOUNLOAD
,COMPRESSION
,STATS = 5
GO
but the query throws the following error:
Msg 3292, Level 16, State 9, Line 1
A failure occurred while attempting to execute Backup or Restore with a URL device specified. Consult the Windows Event Log for details.
Msg 3013, Level 16, State 1, Line 1
BACKUP DATABASE is terminating abnormally.
Checking the server's Event Logs shows the actual error as:
SQLVDI: Loc=IdentifySQLServer. Desc=MSSQLSERVER. ErrorCode=(5)Access is denied.
. Process=4668. Thread=6596. Client. Instance=MSSQLSERVER. VD=.
I have made sure that the SQL Server Agent service's account has the Create global objects policy, and also made sure the SQL VSS Writer service is running under the Local System account. The error keeps happening!
Is there something I can do to fix it, or just log some more detailed error messages than the "SQLVDI: Loc=IdentifySQLServer" one above?
Crikey, this is one of those "no idea how I fixed it" things.
Before I went to lunch, I could reliably generate the error in question by running the provided T-SQL, yet when I came back from lunch the BACKUP command completed fine!
The main thing I remember changing was on the Azure side, where I created a SAS (Shared Access Signature).
This is supposedly not required for SQL 2014 as it uses an actual Azure Credential to connect to the storage instead. I actually created the SAS for an instance of SQL Server 2016 that I want backing up to the same container, and that may have opened the access pathway to the container for SQL Server 2014 too!
Many thanks to Sean Gallardy for recommending ProcMon, which showed a whole ton more error log information than the "ErrorCode=(5)Access is denied" message did.

SQL Server Restore Error - Write on ??? failed

I'm trying to restore a full backup (SQL Server 2008) from a network drive and I'm getting the error message:
Msg 3202, Level 16, State 1, Line 1
Write on "???" failed: 1(Incorrect function.)
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
I've tried twice with the most recent full backup, I then went to an older full backup, they all fail with the same message at around 90%
My first guess is that this is an issue with one of the drives it's restoring to, however chkdsk seems happy and I'm not getting any other related errors in the Event Logs or SQL Server.
Anyone have any suggestions of what to look into?
EDIT: command being used:
restore database CustomerData
from disk = '\\server\SQL Archive\CustomerData - 20170225.bak'
with file = 1,
move 'CustomerData_Data' to 'C:\MSSQL\Data\CustomerData_Data.mdf',
move 'CustomerData_Index' to 'D:\Program Files\Microsoft SQL Server\MSSQL10_50.VDI01P\MSSQL\DATA\CustomerData_Index.ndf',
move 'CustomerData_Log' to 'D:\Program Files\Microsoft SQL Server\MSSQL10_50.VDI01P\MSSQL\DATA\CustomerData_Log.ldf',
password = '',
mediapassword = '',
norecovery;
Just a guess, but do you have sufficient space left on the target drive ?
Also, this thread is potentially relevant to your situation: SQL Server backup fails on disk space error

MDF File not Opening in SQL Server

My database file of SQL Server 2012 cannot be opened, it causes the following error.
Msg 824, Level 24, State 2, Line 1
SQL Server detected a logical consistency-based I/O error: incorrect pageid (expected 1:903; actual 0:0). It occurred during a read of page (1:903) in database ID 6 at offset 0x0000000070e000 in file 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\inventoryDB.mdf'. Additional messages in the SQL Server error log or system event log may provide more detail. This is a severe error condition that threatens database integrity and must be corrected immediately. Complete a full database consistency check (DBCC CHECKDB). This error can be caused by many factors; for more information, see SQL Server Books Online.
I also checked it by using
DBCC CHECKDB(inventoryDB, REPAIR_ALLOW_DATA_LOSS)
But the result is given below
DBCC results for 'inventoryDB'.
CHECKDB found 0 allocation errors and 0 consistency errors in database 'inventoryDB'.
Is any possibilities to recover my data from that database file? I am also done many methods in many of the sites. But it not working and shows same error messages.
Do you have any mdf backup after this error occurred? If yes, you should try to create a table and restore from it using your backup.
Or try reading this article:
https://support.microsoft.com/en-ph/kb/2152734
See if it helps with your error.
You've got corruption in your DB. Either the DB was corrupt before you tried working it and you didn't notice, or it was damaged in the work.
Here. We have few options.
Solution one - If you have a backup file, You can restore your database.
Solution two - If you do not have a backup file, you can use DBCC CHECKDB to repair it. (Resource : https://www.stellarinfo.com/blog/how-to-repair-sql-database-using-dbcc-checkdb-command/)
Thanks :)

DB restoration issue

I have a issue while trying to restore a DB. Earlier I had SQL Server 2000 on my system so I installed SQL Server 2005 and now I'm trying to upload a DB backup made on SQL Server 2005 only. While uploading that I'm getting the following:
The query is
restore database APR15THB from disk ='C:\datab\APR15MUR.bak' with replace ,
move 'Apr07Trans_dat' to 'c:\overseas\mil-data\APR15THB.mdf',
move 'Apr07Trans_log' to 'c:\overseas\mil-data\APR15THB.ldf'
The error is
Msg 3169, Level 16, State 1, Line 1
The backed-up database has on-disk structure version 611. The server supports version 539 and cannot restore or upgrade this database.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
Can anyone please help me with this?
No, you can not restore a backup taken with a more modern version to a more outdated sql server.
SImple like that.
ALL your server versions are old, but you running 2000 is ancient. What about doing an update like every 15 years?
Check
https://support.software.dell.com/litespeed-for-sql-server/kb/30314
(yeah, google really has a lot on that stuff). Quite obviously you seem still to restore on 2000. Getting confused with multiple instances installed - i.e. you did not upgrade 2000 to 2005 but installed 2005 side by side and still use the 2000 version for restore?