Install & Configure SharePoint 2013 with SQL Client Alias

* Though this topic is very simple and highly recommended approach in the enterprise deployments, I have seen many deployments which are not following this approach. E.g.: Using SQL client alias for SharePoint installations will be really useful if you want move all databases to another SQL Server by just making alias change point to the new SQL server.

* In this post I’m going to cover how we can install & configure SharePoint 2013 Preview with SQL Client Alias. Though this post is talking about SharePoint 2013 preview, the underlying concept will be same for SharePoint 2010 & SharePoint 2013 RTM.

* In my test lab, I have total four virtual machines configured. This post is based on a SharePoint small server farm for setup and proof of concept. I will refer to this same environment in my future blog posts, there will be more servers adding to the existing server farm.

litdc : is the domain controller and AD server (domain : litware.local), this machine is installed with Windows 2008 R2 + SP1

litsql1 : is the SQL server machine which is installed with SQL Server 2012 RTM with Windows 2012 Server Release Candidate.

litsp1 : is the one of the SharePoint Servers, I’m configuring this server with WFE role. This server is installed with SharePoint Server 2013 Preview with Windows 2012 Server Release Candidate.

litsp3 : is the one of the SharePoint Servers, I’m configuring this server with Application role (central administration and other services). This server is installed with SharePoint Server 2013 Preview with Windows 2012 Server Release Candidate. Name of the server is litsp3 as I’m planning to add one more SharePoint Server litsp2 to with WFE layer later. 

In this post I’m only concentrating on the part of configuring SharePoint Servers with SQL Client Alias.

# Step 1

To harden the security for SQL server it is highly recommend to install SQL Server with named instance with custom port and block all default SQL specific ports. So, that is our first step to consider while setting up the SQL Server.

While installing the SQL Server in litsql1 server I have installed it with named instance “litsql1sql1”.

* After the installation of SQL Server with named instance, we have to assign a custom static port number for the SQL Service. You can do this in “SQL Server Configuration Manager”. 

* We have to configure it by taking the TCP/IP properties of “Protocols for SQL1 (SQL1 instance name)”. By default, whenever we install SQL Server with named instance it will assign a “TCP Dynamic Port”, we have to clear it out in the same location (just before TCP Port).

After doing the above step, we have to restart the “SQL Server Service” to use the newly assigned port.

To confirm the usage of the new port, you can either look at the SQL Server Logs in the SQL Server Managements studio or can look at the windows application event logs directly.

# Step 2

Once the above port validation is over the next important step is  open the custom port for In bound connections if you have firewall enabled. Just need to create a new Inbound Rule for allowing connections for the custom port, in my case it is  “65000”

# Step 3

Alright, now we can go to SharePoint side. 

* In my case there are two SharePoint Servers to be configured, one WFE – litsp1 and one Application Server – litsp3.

* Since I’m going to host central administration in litsp3

* I’m going to configure this server first. Main configuration needs only before running the PSConfig. * I have installed SharePoint 2013 Preview in both of these servers initially.

Before running the PSConfig , we have to configure the SQL Client Alias. There will be two versions of cliconfig in 64 bit operating system.

C:WindowsSystem32cliconfg.exe  – 64 bit version of cliconfig.exe

C:WindowsSysWOW64cliconfig.exe – 32 bit version of cliconfig.exe

SharePoint 2010 & 2013 are 64 based so we have to configure the 64 bit version of cliconfig.

C:WindowsSystem32cliconfg.exe

* In my test case I have created alias “spsql” with network library type “TCP/IP” (don’t use named pipes).
 
* In the Server Name textbox we have to give the SQL Server name (litsql1) and then uncheck the “Dynamically determine port” option and give the custom port number, in my case “65000”. After saving the changes you can validate the registry settings to make sure that it is applied correctly.

# Step 4

* At this point we are good to run SharePoint PSConfig and provision a new server farm.

* While creating a new farm, provide the SQL Client Alias “spsql” instead of the the SQL Server Instance name “litsql1sql1”.

* After finishing the PSCofig tasks, central administration site will be provisioned the SQL Server name will be used as “spsql”. 
* To connect other servers to the SharePoint farm we have to repeat step #3 in all servers. In my test lab I have one more server to be added to the same farm.

 

Configure SQL Mirroring sharepoint

There are 3 different types of SQL Mirroring options available for use:

  1. High Performance – Asynchronous (this requires the Enterprise Edition)
  2. High Safety without Automatic Failover

  3. High Safety with Automatic Failover (this requires a witness server running the same SQL version)

All three require roughly the same steps:

a.Ensure the same login accounts are present on the Principal and the Mirror
b. Backup the Principal DB and Logs
c. Restore on the Mirror
d. Configure the Mirroring Endpoints
e. Set the partner on the Mirror
f. Set the partner on the Principal (and the witness if necessary)

So lets work through the steps above……

Get our login’s in order

To get our accounts in order between our two servers we can run the following SQL script to give us an output to run on our mirror.

SELECT ‘create login [‘ + p.name + ‘] ‘ + case when p.type in(‘U’,’G’) then ‘from windows ‘ else ” end + ‘with ‘ + case when p.type = ‘S’ then ‘password = ‘ + master.sys.fn_varbintohexstr(l.password_hash) + ‘ hashed, ‘ + ‘sid = ‘ + master.sys.fn_varbintohexstr(l.sid) + ‘, check_expiration = ‘ + case when l.is_policy_checked > 0 then ‘ON, ‘ else ‘OFF, ‘ end + ‘check_policy = ‘ + case when l.is_expiration_checked > 0 then ‘ON, ‘ else ‘OFF, ‘ end + case when l.credential_id > 0 then ‘credential = ‘ + c.name + ‘, ‘ else ” end else ” end + ‘default_database = ‘ + p.default_database_name + case when len(p.default_language_name) > 0 then ‘, default_language = ‘ + p.default_language_name else ” end FROM sys.server_principals p LEFT JOIN sys.sql_logins l ON p.principal_id = l.principal_id LEFT JOIN sys.credentials c ON  l.credential_id = c.credential_id WHERE p.type in(‘S’,’U’,’G’) AND p.name <> ‘sa’ AND p.name NOT LIKE ‘##%’

Once executed run the output on the mirror server to create all the logins.

Backup the Primary and Restore on the mirror

We can run the below script on primary to take a file and log backup of all our user databases

DECLARE @name VARCHAR(4000) — database name DECLARE @path VARCHAR(4000) — path for backup files  DECLARE @fileName VARCHAR(4000) — filename for backup  DECLARE @logfileName VARCHAR(4000) — logfilename for backup  DECLARE @fileDate VARCHAR(20) — used for file name declare @sql nvarchar(4000)     SET @path = ‘C:SQLbackups’

SELECT @fileDate = ‘InitialMirror’

DECLARE db_cursor CURSOR FOR  SELECT name FROM master.dbo.sysdatabases WHERE name NOT IN (‘master’,’model’,’msdb’,’tempdb’)  –WHERE name NOT IN (‘master’,’model’,’msdb’,’tempdb’,’INCLUDE YOUR DB’s)’

CREATE TABLE #TEMPRESTORE ( CMD VARCHAR(400) ) OPEN db_cursor   FETCH NEXT FROM db_cursor INTO @name;        WHILE @@FETCH_STATUS = 0   BEGIN          SET @fileName = @path + @name + ‘’ + @fileDate + ‘.BAK’         SET @logfileName = @path + @name + ‘’ + @fileDate + ‘_Log.BAK’                              SET @sql = ‘ALTER DATABASE “‘ + @name + ‘” SET RECOVERY FULL’         exec sys.sp_executesql @sql;

BACKUP DATABASE @name TO DISK = @fileName with format;         BACKUP log @name TO DISK = @logfileName with format;                 INSERT INTO #TEMPRESTORE VALUES (‘RESTORE DATABASE “‘+@name+’”        FROM DISK = ”’+@fileName+”’ WITH NORECOVERY’)        INSERT INTO #TEMPRESTORE VALUES (‘go’)        INSERT INTO #TEMPRESTORE VALUES (‘RESTORE LOG “‘+@name+’”        FROM DISK = ”’+@logfileName+”’ WITH NORECOVERY’)          INSERT INTO #TEMPRESTORE VALUES (‘go’)        FETCH NEXT FROM db_cursor INTO @name   END

CLOSE db_cursor   DEALLOCATE db_cursor SELECT * FROM #TEMPRESTORE DROP TABLE #TEMPRESTORE

The output of this script will provide you with the restore commands to run on your mirror.  Just make sure you copy all the SQL backup files from the location specifed at the top of the script to the exact same location on your mirror.

Configure the mirror endpoints and setting up the mirror

Right click on a database you want to mirror

sql tasks mirror

sql tasks mirror

configuring database mirroring secirity wizard

configuring database mirroring secirity wizard

include withness server Database Mirroring

include withness server Database Mirroring

choose server to configure sqlmirror

choose server to configure sqlmirror

principal server instance sqlmirror

principal server instance sqlmirror

mirror server instance sqlmirror

mirror server instance sqlmirror

withness server instance sqlmirror

withness server instance sqlmirror

service account sqlmirror mirror

service account sqlmirror mirror

configuring endpoints sqlmirror

configuring endpoints sqlmirror

finish sqlmirror

finish sqlmirror

Configure further databases to mirror

You can either carryout the wizard above again or run the following script on the mirror.

DECLARE @name VARCHAR(4000) — database name  DECLARE @sql nvarchar(4000) DECLARE @mirrorendpoint varchar(4000)

SET @mirrorendpoint =’TCP://primaryserverFQDN:5022′ SET @name = ‘DatabaseNameToMirror’

SET @sql = ‘ALTER DATABASE “‘ + @name + ‘” SET PARTNER = ”’+@mirrorendpoint+”” exec sys.sp_executesql @sql;

then run this on the primary

DECLARE @name VARCHAR(4000) — database name

DECLARE @sql nvarchar(4000)

DECLARE @mirrorendpoint varchar(4000)

DECLARE @witnessendpoint varchar(4000)

SET @mirrorendpoint =’TCP://yourmirrorFQDN:5022′

SET @witnessendpoint =’TCP://yourwitnessFQDN:5022′

SET @name = ‘DatabaseNameToMirror’

SET @sql = ‘ALTER DATABASE “‘ + @name + ‘” SET PARTNER = ”’+@mirrorendpoint+”” exec sys.sp_executesql @sql; SET @sql = ‘ALTER DATABASE “‘ + @name + ‘” SET WITNESS = ”’+@witnessendpoint+”” exec sys.sp_executesql @sql;

CA MSG:rsCustomAction.exe failed to configure Error code 1 sharepoint SSRS Addin fails

While configuring SharePoint Server Reporting Services (SSRS) at my client, I had a really strange problem on one of the farms… I couldn’t get the SSRS Addin to install. I tried rebooting, repairing but nothing. After digging out in the logs, I found this funny error message:

CA MSG : rsCustomAction.exe failed to configure, Error code is: 1

CustomAction RSSP_CAInstall_64 returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)

ca msg-:rscustomaction exe failed to configure error code 1

ca msg-:rscustomaction exe failed to configure error code 1 Also, for the information I was running SQL 2012 SP1 + Windows Server 2012 R2. You might also see something like this in the logs:


Also, for the information I was running SQL 2012 SP1 + Windows Server 2012 R2. You might also see something like this in the logs:
CA MSG:rsCustomAction.exe failed to configure Error code 1

CA MSG:rsCustomAction.exe failed to configure Error code 1

Long Story Short, after a lot of googling and asking for help from SQL & SharePoint masters, I found out that the bug is because I had a line commented in the web.config file of a web application. As strange as this may sound, after deleting the commented line, the install went through perfectly. I couldn’t find any official documentation on this, so if this worked for you please share it in the comments!

Drop a comment if this helped!