SQL Server Scripting Server Error - sql-server

I generated a Script of a database of size appox. 8GB using SQL Server's scripting Service. (Schema and Data).
Now When I try to to open the generated Script file(.sql) , I get two different errors randomly.
Sometimes I get
And sometimes I get
In no specific order.
It is SQL Server 2008 R2 SP1 64 bit , Enterprise Edition.
Windows 2008 R2 Server SP2 64-bit , Enterprise Edition.
Any Idea what this is and how I can fix this? any suggestions or pointers in the right direction are much appreciated. Thank you.

8 GB is a very large SQL file, you won't be able to open such a big file in Management Studio without running into weird problems like those error messages you are seeing.
I suggest you use the sqlcmd command line tool to run your 8 GB file.
sqlcmd -S <db_servername> -d <db_name> -i <sql_filename.sql> -U <sql_username> –P <sql_password>
(sqlcmd is usually located in the folder C:\Program Files\Microsoft SQL Server\100\Tools\Binn for SQL Server 2008 R2)

Related

Opening multiple servers in SSMS command line parameters in shortcut

My goal is to open SSMS from a shortcut on my desktop but I would like to specify more than one server. Currently this target is working well to open one of these servers.
"C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\Ssms.exe" -S ServerName1 -E
But we have two production-level servers that I would like to open in the same SSMS window simultaneously, as I frequently need to connect to and query the other server at some point in my investigations anyway. I was thinking maybe something along the lines of these examples would work, but no luck:
"C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\Ssms.exe" -S ServerName1 ServerName2 -E <-- This makes SSMS think it's supposed to open files.
"C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\Ssms.exe" -S ServerName1, ServerName2 -E <-- This makes SSMS think it's supposed to open files.
"C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\Ssms.exe" -S ServerName1 -S ServerName2 -E <-- And this simply opens the second specified server as the second overrides the first.
Nothing here: https://learn.microsoft.com/en-us/sql/ssms/ssms-utility?view=sql-server-ver15 says explicitly that I can't do this, but also does not say that I can. (Well, there isn't an example of this anywhere I have looked.) I was under the impression that because I was not providing databases or files with these parameters that it would be possible. I guess what I am trying to do is not practical and an analogy for this would be to specify a server and multiple databases, which does not make much sense.
Please help me understand the correct syntax for this shortcut if this is possible(or an equivalent workaround), and if this is not possible please inform me why this is perhaps bad practice or to be avoided. I really just want to see both of these servers in the object explorer upon SSMS loading. Perhaps a server group is the right solution?
Thanks for reading, any help is appreciated.

Not all privileges or groups referenced are assigned to the caller

I'm a noob on DBA profile. I was installing a SQL server 2008 R2 on Windows 2008 R2. while installing sql-server i received the following error. I was not able to locate any log at *C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap*
TITLE: Microsoft SQL Server 2008 R2 Setup
The following error has occurred:
Not all privileges or groups referenced are assigned to the caller.
Click 'Retry' to retry the failed action, or click 'Cancel' to cancel
this action and continue setup.
For help, click:
http://go.microsoft.com/fwlink?LinkID=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=10.50.1600.1&EvtType=0xB2652E58%25400xDC80C325
BUTTONS:
&Retry Cancel
Could you please help me troubleshoot/fix this issue?
As it was a new instance, rebuilding the system databases worked for me. Be careful if it is an old instance as all data will be wiped out (you still can take backups and restore data, just a bit more complicated). Details as to how to rebuild the databases here
If you are trying to install MSSQL Server 2008 R2 after uninstalling any higher or lower version of MSSQL Server i.e MS SQL Server 2012,2014. Please make sure that you have removed every single file with the name SQL Server except the following three files from the control panel >> Programs >> Uninstall a Program.
Microsoft SQL Server Compact 3.5 SP2 ENU
Microsoft SQL Server Compact 3.5 SP2 Query Tool ENU
Microsoft SQL Server Compact 4.0 SP1 x64 ENU CTP1
Also, removed the MSSQL Server folder from the following path
C:\Program Files\
C:\Program Files(x86)
C:\ProgramData\Microsoft
After then restart the system and try to install it.
Please let me know if you receive any errors.

Insufficient memory to continue the execution of the program in SQL Server 2008 R2

SQL Server 2008 R2 warning when tried to execute the script of size approx 500MB
When I tried executing a SQL script which was of 500 mb approx. Management Studio throws an error
Insufficient memory to continue the execution of the program
My system memory is 8GB and only 3GB is free. I tried SQLCMD but it's not working. Any other solution for this?
I faced this issue when I was trying to restore a database using backup of higher version (SQL Server 2014) to a lower version (SQL Server 2008 R2) using scripting method.
We can run big scripts using command line.
Ie :
sqlcmd -S myServer\instanceName -U sqlusername -P sqlpassword -i C:\myScript.sql
link details
According to this:
https://technet.microsoft.com/en-us/library/ms143432(v=sql.105).aspx
the maximum batch size is 256 MB (65.536 * 4 kB).
You will have to split the script into several smaller ones.

Migrate a SQL Server database to a lower version

I am trying to downgrade a SQL Server 2014 database to a lower version (SQL Server 2012) by using the task Generating scripts found when right clicked on the database.
After I make the settings in order to generate the script, the server does that but when I'm trying to open the file (the script made) on a lower version instance of SQL Server, I get the following error.
System out of memory exception thrown
Could anyone provide some help? Thanks!
As suggested by #usr you can run the script from the command line using sqlcmd:
sqlcmd -S myServer\instanceName -i C:\myScript.sql
Alternatively you can download a trial edition of ApexSQL or Redgate SQL Compare (assuming you have not tried them already) and script over the changes using these tools.
The script is too big for SSMS (a shame!). Run it using SQL Server command line tools.
I find it easier to do this by using Redgate SQL Packager or the two compare tools. They can execute enormous scripts.

SQL Job not running some of the stored procedures after upgrading from SQL Server 2005 to 2008

We recently upgraded from MSSQL 2005 to MSSQL 2008 and after doing so, we are having an issue, 4 out of 10 procedures that we have set up to output XML files aren't working. We never had a problem till we upgraded and the other 6 are running fine.
If we run the job manually, we get the following error for the 4 procedures:
User name not provided, either use -U to provide the user name or use -T for Trusted Connection
I'm assuming we might have some sort of a permission issue from the new install but not sure where to start.

Resources