SQL Server runs out of internal resources producing query plan - sql-server

I'm having issues using Visual Studio 2019 to publish a database project to a target server where the database does not yet exist. During the publish process, the following error happens:
(46075,1): SQL72014: .Net SqlClient Data Provider: Msg 8623, Level 16, State 1, Line 14 The query processor ran out of internal resources and could not produce a query plan. This is a rare event and only expected for extremely complex queries or queries that reference a very large number of tables or partitions. Please simplify the query. If you believe you have received this message in error, contact Customer Support Services for more information.
(46062,0): SQL72045: Script execution error. The executed script:
The error does not appear to be related to specific SQL as the error message would suggest. If I comment out a script that generates the error, the error shows up in the next script in the sequence. Overall, the publish script produced by VS2019 is approximately 72k lines. The error pops up after approximately 46k lines.
EDIT:
Server details:
SQL Server 2019 Developer edition (15.0.2000.5). 4 processors, 16 gb memory

This was my system having the problem that Anthony posted about for me. We've now figured out the cause. The root cause was a post deployment script to populate a table with initial values. The script uses a reasonably complex merge statement and tried to insert about 18,500 rows of data.
We were thrown off initially because the error output pointed to a different script in the set, not the one causing a problem. Evidently just what was in the error buffer when it burped.

Related

Various SSAS Tabular Error Messages That Make No Sense

I've had an SSAS tabular model deployed to a server running SQL Server 2016 for about a month and it has been running fine. All of a sudden, today it is throwing random errors when I try to query it. I just tried to run the same query 8 times and got the following 8 error messages:
1) An unexpected error occurred (file 'xmvsquery.cpp', line 3184, function 'XMVSColumn::Bind').
2) An unexpected exception occurred.
3) Query (7, 46) A date column containing duplicate dates was specified in the call to function 'DATESYTD'. This is not supported.
4) Memory error: Allocation failure . If using a 32-bit version of the product, consider upgrading to the 64-bit version or increasing the amount of memory available on the machine.
5) Column 'RowNumber-2662979B-1795-4F74-8F37-6A1BA8059B61' in table 'table name' cannot be found or may not be used in this expression.
6) An unexpected error occurred (file 'tmmdmodeltm.cpp', line 2404, function 'MDModelTM::ResolveIMBIColumnId').
7) MdxScript(Model) (1, 66) Calculation error in measure 'measure name': A date column containing duplicate dates was specified in the call to function 'DATESYTD'. This is not supported.
8) Column 'RowNumber-2662979B-1795-4F74-8F37-6A1BA8059B61' in table 'table name' cannot be found or may not be used in this expression.
Looking in the application log on the server yields no further information - The description for Event ID 22 from source MSSQLServerOLAPService cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.
A couple of things that are interesting. The errors only happen if I try to run an MDX query against the model. If I try to run an equivalent DAX query, it runs fine. If I clear the SSAS cache, I can run the MDX and DAX queries against the model for a short period of time before this starts happening again.
This model is currently deployed to Microsoft SQL Server 2016 (SP1-GDR) (KB3207512) - 13.0.4199.0 (X64) and the server is running Windows Server 2016.
I've tried the following so far, and after doing each it will work for a short period of time and then it starts up again
Redeploy the model
Delete the database completely and redploy the model
Do a full process of the model
Clear the SSAS cache
Any tips would be greatly appreciated!!!
It sounds to be like your are experiencing the same defect I ran into with 2016 SP1-RTM - a seemingly random pattern of unexpected exceptions, queries that would sometimes run, sometimes not, or even render the database unprocessed(!).
SP1-CU2 resolves a number of defects which can cause symptoms like you are seeing (see link for full list), so if you've now got the latest update you are probably OK.
The only defect I have seen which SP1-CU2 does not resolve is that SELECTCOLUMNS() does not play nicely with UNION().

Deploying SSIS 2010 to Integration Service Catalog SQL Server 2012

I am new in using the SSIS and had created my first project on SSIS2010 Shell. At the moment, I have reached the stage to deploy the project to the SSISDB which has been created through the Integration Service Catalog. However, I battled for hours and hours to get the project deployed but has zero luck as it always fails and gives me an error of:
Failed to deploy project. For more information, query the
operation_messages view for the operation identifier '18'.
I ran the following query on the SSISDB level to diagnose or look at the the position of the error but didn't clarify anything to me and it sounds even more ambiguous:
SELECT [message] FROM [SSISDB].[internal].[operation_messages]
where [operation_id] = 18
I also created two Nonclustered Indexes on the SSISDB to run the process faster in case of time out issue, but this didn't work either!
Within the Additional Data in the error log I have notice the following message:
Server Name: DODI Error Number: 27203 Severity: 16 State: 1 Procedure:
deploy_project Line Number: 139
I have no idea why the project fail to be deployed? I spent hours looking at similar error, most of I already tried, as it seems fairly complicated! Does any one know the solution for this problem??

SQL Server 2008: Error creating window handle

I have N number of tables in my database, which holds around 0.6 million records. I've created a SQL script which copies this data into same tables (basically it's a script to generate more data). I've tested the script it runs fine for small data (10k records). When I tried it to copy all data, it throws an error:
An error occurred while executing batch. Error message is: Error creating window handle.
1.What is the meaning of this error in SQL Server?
2.Does it has to do anything with my SQL in script, or is this cause of other component of SQL Server?
Handles are Windows tools to manage OS resources. When some app on your machine have memory leaks - you can run out of handles and this error occurs. Current state of handles can be seen in Task Manager (Handle Count)
As said in comments - it's a client side issue. For example large resultsets/query output to grid may end up to this error.
Solution: Reboot your PC, minimize the output of query. Also you can try to launch script via SQLCMD.
You can read more about it here.
Some explanation here.

SSRS Query execution failed for dataset

Have just deployed my Project on to my reporting Server.
I have multiple datasets which are referencing views which exist on the db on that server.
When I try to go into any report part I am getting this message:
An error has occurred during report processing. (rsProcessingAborted)
Query execution failed for dataset 'dataset1'. (rsErrorExecutingCommand)
For more information about this error navigate to the report server on the local server machine, or enable remote errors
Can anyone help?
I enabled remote errors to pinpoint the problem.
I identified that a column in a particular dataset (one of my views) was throwing an error.
So using a tool "SQL Delta", I compared the development version of the database with the live version on the reporting server. I noticed that one of the views had an extra column on the development server, that was not on the live version of the db.
SQL Delta generated the script I needed to run to update the view on my live db.
I ran this script, re-ran the report, everything worked.
I encountered a similar error message. I was able to fix it without enabling remote errors.
In Report Builder 3.0, when I used the Run button to run the report, an error alert appeared, saying
An error has occurred during report processing. (rsProcessingAborted)
[OK] [Details...]
Pressing the details button gave me a text box where I saw this text:
For more information about this error navigate to the report server
on the local server machine, or enable remote errors
----------------------------
Query execution failed for dataset 'DataSet1'. (rsErrorExecutingCommand)
I was confused and frustrated, because my report did not have a dataset named 'DataSet1'. I even opened the .rdl file in a text editor to be sure. After a while, I noticed that there was more text in the text box below what I could read. The full error message was:
For more information about this error navigate to the report server
on the local server machine, or enable remote errors
----------------------------
Query execution failed for dataset 'DataSet1'. (rsErrorExecutingCommand)
----------------------------
The execution failed for the shared data set 'CustomerDetailsDataSet'.
(rsDataSetExecutionError)
----------------------------
An error has occurred during report processing. (rsProcessingAborted)
I did have a shared dataset named 'CustomerDetailsDataSet'. I opened the query (which was a full SQL query entered in text mode) in SQL Server Management Studio, and ran it there. I got error messages which clearly pointed to a certain table, where a column I had been using had been renamed and changed.
From that point, it was straightforward to modify my query so that it worked with the new column, then paste that modification into the shared dataset 'CustomerDetailsDataSet', and then nudge the report in Report Builder to recognise the change to the shared dataset.
After this fix, my reports no longer triggered this error.
Like many others here, I had the same error. In my case it was because the execute permission was denied on a stored procedure it used. It was resolved when the user associated with the data source was given that permission.
I experienced the same issue, it was related to security not being granted to part of the tables. review your user has access to the databases/ tables/views/functions etc used by the report.
The solution for me came from GShenanigan:
You'll need to check out your log files on the SSRS server for more detail. They'll be somewhere like: "C:\Program Files (x86)\Microsoft SQL Server\MSRS10_50.DEV\Reporting Services\LogFiles\"
I was able to find a permissions problem on a database table referenced by the view that was not the same one as the where the view was. I had been focused on permissions on the view's database so this helped pinpoint where the error was.
I just dealt with this same issue. Make sure your query lists the full source name, using no shortcuts. Visual Studio can recognize the shortcuts, but your reporting services application may not be able to recognize which tables your data should be coming from. Hope that helps.
I had the similar issue showing the error
For more information about this error navigate to the report server on
the local server machine, or enable remote errors Query execution
failed for dataset 'PrintInvoice'.
Solution:
1) The error may be with the dataset in some cases, you can always check if the dataset is populating the exact data you are expecting by going to the dataset properties and choosing 'Query Designer' and try 'Run', If you can successfully able to pull the fields you are expecting, then you can be sure that there isn't any problem with the dataset, which takes us to next solution.
2) Even though the error message says "Query Failed Execution for the dataset", another probable chances are with the datasource connection, make sure you have connected to the correct datasource that has the tables you need and you have permissions to access that datasource.
In my situation, I created a new SSRS report and new stored procedure for the dataset. I forgot to add the stored procedure to the database role that had permission to execute it. Once I added the permissions to SQL database role with EXECUTE, all was fine!
The error message encountered by the user was "An error occurred during client rendering. An error has occurred during report processing (rsProcessingAborted). Query execution failed for dataset "DataSet1'. (rsErrorExecutingCommand) For more information..."
Very grateful I found this great post. As for my case, the user executing the stored procedure did not have EXECUTE permissions. The solution was to grant EXECUTE permissions for the user within the stored procedure by adding below code to the end of the stored procedure.
GRANT EXECUTE ON dbo.StoredProcNameHere TO UsernameRunningreports
GO
I also had a very similar issue with a very similar error message. My issue was that the database could not be connected to. In our case, we have mirrored databases and the connection string did not specify the Failover Partner. So when the database couldn't connect, it never went to the mirror and was throwing this error. Once I specified the Failover Partner in the connection string for my datasource, it resolved the issue.
BIGHAP: A SIMPLE WORK AROUND FOR THIS ISSUE.
I ran into the same problem when working with SharePoint lists as the DataSource, and read the blogs above which were very helpful. I had made changes in both the DataSource and Data object names and query fields in Visual Studio and the query worked in visual Studio. I was able to deploy the report to SharePoint but when I tried to open it I received the same error.
I guessed that the issue was that I needed to redeploy both the DataSource and the DataSet to SharePoint so that that changes in the rendering tools were all synced.
I redeployed the DataSource, DataSet and the Report to sharePoint and it worked.
As one of the blogs stated, although visual studio allowed the changes I made in the dataset and datasource, if you have not set visual studio to automatically redeploy datasource and dataset when you deploy the report(which can be dangerous, because this can affect other reports which share these objects) this error can occur.
So, of course the fix is that in this case you have to redeploy datasource, dataset and Report to resolve the issue.
I was also facing the same issue - I checked below things to fix this issue,
If you have recently changed pointing database-name in data-source
then first check that all the store procedures for that report exist
on changed database.
If there are multiple sub reports on main report then make sure each
report individually running perfectly.
Also check security panel - user must have access to the databases/
tables/views/functions for that report.
Sometimes, we also need to check dataset1 - store procedure. As if you are trying to show the report with user1 and if this user doesn't have the access(rights) of provided (dataset1 database) database then it will throw the same error as above so must check the user have access of dbreader in SQL Server.
Also, if that store procedure contains some other database (Database2) like
Select * from XYZ inner join Database2..Table1 on ... where...
Then user must have the access of this database too.
Note: you can check log files on this path for more details,
C:\Program Files\Microsoft SQL Server\MSRS11.SQLEXPRESS\Reporting Services
I got same error but this worked and solved my problem
If report is connected to Analysis server then give required permission to the user (who is accessing reporting server to view the the reports) in your model of analysis server.
To do this add user in roles of model or cube and deploy the model to your analysis server.
Using SSRS, Report Builder 3.0, MSSQL 2008 and query to an Oracle 11G database,
I found that the oracle stored procedure ran well, produced consistent results with no errors. When I tried bringing the data into SSRS, I got the error as listed in OP's query. I found that the data loaded and displayed only if I removed the parameters (not a good idea).
On Further examination, I found that under dataset properties>parameters I had set the start date to parameterName P_Start and parameter Value to #P_Start.
Adding the Parameter value as [#P_Start] cleared the problem, and the data loads well, with parameters in place.
This problem was caused by an orphaned SQL Login. I ran my favorite sp_fixusers script and the error was resolved. The suggestion above to look at the logs was a good one...and it led me to my answer.
This might be the permission issue for your view or store procedure
In addition to the above answers, it could be due to a missing SQL stored-procedure or SQL function. For example, this could be due to the function not migrating from a non-prod region to the production (prod) region.
Removing all comments from the Select Query fixed this for me. My dataset was working in the Preview but when I went to Design/Query Designer and and tried the query there I was getting ORA-01006;bind variable does not exist. After removing all comments from the select it worked.

The Schema Compare tool in Visual Studio has stopped working properly, giving "cannot be overwritten. It is being used by database 'DbName'" errors

Full Error:
Error 1 SQL01268: .Net SqlClient Data Provider: Msg 1834, Level 16, State 1, Line 1 The file 'C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\TestSource.mdf' cannot be overwritten. It is being used by database 'TestSource'. SchemaCompare3 25 0
Irrespective which database connection\files I am using. I even created two new databases to test with simple one table, once column and it gives the same error.
I have used the tool before with no problems. All of the sudden it's not working anymore.
Any suggestions on how to fix it would be great. I have seen numerous posts about this error, but none fit my scenario where absolutely no two source and target db's will work.
Also problem may possibly lie in the .\SQLEXPRESS engine.

Resources