quarta-feira, 6 de janeiro de 2016

You should use sqlcmd.exe using dos prompting to execute large sql files (GREATER THEN 1gb)

Whenever I have to execute a huge file, I use sqlcmd.exe via dos.

My strategy is

STEP 1

Create a specific user for that - something like USR_TOUGH_GUY

OWNED SCHEMAS
db_accessadmin

ROLE MEMBERS
db_accessadmin

STEP 2

Find the executable sqlcmd.exe in the machine where SQL SERVER is installed.

STEP 3

Execute
sqlcmd -S myServer\instanceName -U USR_TOUGH_GUY -P THE_PASSWORD_OF_MR_TOUGH_GUY  -i  C:\yourscript.sql


STEP 4

Disable mr TOUGH_GUY

Final considerations

You could do this using the SQLStudio but it will consume a lot of memory of the machine, if you are, for instance, trying to execute a 4GB file.

Good luck!




Nenhum comentário:

Postar um comentário