Home Forums SQL Server 2005 Backups Script to restore red gate backups automatically from a folder. RE: Script to restore red gate backups automatically from a folder.

  • you need to create a SSIS package to search & select a backup file

    you can use the below mentioned query of REDGATE which can be used to restore the DB.

    EXECUTE master..sqlbackup N'-SQL "RESTORE DATABASE [TESTDB]

    FROM DISK = ''K:\FULL_(local)_TESTDB_20091122_003838.sqb''

    WITH STANDBY = ''G:\BACKUP\Undo_TESTDB.dat'',

    MOVE ''testdb_ext4Data'' TO ''I:\Database\TESTDB\TESTDB_1.MDF'',

    MOVE ''testdbData'' TO ''J:\Database\TESTDB\TESTDBDATA.NDF'',

    MOVE ''testdb_ext2Data'' TO ''J:\Database\TESTDB\TESTDB_EXT2DATA.NDF''"'

    HINT:

    in SSIS package pick backup file names

    takeout substring of the name which has date_time value and on the basis of the same you can decide which one to resotore.

    Happy Coding 😉

    Regards,
    Sarabpreet Singh 😎
    Sarabpreet.com
    SQLChamp.com
    Twitter: @Sarab_SQLGeek