Showing posts with label SQL. Show all posts
Showing posts with label SQL. Show all posts

Sunday, 10 August 2014

The media set has 2 media families but only 1 are provided


Issue

While attempting to restore your database using MyLittle Backup you receive the following error:

"The media set has 2 media families but only 1 are provided"

Cause

This error is due to your backup being divided into more than one part at the time of creating your initial backup file. The backup will need to be repeated so that it is contained in one file only.
In the example screenshot below you will see that there are two paths listed for the backup destination, which will create a backup over two files.

Resolution

Remove one path from the backup destination so that only one .bak file is created and then restore this file using MyLittleBackup.


You can know more details about the issue from Microsoft PM who owns SQL backups
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/abf50e00-c9b0-4809-9e61-43ed8a53e968/the-media-set-has-2-media-families-but-only-1-are-provided?forum=sqltools

The solution was copied from the below link
http://www.net24.co.nz/kb/article/AA-00125/17/Microsoft-SQL-Server-Hosting/MyLittle-Backup-Restore-Error-The-media-set-has-2-media-families-but-only-1-are-provided.html

Hope it helps you
Best Regards
Ahmed Gamal

Sunday, 13 October 2013

A More Efficient Method for Paging in SQL Server stored procedure

Hello guys,

If you have large result sets in your database and want to build an efficient paging through SQL Server stored procedure, I recommend the below article for you.
It's tested and gave good results.

http://www.4guysfromrolla.com/webtech/042606-1.shtml

Note: in this article he works on table Id but if you want to use other column just put a non-clustered index on it and use as below

CREATE  PROCEDURE [dbo].[usp_PageResults_NAI] 
(
    @startRowIndex int,
    @maximumRows int
)
AS

DECLARE @firstColumnDate datetime, @startRow int
 
SET ROWCOUNT @startRowIndex
SELECT @firstColumnDate = DateAdded FROM employees ORDER BY DateAdded

SET ROWCOUNT @maximumRows

SELECT e.*, d.name as DepartmentName 
FROM employees e
WHERE DateAdded>= @firstColumnDate
ORDER BY e.DateAdded
SET ROWCOUNT 0

GO 


I hope it'll help you :)
Best Regards.
Ahmed Gamal

Saturday, 29 December 2012

SQL Server Interview Questions and Best Practice

Hello every one.
I hope you are doing great.

I found this site which is talking about SQL Server (Interview Questions, Best Practice for some users, white papers about Performance and others)
I found it useful for me, hope you find it too.

http://www.mssqltips.com/

I hope you will enjoy it.