Cari Blog Ini

13 Juni 2012

Example of Restore Database Using Syntax SQL

/* Task for : Restore Database */
----------------------------------------------------
-----code:start
----------------------------------------------------
RESTORE DATABASE [DB_Test]
FROM  DISK = N'\\xxx.xxx.x.44\Share\RestoreDB\DB_Test_120613_1340.DAT'
    WITH  FILE = 1,
   
    MOVE N'DB_Test'
    TO N'C:\DBTest\DB_Test.mdf', 
   
    MOVE N'DB_Test_Log'
    TO N'C:\DBTest\DB_Test_Log.ldf',     
   
    NOUNLOAD, 
    REPLACE, 
    STATS = 10
GO
----------------------------------------------------
-----code:end
----------------------------------------------------

Result Messages:
14 percent processed.
24 percent processed.
34 percent processed.
44 percent processed.
54 percent processed.
64 percent processed.
74 percent processed.
84 percent processed.
94 percent processed.
100 percent processed.
Processed 160 pages for database 'DB_Test', file 'DB_Test' on file 1.
Processed 1 pages for database 'DB_Test', file 'DB_Test_log' on file 1.
RESTORE DATABASE successfully processed 161 pages in 0.135 seconds (9.317 MB/sec).