ERROR MESAGGE:
“System.Data.SqlClient.SqlError: The media set has 2 media families but only 1 are provided. All members must be provided. (Microsoft.SqlServer.Smo)”
EXPLANATION:
You may encounter an error message when you want to restore a backup file.
You’re getting this error because you’ve taken a backup of the database to more than one file, and you only use one of these backup files when you restore the backup.
Example:
1 2 3 4 |
BACKUP DATABASE [MyDB] TO DISK = N'C:\Test\Backup1.bak', DISK = N'C:\Test\Backup2.bak' WITH NOFORMAT, NOINIT, NAME = N'MyDB-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10 GO |
SOLUTION:
Use all backup files while you are restoring.
Example (According to the first example):
1 2 3 4 5 6 7 |
RESTORE DATABASE [MyDB] FROM DISK = N'C:\Test\Backup1.bak', DISK = N'C:\Test\Backup2.bak' WITH FILE = 1, MOVE N'MyDB' TO N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\MyDB.mdf', MOVE N'MyDB_log' TO N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\MyDB_1.ldf', NOUNLOAD, STATS = 10 GO |