Click here to monitor SSC

Restore-Problem

Last post 08-04-2009, 2:12 AM by James BlueBlood. 3 replies.
Sort Posts: Previous Next
  •  07-05-2009, 8:19 AM Post number 73951

    Restore-Problem

    When Im restoring the database im getting following error

    Msg 3132, Level 16, State 1, Line 1

    The media set has 2 media families but only 1 are provided. All members must be provided.

    Msg 3013, Level 16, State 1, Line 1

    RESTORE DATABASE is terminating abnormally.

    How to solve above problem ,Plz give me solution urgent
  •  07-12-2009, 11:29 AM Post number 74000 in reply to post number 73951

    Re: Restore-Problem

    How was the backup done? Are you restoring two files or one in the backup set?  Are you restoring using SSMS or from a script?  For some reason, SQL Server seems to think that you are restoring two files rather than one. If this is the case then try

    RESTORE Database MyDatabase

    FROM DISK = 'C:\MyBackups\Backup1.bak',

    DISK = 'C:\MyBackups\Backup2.bak'

    But I suspect that SQL Server is getting confused because, in some way, what you are restoring is different from the backup. I can't help much more without knowing more about what you're doing
  •  07-27-2009, 2:47 PM Post number 74168 in reply to post number 73951

    Re: Restore-Problem

    Hello there.

    I believe this is one of the mistakes that can be avoided in the future; what you actually did is to do this backup from Management Studio and you actually striped the backup in two files. After that, you only brought one file for restore, when there really are two of them.

    If you have access to that server (still), please check if my assumption is correct. Also, if this is the case, please consider the following tip: create your regular backup from Management Studio, make sure there's only one path for saving the ,bak file, but instead of actually doing the backup, simply script it and save it for later use.
    If you need it from prod to dev, you can also specify with copy_only, so that you won't break the LSN.

    I hope this helps.

    best regards,
    io

  •  08-04-2009, 2:12 AM Post number 74240 in reply to post number 73951

    Re: Restore-Problem

    I guess this will solve your problem

    Restoring a Full Database Backup
    A full database restore can be executed by simply typing this:

    restore database [db_name]
    from [file_name]

    As an example, I've backed up the Northwind database on my machine using the following command:

    backup database northwind to disk  = 'c:\northwind.bak'

    In order to demonstrate the power of the RESTORE command, I will drop the Northwind database by executing:

    drop database Northwind
    
    Deleting database file 'e:\mssqlserver\MSSQL$JOELAX2000_1\data\northwnd.ldf'.
    Deleting database file 'e:\mssqlserver\MSSQL$JOELAX2000_1\data\northwnd.mdf'.

    The output from the DROP DATABASE command shows that the files used by the Northwind database have been deleted too.

    To restore the Northwind database from that file I can simply type:

    restore database northwind from disk = 'c:\northwind.bak'

    SQL Server reads all the relevant information about the files used by the database from the backup and creates those files during the restore process. You can see how the files have been recreated after the restore process by executing:

    SP_HELPDB Northwind

    You will see the same filenames as those previously deleted during the DROP command.

    In this example, the syntax for the RESTORE command is very simple because I didn't try to change anything regarding the database during the restore process. For instance, I kept the file locations the same. However, often enough during the restore process, you might want to change some of those options. As an example, your production database might exist on the D drive of the server while the database needs to be on the C drive of your backup machine.

    Changing the File Location During the Restore Process
    To demonstrate this technique, I will first attempt to create a second copy of the Northwind database on my machine, called Northwindrep. I'd like to have a second copy on a different set of drives that will be used for extensive reporting purposes.

    However, when I execute this:

    restore database Northwindrep from disk = 'c:\northwind.bak'

    I get the following errors:

    Server: Msg 1834, Level 16, State 1, Line 1
    The file 'e:\mssqlserver\MSSQL$JOELAX2000_1\data\northwnd.mdf' 
    cannot be overwritten. It is being used by database 'northwind'.
    Server: Msg 3156, Level 16, State 1, Line 1
    File 'Northwind' cannot be restored to 
    'e:\mssqlserver\MSSQL$JOELAX2000_1\data\northwnd.mdf'. 
    Use WITH MOVE to identify a valid location for the file.
    Server: Msg 1834, Level 16, State 1, Line 1
    The file 'e:\mssqlserver\MSSQL$JOELAX2000_1\data\northwnd.ldf' 
    cannot be overwritten. It is being used by database 'northwind'.
    Server: Msg 3156, Level 16, State 1, Line 1
    File 'Northwind_log' cannot be restored to 
    'e:\mssqlserver\MSSQL$JOELAX2000_1\data\northwnd.ldf'. 
    Use WITH MOVE to identify a valid location for the file.
    Server: Msg 3013, Level 16, State 1, Line 1
    RESTORE DATABASE is terminating abnormally.

    In order for me to execute the restore statement, I have to specify different locations for the files because the current locations are being used by the Northwind database. To do so, I need to use the MOVE option, which uses the following syntax:

    move '[logical_file_name]' to '[operating_system_file_name]'

    If you aren't familiar with the concept of a logical and physical filename, look up the syntax of the CREATE DATABASE statement in Books Online. When specifying a file while creating a database, you use the syntax:

    name = [logical_file_name], filename = [physical_location]

    Example:

    name = Northwind, filename = 'e:\mssqlserver\MSSQL$JOELAX2000_1\data\northwnd.ldf'

    Because I can't remember by heart what the logical filenames are, I will first use another helpful command. Instead of RESTORE DATABASE, I type this:

    restore filelistonly
    from disk = 'c:\northwind.bak'

    This command provides a list of the logical database files and their corresponding physical locations. This allows me to find that I have two logical files, one called Northwind and the other called Northwind_log.

    Using this information I can now complete the restore process by typing:

    restore database Northwindrep
    from disk = 'c:\northwind.bak'
    with move 'Northwind' to 'c:\Northwindrep.mdf',
    move 'Northwind_log' to 'c:\Northwindrep.ldf'

    Notice, however, that while I was able to restore the backup to a different database name and change the location of the files, I couldn't change the logical filename. This means that while the database name (Northwindrep) will be consistent with the physical names used, the logical filenames will still be Northwind and Northwind_log.

     

    Thanks

    BlueBlood

View as RSS news feed in XML