I am working with this error for sometime now.
"Failed with the operaring System Error 21 (The device is not ready.)"
I scourged the internet but could not find the solution. Here are the links that look at
I am using this tutorial for importing the database (.bak) while which was exported from another machine and copied to mine.
On this page the very last paragraph is very helpful but it did not work for me.
I looked for other links and tried their solution, those did not work either.
I changed directory permission and allowed full access to everyone, that did not work. I also copy that .bak files to the other back databases that I have (and which imports fine), that still did not work.
Am I missing something simple, permission etc?
I am using SQL Server 2005 with SQL Server Management Studio.
I assume this was a security feature.
I could not restore the database into a name other than its original name which I was trying to do. But I could restore back on the same system into a different name. What I did is back my current database and restored them in different names that I wanted.
Right click on the original database and click restore. In this case do not change the name of the database or any parameters, it should now work.
I would also be caution to allow everyone in the directy where the backups are copied and give *everyone" object full control of the folder.
Hope it helps.
This error is a warning that you're saving the file(s) into a location that doesn't exist on that particular SQL Server workstation. For instance, if you backup a database on one machine containing an "E:\SQL_Databases" folder, and then transfer the .bak file to a machine containing only one hard drive designated as "C:\". SQL Server "remembers" where the .mdf, .ldf. and .ndf files resided on the first machine and tries to restore them to the same place. So make sure the location to which you are restoring the .mdf, etc. actually exists on the new machine. If everything doesn't match exacty, you receive this error.
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.
First and foremost, I am very brand new to databases so please keep instructions simple for me. thanks!
Usually when I need to make a manual change I just back up my SQL Server Management Studio 2012 database called Movies, then upload it to my host, then use their restore feature to implement it.
I am still in a testing phase so data does not need to be kept that is acquired online, however I wanted to try keeping the data today so I used the host's backup option which created a DB_76779_test_backup.bak file for me.
I then download this and "attempted" to updated it's information into the SQL database on my machine (Movie) which I believe is where I messed everything up.
From what I remember I right-clicked my database "Movies" and selected "Tasks -> Restore -> Database", I kept everything as is, but for Source I selected Device then chose the DB_76779_test_backup.bak file and and below that selected "Movies" as the Database and hit OK.
This seemed to work fine, so I opened and edited the tables values that needed to be changed. Then as usual, I just backed it up, ftp'ed it to the host, and restored my database.
I got an error however when trying to restore and my support told me the following.
"Logical file 'Movies' is not part of database 'DB_76779_test'. Use
RESTORE FILELISTONLY to list the logical file names."
I'm afraid we only support restores of databases that contain only 1
.mdf file and 1 .ldf file with no extra partitions.
I am assuming that since the only different thing I did this time was restore my database on my computer is that somehow I broke it, or created more than 1 mdf and ldf file (no clue what those even are). All I was trying to do was keep the actual data from online, so I am not even sure if that was correct way to go about this, but regardless I am unable to restore the database on my host now..
I am hoping someone here has instantly realized what idiotic mistake I made, because I only know a basic level of databasing and not much of the "under the hood" mechanics.
Let me know if you need further details.
That SSMS dialog is a little difficult to work with some times. It looks like you want to rename your database to Movies. The problem is when you change the name field it does not update the logical names it is using for the files. IIRC simply switching to the Files "tab" on the left will update it and then you can restore fine. That or do your restore with the "old" name and then name the database after restore.
I've not done much SQL and am still pretty new to this, so please excuse what's probably a basic question.
I've been asked to look into creating an SQL job to backup our databases, store the .baks on another machine and then to restore them to a second server. I've been doing a bit of research and playing with SSMS and have back-ed up the database to my personal machine by setting up a share and running a backup job to the share location. I'm now trying to create a new database (on the same server I back-ed up from) by restoring the .bak file (but giving the database I'm trying to create a new name and what-not) but am unable to specify restoring it from the share, like I did when backing it up/I can't find how to specify other network locations and am just browsing the server's C drive when I try to locate the file.
For now, I'm just using the built-in wizards to try and achieve this (open SSMS -> Connect to server -> right click DataBases -> Restore DataBases and then select From Device and browse to find the file).
This isn't the final process, just me trying to get to grips with how this works. As I said, the idea is to ultimately have a scheduled job to backup the DB from server1 to a .bak on, say, my personal machine and then to restore that to a DB on server2 (different network, different city) and, probably, with a series of SQL commands rather than using the wizard every time (there are a few DBs that'll, ultimately, need backing up).
My apologies for the, possibly, quite drawn out and convoluted question - essentially, all I need to know is can I/how can I restore a DB in SSMS from a .bak on a different machine?
Many thanks
You could use something like the following script. It restores a database from the filesystem, and it overwrites the existing database with the name of "MyDB", moving the files to new locations of your choice in the process.
RESTORE DATABASE
MyDB
FROM DISK = '\\MyShare\MyBackup.bak'
WITH
MOVE 'DataFile' TO 'D:\myNewDBLocation\DataFile.mdf',
MOVE 'LogFile' TO 'E:\\myNewDBLocation\LogFile.ldf'
, REPLACE
You can find out the name of the llogical files (in the above, those are called DataFile and LogFile by running the following:
RESTORE FILELISTONLY
FROM DISK = '\\MyShare\MyBackup.bak'
Additional information about various options and parameters:
RESTORE (Transact-SQL)
I simply copied my .mdf/.ldf files to another file and suddenly my Microsoft SQL 2008 database dies. I can't open these files on another system either. Can anyone explain what's happened? Any way to recover this application's database now?
Did you stop the service or detach the files first?
You are not supposed to copy files when the server is online.
if you want to copy when the server is online, you can right click on management studio , -> detach->
then copy the files to another instance , and choose attach on new server. remember you need to know the location of the files, before you detach, also you should be knowing, also the logins need to transfer.
Have you tried moving the database files back to where they were? (Specifically, stop SQL server, move files, start SQL Server).
Whenever I do this kind of work, I make copies of the files, and rename the original ones (from, say, MyData.mdf to xMyData.mdf). Makes it easier to back out when my fatfingers take over.
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.