Abbreviations for SQL Server Components when Installing with PowerShell

I have (finally) been introduced to installing SQL Server with PowerShell and it has made those installations much easier.  Each of my installs; however, may require different SQL Server components so one of the items in my configuration file I change is the Features= section of the INI file.  To help keep all this information in one place, here is a list of items you can choose to install.  Remember, most of these will require other parameters to be set–this is only for the Features= section.  Each feature should be separated by a comma.

SQLInstalFeatureNames

SQL Server Component Install Options

This list specifies the items you can choose to install.

Database engine = SQLENGINE
Replication = REPLICATION
Full-text and semantic extractions for search = FULLTEXT
Data quality services = DQ
Analysis services = AS
Reporting services – native = RS
Reporting services – sharepoint = RS_SHP
Reporting services add-in for sharepoint products = RS_SHPWFE
Data quality client = DQC
SQL Server data tools = BIDS
Client tools connectivity = CONN
Integration services = IS
Client tools backwards compatibility = BC
Client tools SDK = SDK
Documentation components = BOL
Management tools – basic = SSMS
Management tools – advanced = ADV_SSMS
Distributed replay controller = DREPLAY_CTLR
Distributed replay client = DREPLAY_CLT
SQL client connectivity SDK = SNAC_SDK
Master data services = MDS

Happy installing. :)

Upgrading SSRS From SQL 2005 to SQL 2012

These instructions should also work with upgrading SQL 2008 and SQL 2008R2 as well; however, my experience was upgrading from SQL 2005.  I was pleasantly surprised with the process; however, I ran into one little bump which I detail below.  I also upgraded from SQL Enterprise 2005 to Standard 2012.

On the New Server

SSRSConfigStep1I installed Reporting Services.  SQL Server happened to be on the same server as the reporting services service, but this is not required.  The 2005 installation was separate from the database.  I installed with no configuration and then used the Reporting Services Configuration Manager to set the Service Account, the Email Settings, set the Web Service URL, and the Report Manager URL.  I did not set the database just yet.

I restored the Reporting Service databases ReportServer and ReportServerTempDB on the new server.  While I believe you could modify the compatibility level at this point, I did not.  I should note my service account is the same AD account on both instances.  You may have to grant some permissions if you use a different account.

On the Old Server

I took a backup of the encryption keys.  I then copied that file to the new server.

The Big Finale

On the new server, I then connected to the 2012 database and Reporting Services took care of the rest.  It liked the new databases and I received no warnings or errors.

Because I had not updated the compatibility level, I stopped reporting services, updated the compatibility level and then restarted reporting services.  Up to this point, I was all good.

The last step was to restore the encryption keys on the new server using the file from the old server.  As this is something I don’t test often enough, I was glad this went without a hitch.  :)

Tripping Over the Finish Line

I then opened up the browser and when to http://localhost/reports where I was greeted with–a big error!  The feature: “Scale-out deployment” is not supported in this edition of Reporting Services.  It appears the restoration of the encryption keys added the original server to the configuration and now Reporting Services was unhappy.  To remove the old server from the configuration, I tool the following steps.

I opened a command prompt and when to “C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\”.  I then used the RSKeyMgmt utility with the -l flag to show the list of servers in my configuration.

RSKeyMgmt –l

I Removed the instance of the old server using the following command:

RSKeyMgmt -r GUIDofOldServer

I restarted SSRS for good measure and I was able to access all the reports on the new server.  I haven’t finished all my testing, but so far it looks good.

Cannot enable the Microsoft .NET Framework 3.5 feature on Windows Server 2012

I was building a new SQL Server Cluster and I was going a little to fast and forgot to enable the .net framework 3.5 feature on the windows server before I installed SQL Server.  .NET 3.5 SP1 is a requirement for SQL Server 2012 when you select Database Engine, Reporting Services, Master Data Services, Data Quality Services, Replication, or SQL Server Management Studio, and it is no longer installed by SQL Server Setup.

No problem, I thought–I know how to enable that using add roles and features wizard.  Only a weird thing happened on the way–the installation failed.  It didn’t even include an error message.  Weird, I thought. When I tried the install using DISM as suggest by Albert Morillo, I got the following:

The operation completed, but the NetFx3 feature was not enabled.  Ensure the parent feature(s) are enabled first.

Parent features?  This was news to me.  Then I found there have been a couple of security updates that have come which will cause this to fail.  If you are getting the operations folks to build the servers, they will have to hold off on installing security update 2966827 and 2966828 until you enable the .NET 3.5 framework.  Once they were removed, I would enable the 3.5 framework and continue my installation.

Looks like I have another item to add to my server build checklist.

Updating Default Values for Columns

To make life a little simpler, a default value can be added to a column so if the information is not passed with the row data, SQL Server can plug in some information for you.  A common scenario is to add a default DateTime of the current system time.  This image show what that looks like when you design the table in SSMS.

DefaultBinding

What happens if you wanted to change the default value option for those tables?  For example, we are preparing to move to Azure SQL and our default options need to be GETUTCDATE() instead of GETDATE().  I put together this script to help me identify all the constraints in the database that need to be updated. This code has the new lines so you should be able to run the output. Don’t forget to update your data before you made the change. You can find that example here.

SELECT
'ALTER TABLE ' + t.name + ' DROP CONSTRAINT ' + dc.name + '
GO
' + 'ALTER TABLE ' + t.name + ' ADD CONSTRAINT ' + dc.name + ' DEFAULT GETUTCDATE() FOR ' + c.name + '
GO'
FROM sys.default_constraints dc
INNER JOIN sys.tables t ON dc.parent_object_id = t.object_id
INNER JOIN sys.columns c ON t.object_id = c.object_id
WHERE dc.parent_column_id = c.column_id
AND dc.definition = '(getdate())'

Converting to UTC Time

In preparation for a migration to Azure SQL Database, we found we had to adjust our date formats to UTC time as this is the way dates are stored in azure because your databases could be all over the world.  For new systems, this is very useful; however, what about migrating data to Azure?  I have tables with dates based on a GETDATE() default and this time will be the time zone for the server where the record was created.  I wanted to convert my dates to UTC time and came up with this script.  It is based on servers in the EASTERN time zone.  As the date for daylight savings time changes each year, I used timeanddate.com for the historical data.

Suppose I have a table named Customers with a column called CreationDate and I wanted to update my times to UTC. I would apply this logic. As always, test before implementation. I put an ELSE statement at the end so I could check to see if any dates fell outside my range. This only goes back to 2009. You would have to consult timeanddate.com for more dates if you have older data.

UPDATE Customers
SET CreationDate =  CASE
	WHEN YEAR(CreationDate) = 2009 AND CreationDate BETWEEN '2009-03-08 02:00:00.0000000' AND '2010-11-01 02:00:00.0000000' THEN DATEADD(hh,6,CreationDate)
	WHEN YEAR(CreationDate) = 2009 AND CreationDate NOT BETWEEN '2009-03-08 02:00:00.0000000' AND '2010-11-01 02:00:00.0000000' THEN DATEADD(hh,5,CreationDate)
	WHEN YEAR(CreationDate) = 2010 AND CreationDate BETWEEN '2010-03-14 02:00:00.0000000' AND '2010-11-07 02:00:00.0000000' THEN DATEADD(hh,6,CreationDate)
	WHEN YEAR(CreationDate) = 2010 AND CreationDate NOT BETWEEN '2010-03-14 02:00:00.0000000' AND '2010-11-07 02:00:00.0000000' THEN DATEADD(hh,5,CreationDate)
	WHEN YEAR(CreationDate) = 2011 AND CreationDate BETWEEN '2011-03-13 02:00:00.0000000' AND '2011-11-06 02:00:00.0000000' THEN DATEADD(hh,6,CreationDate)
	WHEN YEAR(CreationDate) = 2011 AND CreationDate NOT BETWEEN '2011-03-13 02:00:00.0000000' AND '2011-11-06 02:00:00.0000000' THEN DATEADD(hh,5,CreationDate)
	WHEN YEAR(CreationDate) = 2012 AND CreationDate BETWEEN '2012-03-11 02:00:00.0000000' AND '2012-11-04 02:00:00.0000000' THEN DATEADD(hh,6,CreationDate)
	WHEN YEAR(CreationDate) = 2012 AND CreationDate NOT BETWEEN '2012-03-11 02:00:00.0000000' AND '2012-11-04 02:00:00.0000000' THEN DATEADD(hh,5,CreationDate)
	WHEN YEAR(CreationDate) = 2013 AND CreationDate BETWEEN '2013-03-10 02:00:00.0000000' AND '2013-11-04 02:00:00.0000000' THEN DATEADD(hh,6,CreationDate)
	WHEN YEAR(CreationDate) = 2013 AND CreationDate NOT BETWEEN '2013-03-10 02:00:00.0000000' AND '2013-11-04 02:00:00.0000000' THEN DATEADD(hh,5,CreationDate)
	WHEN YEAR(CreationDate) = 2014 AND CreationDate BETWEEN '2014-03-09 02:00:00.0000000' AND '2014-11-02 02:00:00.0000000' THEN DATEADD(hh,6,CreationDate)
	WHEN YEAR(CreationDate) = 2014 AND CreationDate NOT BETWEEN '2014-03-14 02:00:00.0000000' AND '2014-11-02 02:00:00.0000000' THEN DATEADD(hh,5,CreationDate)
	WHEN YEAR(CreationDate) = 2015 AND CreationDate BETWEEN '2015-03-08 02:00:00.0000000' AND '2015-11-01 02:00:00.0000000' THEN DATEADD(hh,6,CreationDate)
	WHEN YEAR(CreationDate) = 2015 AND CreationDate NOT BETWEEN '2015-03-08 02:00:00.0000000' AND '2015-11-01 02:00:00.0000000' THEN DATEADD(hh,5,CreationDate)
	WHEN YEAR(CreationDate) = 2016 AND CreationDate BETWEEN '2016-03-13 02:00:00.0000000' AND '2016-11-06 02:00:00.0000000' THEN DATEADD(hh,6,CreationDate)
	WHEN YEAR(CreationDate) = 2016 AND CreationDate NOT BETWEEN '2016-03-13 02:00:00.0000000' AND '2016-11-06 02:00:00.0000000' THEN DATEADD(hh,5,CreationDate)
	ELSE '2046-01-01 11:07:20.6500000'
	END
FROM Customers

Granting SSIS Package Administration Access to Developers

In many instances there is a development team or even a warehouse team that needs to run SSIS packages and you want to store those packages in SQL Server and run them through the SQL Agent Service.  You may not; however, want to grant those users/group sysadmin rights to the machine.  The following describes my experience in setting this up.

SSIS_DB1First, you must add the user/group to the DCOM Configuration for “Microsoft SQL Server Integration Services 11.0″ (SQL 2012), which can be found in the Component Services MMC.  Right click and choose properties.

 

 

SSIS_DB2You can now add the groups to two security sections–“Launch and Activation Permissions” and “Access Permissions”.  It was my experience I had to have them in both groups.  I granted full rights in each group.

The final component is to add each user/group to the local group “Distributed COM Users”.  It seems like it won’t even authenticate a user for the groups you set earlier unless they are in the local group.  This will allow users to connect the Integration Services Instance.SSIS_DB3

At this point you should restart the Integration Service services.

If you haven’t already, you can go ahead and create your Catalog Database.  We won’t go over those steps here–perhaps in another post.

The last step is to allow them to deploy and manage the packages on the servers.  I add the group to the SSISDB and grant the role of ssis_admin.  Now your teams should be able to function completely within the SSIS parameters and not have permissions to drop database objects or modify security settings.

SSIS_DB4

The Local Node is Not Able to Communicate With the WSFC Cluster

I was setting up an availability group in SQL Server 2012 on a pair of servers and came across the following error.  “the local node is not able to communicate with the wsfc cluster”  Interestingly enough, I had already installed an availability group on these two servers in another domain.  I was changing domains (long story) and had decommissioned the cluster and wanted to set it back up.  I knew I had already done the following

  • Installed the latest Service Pack (2)
  • Validated the cluster

The fix was simply to remove the Availability Group option, re-apply it and then restart the SQL Server Service.  After that, I was off and running.

LocalNodeCannotCommunicate

T-SQL Tuesday 59–My Hero

Today’s T-SQL TuesTsql Tuesdayday is being hosted by Tracy Mckibben (t|b) and he has invited us to talk about our heroes with it being Ada Lovelace Day and all.  As Ada is created with being the first programmer and this topic got me thinking about firsts in my family.

My grandmother came to the United States in the early sixties looking for a better life for her family.  She left behind four children who would join her over the next four years.  She worked as a maid to a family in Connecticut and earned $50 a week–$45 of which would go back to her family in Costa Rica.  Those efforts led the family here, where my father earned his bachelor’s degree from BYU and then later earned a masters from Clemson University; the first in the family.  She continued to work until her body would not let her and always encouraged us to do our best.  Her sacrifices those 55 years ago led to all the blessings my family now enjoys.  Grandma is one my heroes.

Of course, I would not be able to pursue independent employment as I know it today if it weren’t for my family–especially my wife who has supported me and my sometimes crazy whims.  I am grateful for their support and am glad I have a partner for all eternity. :)

Also, I need to give a shout out to Andy Leonard, who helped start the Richmond SQL Server Users Group.  Before we even knew what PASS was, Andy was there with a group of folks in Richmond talking shop and his even though he hasn’t had direct interaction with the group for some time, his influence is still felt and the core leadership team are involved because of Andy’s example.  The opportunity to belong to that group has been all the difference in what I have been able to do professionally.

Changes to the Identity Column

A recent upgrade to SQL 2012 reminded me of an issue most will face as they upgrade to the new version.  With the advent of sequences in SQL Server 2012, a change was made to the way identities are issued.  The short story is each time you restart the instances, your identities will increase by 1,000.  This is really only a big deal if

  1. You are close to the limit of an integer (2147483647) or
  2. These values are shown to the end users in your system and they wonder why there was a big spike.

Ahasan Habib has a good write-up of the issue, so I won’t recreate all his steps; however, the good news is there is a workaround for this.  Like always, make sure you test before you implement the change and hopefully you won’t have to answer the question–why is there a big gap in the numbers?  :)

SSPI handshake failed with error code 0x8009030c

The other day I was working in SSMS and connected to an instance.  Pretty normal there.  I later opened some window (I don’t recall exactly–perhaps a report or some db option) and was met with this error message.  I could then do nothing in the database.

SSPI handshake failed with error code 0x8009030c, state 14 while establishing a connection with integrated security; the connection has been closed. Reason: AcceptSecurityContext failed. The Windows error code indicates the cause of failure.  [CLIENT: 10.1.1.1].

This same error was found in the SQL Server log with the accompanying error message.

Error: 17806, Severity: 20, State: 14.

It turns out my Windows password had expired from the time I opened the instance to the time I was looking at something in the database.  Once I reset my password, I was good to go.