Restore of database

  • Comments posted to this topic are about the item Restore of database

  • Thank you for supplying the script.

  • I'm very new to MS-SQL, in fact I'm running the express server. 
    Microsoft SQL Server Management Studio                        13.0.16106.4
    Microsoft Analysis Services Client Tools                        13.0.1700.441
    Microsoft Data Access Components (MDAC)                        10.0.14393.0
    Microsoft MSXML                        3.0 4.0 5.0 6.0
    Microsoft Internet Explorer                        9.11.14393.0
    Microsoft .NET Framework                        4.0.30319.42000
    Operating System                        6.3.14393

    1) So I took your script and changed "your_config_db" to "tempdb".
    2)  I loaded up a directory with two *.bak files.
    3 Ran
    USE tempdb
    GO
    EXEC Restore_Database
    @backupPath = N'F:\Libs\Jack\invest\HawkEyeY\',
    @DBName = N'HawkEyeY',
    @Print_or_Run = 0
    --Default in @Print_or_Run is to print the command.
    -- If you put in 1 then it runs the restore command.

    RESULTS:
    I got the  "PRINT @Restore" showing the commands ( I think in the RESULT tab).

    4) Then I deleted the HawkEyeY database.
    5) Removed one of the *.bak  files.
    6) Ran the PROC with @Print_or_Run = 1
    RESULTS:
    I only get "(1 row(s) affected)" in the Messages tab.
    Do I have to put an empty HawkEyeY DB out there first?

  • seboldj - Thursday, June 8, 2017 2:03 PM

    I'm very new to MS-SQL, in fact I'm running the express server. 
    Microsoft SQL Server Management Studio                        13.0.16106.4
    Microsoft Analysis Services Client Tools                        13.0.1700.441
    Microsoft Data Access Components (MDAC)                        10.0.14393.0
    Microsoft MSXML                        3.0 4.0 5.0 6.0
    Microsoft Internet Explorer                        9.11.14393.0
    Microsoft .NET Framework                        4.0.30319.42000
    Operating System                        6.3.14393

    1) So I took your script and changed "your_config_db" to "tempdb".
    2)  I loaded up a directory with two *.bak files.
    3 Ran
    USE tempdb
    GO
    EXEC Restore_Database
    @backupPath = N'F:\Libs\Jack\invest\HawkEyeY\',
    @DBName = N'HawkEyeY',
    @Print_or_Run = 0
    --Default in @Print_or_Run is to print the command.
    -- If you put in 1 then it runs the restore command.

    RESULTS:
    I got the  "PRINT @Restore" showing the commands ( I think in the RESULT tab).

    4) Then I deleted the HawkEyeY database.
    5) Removed one of the *.bak  files.
    6) Ran the PROC with @Print_or_Run = 1
    RESULTS:
    I only get "(1 row(s) affected)" in the Messages tab.
    Do I have to put an empty HawkEyeY DB out there first?

    Hi, yes you need to create an database before you run this script. It's possible to do this in the script also. I’ll see if I get the time to do add this later this or next week.
    I strongly recommend than you create your own DBA database where you put DBA scripts and not use tempdb, since this database is overwritten on every reboot of SQL Server

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply