@manhng

Welcome to my blog!

How to run big sql script file

October 20, 2019 23:31

How to run big sql script file (edit)

https://archive.codeplex.com/?p=bigsqlrunner

Here's project that enables any developers or others to run the big sql script file greater than 300MB or any size. It also supports rollback feature & others.

Folder: ..\BigSqlRunner\sourceCode\bigsqlrunner\release\

https://knowledgebase.apexsql.com/how-to-execute-large-sql-scripts/

To run these scripts use:

  1. The osql command line utility that comes with SQL Server:
    osql -H <computer_name> -S <instance_name> -U <username> -P <password> -i <path>
  2. The sqlcmd command line utility that comes with SQL Server:
    sqlcmd -S <computer_name\instance_name> -d <database_name> -i <path> -o <output>
  3. ApexSQL Run Script:
    1. Download ApexSQL Run Script
    2. Unzip it into a folder
    3. Use the Command line and navigate to the folder where the file was unzipped
    4. Run the utility with the following parameters:
      ApexSqlRunScript <computer_name\instance_name> <database> <path>

https://www.mssqltips.com/sqlservertip/4155/executing-large-scripts-in-sql-server-management-studio-with-insufficient-memory-failures/

SELECT name, physical_name AS current_file_location
FROM sys.master_files

SELECT @@SERVERNAME

C:\Program Files\Microsoft SQL Server\xxx\Tools\Binn\SQLCMD.EXE

C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\xxx\Tools\Binn\SQLCMD.EXE

sqlcmd -S [MSSQLSERVER] -U sa -P 123456 -d [DemoDB] -i "DemoDB_Script.sql"

C:\Program Files\Microsoft SQL Server\xxx\Tools\Binn\bcp.exe

C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\xxx\Tools\Binn\bcp.exe

Categories

Recent posts