When we have the db backup of a large (or small) sql db, in the form a of a script file, it is not possible to restore the db using the SMMS (Sql Server Management Studio). It shows there is not enough memory to execute and load the script file.

In such a case, it is always recommended to use the command line tool of sql, to get this done. Format is as [Make sure you open Command window in Administrator mode]:

sqlcmd -S <YOUR-SERVER> -U <YOUR-USER> -P <YOUR-PASSWORD> -d <YOUR-DATABASE> -i <YOUR-SQL-FILE-PATH.sql>

If you are restoring the file without a db created upfront, you can skip the “-d” parameter. Also do make sure that the file path should not be that much bigger which then the command line tool will not accept it. So keep the file path (including filename) as short as possible. The time taken to execute this command, will depend upon the db size and the server capability. For eg : A db script of size 1.23 GB took almost 39 minutes in a Windows server 2012, server machine to finish executing with.

Leave a Reply