3

I have a SQL script file that has size of 3.55 GB. When I try to open it in SQL Server, I get an error

System.outOfMemoryException

I have only script option to import data because in my local PC I have SQL Server 2012 and in my live domain I have SQL Server 2008 R2 so I generated SQL Server 2008 R2 scripts with data.

Can any one help me with this?

4
  • 1
    To go from 2008 R2 to 2012, you could easily do a backup/restore cycle. What you cannot do is go back from 2012 to 2008 R2 with backup&restore .... To run this script, look at the SQLCMD command-line utility provided with SQL Server Commented Mar 27, 2015 at 5:55
  • but script is so large it can not be open Commented Mar 27, 2015 at 6:09
  • 1
    Have you tried with SQLCMD ?? If it really doesn't work - well then you would have to create multiple, smaller SQL scripts to handle this situation ..... Commented Mar 27, 2015 at 6:12
  • Which tool do you use to open the script? "SQL Server" does not have GUI - your SQL client is giving that out of memory exception. Did you try different tools? Commented Mar 27, 2015 at 6:50

2 Answers 2

4

To run this large script file, you should look at the SQLCMD command-line utility provided with SQL Server.

It should be able to handle even very large scripts indeed.

If that doesn't work, then you'd need to make sure to create multiple, smaller scripts to handle the work

Sign up to request clarification or add additional context in comments.

Comments

1

If the script lines are not dependent on each other, you can split the file using sed utility. sed utility is also available for windows in MinGW. It can split the files from line numbers that you provide. If the scripts lines are dependent on each other then you can use https://bigsqlrunner.codeplex.com/. Its a good point to start

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.