Facing Performance issues in SQL Server 2016 after migration - sql-server

Recently, we migrated the servers from SQL Server 2012 to 2016. Without any changes, a few of the queries got performance degraded.
If I run the query in SQL Server 2012, it takes 10 seconds, but the same query takes 50+min in SQL Server 2016.
If I updated the SQL Server 2016 database with Legacy CE = ON then I am able to get the results very quickly as same as 2012. But I believe it's not recommended to use Legacy CE ON in SQL Server 2016.
ALTER DATABASE SCOPED CONFIGURATION SET
LEGACY_CARDINALITY_ESTIMATION = ON;
I also updated the statistics of all tables, even thought I did get any improvement in execution.
So, Is this related to DB configuration issue (or) really do I need to update the query?
I am not sure, which configuration details I need to check. Could you please suggest anything?
Thanks advance..

solution: Link1 /
Link2
Route cause : CARDINALITY_ESTIMATION
Thanks to all.

Related

SQL Replication is_subscribed flag is set as 1

We have a Chain store environment using SQL replication. For upgrading the SQL Server we will remove the replication components from the stores and will do the SQL upgrade and then will add the stores back to the Chain. The problem here is SQL Server is not upgrading from 2008 R2 to 2012 as the is_subscribed flag is 1. As I am aware of the is_subscribed flag is no longer used in SQL Server and was using on and before 6.5. I doubt the customer might be carrying the database from then and it is throwing the issue now in SQL 2012. The question is how to update the flag to 0. We can run the upgrade only if this is set to 0. I have tried executing sp_dropsubscripion and sp_removereplicationdb. But no luck. Any help will be much appreciated.
Please use the below code
EXEC sp_dboption 'DBName','subscribed',FALSE

2016 answer to sync SQL Azure with local SQL Server

SQL Data Sync Tool is old and unsupported for PROD. It is also for SQL Server 2012, Azure has SQL Server 2014 now..
I simply need a way to sync my local full version of SQL Server 2014 with Azure SQL database.. both ways... meaning I want to pull down the azure version locally.. AND push my local version up.. at will.
The permissions are totally different and break when you use sync tools..
Has ANYONE solved this for 2016? All the answers I see say to use manually options or SQL Data Sync Tool..either of which work for us.
Suggestions?
One option would be SQL data sync as you mention. We hope to be able to share more plans in this space soon.
Guy

restore a sqlserver 2005 database into sqlserver 2012

I have a db running on an instance of sqlserver 2003, Ive tried to import it into sqlserver 2012 but that wont work it's says it's to old.
so I've imported it into sqlserver 2005, I have then backed it up again and tried to import it into sqlserver 2012 but it comes up with the same error.
I can restore other db's from sqlserver 2005 so I can only presume its keeping its 2003 settings when I back it up.
Can anyone help
I suspect that your database might have some deprecated functionality that prevents your upgrade from working.
There's a list of deprecated functionality between SQL Server 2000 and SQL Server 2005 on technet.
I would strongly advise you to use the SQL Server 2005 Upgrade Advisor to identify such functionality, and address any potential issues. Then, and only then you should have a database compatible with SQL Server 2005, and can (hopefully) proceed from there.
if u want database structure only then take database script then run into sql server 2005, if u want database with data also mean
right click the Database go task
click Generate Script
There Two options entire database or with specific objects
entire database for DataBase structure only
with specific objects - select all objects then click Next you find the Advance button then click it.
scroll down and Find Type of Data Scripts click and change to Schema and data then you will save as file file or new query window
this is one of the method to restore the database.
Set your compatibility level to (90) Sql server 2005 in your database properties after restoring.

How to remove system tables or other tables in SQL Server Link Server

Good day everyone!
I have a link server set up in SQL Server 2008 SP3 on Windows 7 64 for Oracle 11G Express.
I am using Oracle SQL Developer as a database application/Management system.
All is working well except for the long list of tables that's also in the Table tree.
There is a Filter function in SQL Developer, but I do not see the table APEX listed there.
Is there a way to configure SQL Server to that I see onle a specified table in the Link Server?
Here is an image of what I am referring to:
Thanks for the knowledge - you are making a great difference!
Guy
edit your account under security and go to user mapping untick master.
reconnect to sql server.
hope this helps.
or this link
http://msdn.microsoft.com/en-us/library/ms190644.aspx

Changing SQL server compatibility Level

I have a database which was upgraded from 2000 to 2005. Is there any issue using sp_dbcmptlevel to change compatibility level to 90. Will this cause any issues with old queries or stored procedures
Did you run the SQL Server upgrade adviser on the old database? It will tell you if there is any obvious problems. Be sure to test on a development database.
Here is the tool
http://www.microsoft.com/downloads/details.aspx?FamilyID=1470e86b-7e05-4322-a677-95ab44f12d75&displaylang=en

Resources