浏览代码

Merge branch 'master' of https://github.com/Microsoft/tigertoolbox

Pedro Lopes 9 年之前
父节点
当前提交
733f765eb8

+ 8 - 0
Before-Uninstalling-SQL-Server-2016-SP1-on-lower-editions/Readme.md

@@ -0,0 +1,8 @@
+With the release of SQL Server 2016 SP1, a number of programmability features which were only available in Enterprise Edition are now enabled in Standard, Web, Express and LocalDB editions of SQL Server 2016. These features will allow developers and ISVs with consistent programming experience to build applications which scale across all edition of SQL Server. For more information on what’s new in SQL Server 2016 SP1, please read our SQL Releases blog. 
+
+Uninstalling SQL Server 2016 SP1 (Not recommended):
+If for any reason you choose to uninstall SQL Server 2016 SP1, the uninstallation of SQL Server 2016 SP1 is not blocked and you will be able to uninstall SQL Server 2016 SP1 like any other service pack. However, if you are running Standard, Web, Express edition of SQL Server and leveraging some of the new features which are unlocked only starting SQL Server 2016 SP1, you might see some unforeseen errors or databases might even be left in suspect state after uninstallation of SQL Server 2016 SP1. Even worse would be if the system databases are using new features for example, partitioned table in master database, it can lead to SQL Server instance unable to start after uninstalling SQL Server 2016 SP1. Hence it is recommended to validate all the new features are disabled or dropped before you choose to uninstall SQL Server 2016 SP1 on editions other than Enterprise Edition. 
+
+Note: If you are running Enterprise edition of SQL Server 2016 SP1, none of this applies and you can uninstall SP1 without any issues or additional checks.
+
+To assist DBAs in performing checks in an instance to see if new features are in use before you plan uninstall SP1, I have created below T-SQL script which checks all the databases of the instance to see if database is using any new features which needs to be disabled or dropped before you uninstall SQL Server 2016 SP1 on lower editions.

+ 38 - 0
Before-Uninstalling-SQL-Server-2016-SP1-on-lower-editions/Validate_sku_features_before_uninstalling_SP1.sql

@@ -0,0 +1,38 @@
+SET NOCOUNT ON
+DECLARE @cnt int;
+DECLARE @edition int; 
+SELECT @edition= CONVERT(int,SERVERPROPERTY('EngineEdition'))
+IF @edition <> 3
+BEGIN
+DROP TABLE IF EXISTS tempdb.dbo.tbl;
+CREATE TABLE tempdb.dbo.tbl(db sysname, feature_name nvarchar(4000), features_in_use bit)
+insert INTO tempdb.dbo.tbl select 'server','IsPolybaseInstalled',CAST(SERVERPROPERTY ('IsPolybaseInstalled') as int);
+EXEC master.sys.sp_MSforeachdb 'USE [?];
+			  DECLARE @features_in_use int;
+			  SELECT @features_in_use=count(1) from sys.dm_db_persisted_sku_features;
+			  IF (@features_in_use > 0)
+			  INSERT INTO tempdb.dbo.tbl SELECT DB_name(),feature_name,1 from sys.dm_db_persisted_sku_features;
+			  SELECT @features_in_use=count(1) from sys.column_master_keys;
+			  IF (@features_in_use > 0)
+			  INSERT INTO tempdb.dbo.tbl VALUES(DB_NAME(),''Always Encrypted'',1);
+			  SELECT @features_in_use=count(1) from sys.security_policies;
+			  IF @features_in_use > 0
+			  INSERT INTO tempdb.dbo.tbl VALUES(DB_NAME(),''Row-level security'',1);
+			  SELECT @features_in_use=count(1) from sys.masked_columns;
+			  IF @features_in_use > 0
+			  INSERT INTO tempdb.dbo.tbl VALUES(DB_NAME(),''Dynamic Data Masking'',1);
+			  SELECT @features_in_use=count(1) from sys.database_audit_specifications;
+			  IF @features_in_use > 0
+			  INSERT INTO tempdb.dbo.tbl VALUES(DB_NAME(),''Database Auditing'',1);'
+SELECT @cnt=count(1) FROM tempdb.dbo.tbl WHERE features_in_use=1
+IF @cnt>0
+BEGIN
+SELECT * from tempdb.dbo.tbl where features_in_use = 1;
+THROW 60000, 'The instance cannot be downgraded from SP1 as it contains atleast 1 database mentioned above with SKU features not available in SQL Server 2016 RTM. If downgrade is attempted, it can leave the database in suspect mode. DROP or DISABLE the feature and rerun the script to confirm before you downgrade',0
+END
+ELSE 
+THROW 60000,'The instance can be downgraded as it doesnt contain any database leveraging new features enabled in SP1 on lower editions',0
+DROP TABLE tempdb.dbo.tbl
+END
+ELSE
+PRINT 'The instance can be downgraded as Enterprise Edition is not impacted in SP1'

二进制
SQL-Performance-Baseline/Reporting.zip