SQL Server Performance

T-sql code for xp_restore_database(Litespeed)

Discussion in 'Third Party Tools' started by lara99, Oct 12, 2007.

  1. lara99 New Member

    I am not able to find the T-SQL code for xp_restore_database(Litespeed). Can somebody help me? It's very urgent.
  2. satya Moderator

    It is the third party tool, it will be better off if you can find the same on their website.
    This is not a native SQL Server based stored procedure to run, you can use RESTORE DATABASE statement in this case.
    (please post queries in relevant forum sections only, moved from General DBA section)
  3. frdba New Member

    Here are some notes I found along the way. I know it's been a while since you posted, but maybe it will help you at a later time.
    ***
    Restore: (If the files have the same name)
    exec master.dbo.xp_restore_database
    @database = 'dbname',
    @filename = 'path to backup filename'Restore with move: (If database does not exist and you are moving the datafiles to a new location)
    exec master.dbo.xp_restore_database
    @database = 'dbname',
    @filename = 'path to backup filename',
    @with = 'move "logical filename" to "physical file location.mdf"',
    @with = 'move "logical filename" to "physical file location.ldf"'Restore with replace: (If database does exist and you are restoring files with a different name)
    exec master.dbo.xp_restore_database
    @database = 'dbname',
    @filename = 'path to backup filename',
    @with = 'replace',
    @with = 'move "logical filename" to "physical file location.mdf"',
    @with = 'move "logical filename" to "physical file location.ldf"'**Note in both the restore with move and restore with replace you move the logical name. To find this out run:
    exec master.dbo.xp_restore_filelistonly
    @filename ='path to backup file'Restore single backup from a backup set (Multiple backups written to same file)
    **NOTE: If you restore without specifying a file number, by default it will restore the FIRST backup in the set.**
    To find the file number:
    EXEC master.dbo.xp_restore_headeronly
    @filename = 'path to backup filename'
    Scroll over to right and look for column BackupStartDate to verify the backup you want.
    To restore:
    exec master.dbo.xp_restore_database
    @database = 'dbname',
    @filename = 'path to backup file' ,
    @file number =2

Share This Page