Just had a disk and raid failure on the drives holding the our live databases. The log files (.ldf) are on a separate disk array and are OK (I think).
I've recovered the databases from the most recent backup however my question is can I use the logs (LDF files) to update the databases to the most recent point?
It's a Sindows 2003 box running SQL Server 2000 Standard edition.
Thanks!
John
Sorry, no.
You'd need log backups to apply to your full backup.
Don't try to replace the new LDF (created from restore) with the one you've recovered. It won't work because the internal ID and log state (LSN) will not match.
Basically, MDF/LDF files and backup files are unrelated to each other.
Related
Can any body tel me how to overcome this error when taking a backup in SQL Server 2008 Express?
Backup failed for Server '\SQLEXPRESS'. (Microsoft.SqlServer.SmoExtended)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1447.4+((KJ_RTM).100213-0103+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Backup+Server&LinkId=20476
System.Data.SqlClient.SqlError: The media loaded on "D:\Project 2014\PayrollBackup" is formatted to support 2 media families, but 1 media families are expected according to the backup device specification. (Microsoft.SqlServer.Smo)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1447.4+((KJ_RTM).100213-0103+)&LinkId=20476
I just want to take a single backup of my database. But always I have to give two destinations and then when restoring I cant restore the database using a single backup file? Is there anything to configure in SSMS? If any, could you please clearly explain?
EDIT:
BACKUP DATABASE [Payroll] TO DISK = N'D:\Project 2014\PayrollBackup' WITH NOFORMAT, NOINIT, NAME = N'Payroll-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10
GO
A simple solution has arisen (via SSMS), based on the answer of #DMason and answer of #Carol Baker West.
Just create a new media set for a single media family.
The backup statement is using the NOINIT clause. This causes each successive backup to append to the existing backup file. You are attempting to backup to one media set (one file), but it appears the existing backup you are attempting to append to consisted of two media sets (two files).
For a quick turnaround, specify a new filename:
BACKUP DATABASE [Payroll] TO DISK = N'D:\Project 2014\<insert new filename>' WITH ...
The issue for me was there were two sources in the Destination.
After you backup with only one destination, removing the other. You don't get the error anymore.
Let me know if this helps!
I also received the error. In my case, I wanted to specify a different location to which the file should be backed up to. But what it was trying to do, was to now split the backup to both files in both locations - thus the part of the error:
is formatted to support 1 media families, but 2 media families are expected according to the backup device specification. (Microsoft.SqlServer.Smo)
So, remove one of the destinations specified in the 'Destination' section of the Back Up Database wizard. It should only have one destination if it only backed up to one file previously.
I got the same error with my project, so I did a couple of simple things:
Copied my old MyDB.bak file from the default backup path, say C:\Program Files\Microsoft SQL Server\MSSQL14.SQLEXPRESS\MSSQL\Backup
Removed it from there
Backed up new version of DB to the same path. (It now succeeded)
Copied the newly created backup to desired place.
When I was attempting to restore a backup onto another server, I got the same error that you got.
I was able to get past this error by deleting the "Backup Device" object and recreating a new one. As you know, the Backup Device is an object that saves a path to your backup folder and to the backup file. Apparently, it also saves other information like the media family.
In the SSMS interface, expand the Server Objects section, and then the Backup Devices section. Find the named backup device for the database and path that you are getting the error on. Delete that object and recreate it. That should take care of the issue.
Now, just so we are clear, I'm NOT talking about deleting the backup itself. I'm NOT talking about deleting or removing any drives. I'm NOT talking about deleting all of the backup devices listed on your server. I'm simply talking about deleting the backup device (which is an object) for one database on your server.
I received this message when I was adding a database to Always On Group and log backup failed with this message:
'The Backup cannot be performed because the existing media set is formatted with an incompatible version'
Problem: I was using the same backup shared folder as I was using two servers with multiple instances. Database was promoted from SQL Server 2008 R2 to SQL Server 2016. I did not delete the old 2008 R2 backups from that shared folder.
Solution: Try and clear out the old version backups and try again. It worked for me.
I want to copy all my database to remote database server. I have access to server using SQL server management studio.
How can I do this? I have created script with data of old database and tried to run it on new server but it is taking too much time and returns different errors like duplicate key etc.
If this is a one time deal, you should download Redgate's SQL tools. They can handle this easily and are free to test for 14 days I believe. (http://www.red-gate.com) You might even find they are worth the purchase as I have. The tools you would use are SQL Compare (to copy structure) and SQL DAta Compare to actually copy the data.
Assuming that you can restore databases to your remote SQL server, you can use SQL Server backup and restore? They're available in SQL Server Management Studio. See http://msdn.microsoft.com/en-us/library/ms187510.aspx. It's very easy to use.
Other than that, you can try copying the database MDF and LDF files from your local database onto your remote database filesystem, then attaching to the MDF file on your remote database.
Those are probably the fastest ways that you can copy and entire database to a remote location that I can think of.
Try Database publishing wizard by Microsoft. Good enough for no very big data amounts.
Probably this is the lamest question ><
I am developing an ASP.net web app with SQL Server database. When the client asked me to develop the system, he provided a file for the database.
I thought the file was a dumpfile (if you familiar with oracle or mysql, you can replicate database with dumpfile, which is basically bunch of queries inside a text file).
To my horror, plus with my noobity in SQL Server, I found out that it was NOT a dumpfile. The file is rename to .bak which is not really the correct extension for SQL Server. I tried to rename it to .mdf, but no luck.
What should I do? The client is out for vacation on some island and cannot be contacted at the moment?
This is backup file, you need to restore database from backup.
How to: Restore a Database Backup (SQL Server Management Studio)
This is SQL Server backup database file. You can restore it by following these steps: http://msdn.microsoft.com/en-us/library/ms177429.aspx
Alex Aza has the right answer. But remember to create users for the database, before you restore the provided .bak file. A backup file only hold a user id -- the complete user definition is held in the server instance. Thus, it is better to create the users needed before restoring a backup from another server instance which is the case in your project.
I have a SQL Server DB that is about 13Gb with a 1.6Gb log file. When I back it up, however, it creates a 50Gb .bak file! Why is that?
I have read some commentary here about transaction logs, but my DB runs on my laptop and there is no DB activity during the time of the backup. (It only takes 5 minutes).
My backup type is Full, my recovery type is Full, and I am doing Copy-Only backups. Any ideas? Much appreciated!
I am using SQL 2008 R2, Developer Edition.
It might be because the backup routine is appending the new backup to the same file?
There is an option in the Backup dialog in Sql Management Studio to Append or Overwrite all existing backup sets. If you have Append if will add the backup to the same .bak file and the .bak file will be larger for every backup.
In Transact Sql it is the INIT and NOINIT option which determine if the bak file is overwritten or appended.
In my case, I found that the 500MB database also had a 560MB full text catalogue attached which gets included in the backup file. I thought I'd add this despite another answer having been accepted in case anyone else is still stumped :)
In my case, heavy use of filestream objects made for the largest part of the backup file.
I am working on a website that has access data from a database (sql server). It will also be adding, updating deleting records in the database. It seems like there is an MDF file that gets created containing the database schema and all the records I guess? Once development is complete and I want to move this database to a real server then all I need to do is move this MDF file to the real server and that is it? is it that simple? or not really?
Also, I hope the MDF file is not a read-only file and can be updated/modified or is it?
Yes, the MDF data file (and the associated *.LDF transaction log file) contains all the database objects that make up your system.
And yes, you can definitely detach a database (an .MDF/.LDF file pair) from your (dev) SQL Server, copy it onto another "real" Production SQL Server, and re-attach it there, without loss of data or information.
Yes, the MDF file is modifyable - through the SQL Server commands and methods. You should never tamper with the file yourself, directly (flipping bits). Use SQL Server and its official interfaces (T-SQL, ADO.NET etc.) to work with your data.
Yes you can do that. Right click the database and click "detach". Make sure you click the drop connections box and click ok (if you don't do this some errors could occur). You can now move the mdf and ldf files.
However, there is a better way imho. Instead, create a full backup of the database, copy the backup file, and restore from the backup on the new server. Now you have two copies of the database, a development version and a production version.
You will need to take .MDF file as well as .LDF file which will have your logs. You have to take both mdf and ldf files and attach on the real server.