Skip to content Skip to sidebar Skip to footer

Mssql Insufficient Memory to Continue the Execution of the Program Mscorlib

How to Fix Cannot execute script. Insufficient memory to continue the execution of the program (mscorlib) error in SQL Server

How to Fix Insufficient memory to continue the execution of the program (mscorlib) error in SQL Server

Database Administrators often need to get involved in code deployments wherein they release new code from one environment to another. As a best practice it is highly recommended to note down issues faced during code deployment and address them before you move with code deployment to higher environments such as Pre-Production or Production.

Learn How to Fix SQL Server Error "Insufficient memory to continue the execution of the program"

One of the most errors faced by DBAs during code deployment is "Cannot execute script. Insufficient memory to continue the execution of the program (mscorlib)". The reason why you receive the above error is SQL Server Management Studio is when SSMS cannot handle errors in case if the script fails because the script file is very big generally above 30 MB.

How to Fix Insufficient memory to continue the execution of the program (mscorlib) error in SQL Server

Insufficient memory to continue the execution of the program (mscorlib)

Error Message

              Cannot execute script. Insufficient memory to continue the execution of the program (mscorlib)            

Solution: Use SQLCMD to execute Large TSQL Scripts

SQL Server Management Studio (SSMS) is not always the right option to execute larger script files. Hence it is highly recommended to use SQLCMD utility from command prompt to execute larger files.

  • Display Line Numbers in SQL Server Management Studio (SSMS)
  • How to Enable and Refresh IntelliSense in SQL Server Management Studio (SSMS)
  • Performance Dashboard Reports in SQL Server 2012
  • How to Use Dedicated Administrator Connection in SQL Server
  • How to Migrate Existing Database to Partially Contained Database in SQL Server
  • How to Configure Network Drive to be Visible for SSMS to Perform Database Backup and Restore?

How to Start SQLCMD Command Line Utility

1. On the Start menu click Run. In the Open box type cmd, and then click OK to open a Command Prompt window.

2. In the command prompt, type SQLCMD.

3. Press ENTER.

You will now have a trusted connection to the default instance of SQL Server that is running on your computer. 1> is the sqlcmd prompt that specifies the line number. Each time you press ENTER, the number increases by one.

4. Finally to end the sqlcmd session, type EXIT at the sqlcmd prompt.

How to Run a Script on Standalone SQL Server Instance Using SQLCMD Command Line Utility

              sqlcmd -S DATABASESERVERNAME -i "F:/DeploymentScripts/DataPopulation.sql"                          

How to Run a Script on a Named Instance of SQL Server Using SQLCMD Command Line Utility

              sqlcmd -S DATABASESERVERNAME\TESTINSTANCE -i "F:/DeploymentScripts/DataPopulation.sql"                          

Overview of Different SQLCMD Command Line Options in SQL Server

              -S Specifies the instance of SQL Server to which to connect  -i Specify the file path of the input script                          

Conclusion

It is highly recommended to use SQLCMD command line utility to execute TSQL scripts which are large in size as SQL Server Management Studio will not be able to handle large file for execution.

Chetna Bhalla

LESS ME MORE WE

Chetna Bhalla, the founder of MyTechMantra.com, believes that by sharing knowledge and building communities, we can make this world a better place to live in. Chetna is a Graduate in Social Sciences and a Masters in Human Resources and International Business. She is an alumnus of Vignana Jyothi Institute of Management, Hyderabad, India. After graduation, Chetna founded this website, which has since then become quite a favorite in the tech world. Her vision is to make this website the favorite place for seeking information on Databases and other Information Technology areas. She believes that companies which can organize and deploy their data to frame strategies are going to have a competitive edge over others. Her interest areas include Microsoft SQL Server and overall Database Management. Apart from her work, Chetna enjoys spending time with her friends, painting, gardening, playing the violin, and spending time with her son.

eatonshood1967.blogspot.com

Source: https://www.mytechmantra.com/learnsqlserver/how-to-fix-cannot-execute-script-insufficient-memory-to-continue-the-execution-of-the-program-mscorlib-error-in-sql-server/

Publicar un comentario for "Mssql Insufficient Memory to Continue the Execution of the Program Mscorlib"