Archive for ‘SQL Server 2012’

December 8, 2013

SQL Database State stuck in Restoring

Suddenly one of the production SharePoint site in one of our client site was down. When tried to browse the site was getting the error “Cannot connect to the configuration database. So i logged into the database server and was able to see the following: probsOne of the database was get stucked in the restoring mode. The rest of the databases was in the mode of restoring. I was waiting for more than one hour to let the restoring process get finish and unfortunately nothing happened. 😦

So the resolution is to:

Execute the following command in any case if your database get stucked at the time of restoring:

RESTORE DATABASE [DATABASENAME] WITH RECOVERY;

Once i execute the above i was getting the following error:

Msg 3104, Level 16, State 1, Line 1
RESTORE cannot operate on database ‘kiainternet01’ because it is configured for database mirroring. Use ALTER DATABASE to remove mirroring if you intend to restore the database.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.

i didn’t aware the above database is configured for mirroring. So i had to switch off the mirroring temporarily using the following command:

ALTER DATABASE [DATABASENAME] SET PARTNER OFF;

upon that executed the following command:

RESTORE DATABASE [DATABASENAME] WITH RECOVERY;

finally the databases were online :

final

October 27, 2013

SQL Server Client Network Utitily

If you are working with a number of SQL Server instances or have really complex server/instance names, its good to use aliases with easy naming conventions. The same can be used to connect to SQL Server instancess. For you to create these aliases you can use the SQL Server Client Network utitily programs (cliconfg). Aliases would secure the real instance names of the SQL Server in any case if its exploited by an external hacker.

cliconfg

Launch “cliconfg” by Start > Run > CliConfg. Then go to Alias tab and click the add button to add the alias.

October 27, 2013

AppFabric installation failed because installed MSI returned with error code: 1603

I was getting the below error at the time of running the pre-requistes for a fresh installation of Sharepoint 2013 and SQL Server 2012. Rest of the prerequisites are getting installed without any problem but only the app fabric instllation getting failed. When i check the logs (AppServerSetup1_1_CustomActions(2013-10-27 11-09-45).log) located under path C:\Users\<username>\AppData\Local\Temp and was able to find the below:

27/10/2013 10:38:47 EXEPATH=powershell.exe PARAMS=-command “$content = Get-Content \”c:\Program Files\AppFabric 1.1 for Windows Server\\AppFabricServer.xml\”; $content = ForEach-Object -InputObject $content { $_ -replace \”INSTALLPATH\”, \”c:\Program Files\AppFabric 1.1 for Windows Server\\\” }; Set-Content -value $content -path \”c:\Program Files\AppFabric 1.1 for Windows Server\\AppFabricServer.xml\” ” LOGFILE=C:\Users\mssadmin\AppData\Local\Temp\AppServerSetup1_1_CustomActions(2013-10-27 10-38-40).log
ExitCode=0
27/10/2013 10:38:48 EXEPATH=powershell.exe PARAMS=-command “$content = Get-Content \”c:\Program Files\AppFabric 1.1 for Windows Server\\Consolidator.xml\”; $content = ForEach-Object -InputObject $content { $_ -replace \”INSTALLPATH\”, \”c:\Program Files\AppFabric 1.1 for Windows Server\\\” }; Set-Content -value $content -path \”c:\Program Files\AppFabric 1.1 for Windows Server\\Consolidator.xml\” ” LOGFILE=C:\Users\mssadmin\AppData\Local\Temp\AppServerSetup1_1_CustomActions(2013-10-27 10-38-40).log
ExitCode=0
Executing action : Microsoft.ApplicationServer.InstallHelper.SQMTaskInstallAction
SQMTaskInstall areguments –  /create /tn “\Microsoft\Windows\AppFabric\Customer Experience Improvement Program\Consolidator” /xml “c:\Program Files\AppFabric 1.1 for Windows Server\Consolidator.xml”
Output: SUCCESS: The scheduled task “\Microsoft\Windows\AppFabric\Customer Experience Improvement Program\Consolidator” has successfully been created.
27/10/2013 10:38:50 EXEPATH=c:\Windows\system32\\sc.exe PARAMS=privs AppFabricCachingService SeChangeNotifyPrivilege LOGFILE=C:\Users\mssadmin\AppData\Local\Temp\AppServerSetup1_1_CustomActions(2013-10-27 10-38-40).log
Output: [SC] ChangeServiceConfig2 SUCCESS
ExitCode=0
27/10/2013 10:38:50 EXEPATH=c:\Windows\system32\\sc.exe PARAMS=sidtype AppFabricCachingService unrestricted LOGFILE=C:\Users\mssadmin\AppData\Local\Temp\AppServerSetup1_1_CustomActions(2013-10-27 10-38-40).log
Output: [SC] ChangeServiceConfig2 SUCCESS
ExitCode=0
27/10/2013 10:38:50 EXEPATH=c:\Windows\system32\\netsh.exe PARAMS=advfirewall firewall add rule enable=no profile=any dir=in action=allow description=”@c:\Program Files\AppFabric 1.1 for Windows Server\ApplicationServerResources.dll,-203″ name=”@c:\Program Files\AppFabric 1.1 for Windows Server\ApplicationServerResources.dll,-202″ protocol=TCP program=”c:\Program Files\AppFabric 1.1 for Windows Server\DistributedCacheService.exe” LOGFILE=C:\Users\mssadmin\AppData\Local\Temp\AppServerSetup1_1_CustomActions(2013-10-27 10-38-40).log
Output: Ok.
ExitCode=0
27/10/2013 10:38:51 EXEPATH=c:\Windows\system32\\netsh.exe PARAMS=advfirewall firewall add rule enable=no profile=any dir=out action=allow description=”@c:\Program Files\AppFabric 1.1 for Windows Server\ApplicationServerResources.dll,-207″ name=”@c:\Program Files\AppFabric 1.1 for Windows Server\ApplicationServerResources.dll,-206″ protocol=TCP program=”c:\Program Files\AppFabric 1.1 for Windows Server\DistributedCacheService.exe” LOGFILE=C:\Users\mssadmin\AppData\Local\Temp\AppServerSetup1_1_CustomActions(2013-10-27 10-38-40).log
Output: Ok.
ExitCode=0
Executing action : Microsoft.ApplicationServer.InstallHelper.FirewallExceptionAction
27/10/2013 10:38:51 EXEPATH=powershell.exe PARAMS=-command “$str = [System.Environment]::GetEnvironmentVariable(\”PSModulePath\”, [System.EnvironmentVariableTarget]::Machine); $str = $str+\”;c:\Program Files\AppFabric 1.1 for Windows Server\PowershellModules\”; c:\Windows\system32\setx.exe /M PSModulePath \”$str\”” LOGFILE=C:\Users\mssadmin\AppData\Local\Temp\AppServerSetup1_1_CustomActions(2013-10-27 10-38-40).log
Error: ERROR: Invalid syntax. Default option is not allowed more than ‘2’ time(s).
Error: Type “SETX /?” for usage.
ExitCode=1
27/10/2013 10:38:54 EXEPATH=c:\Windows\system32\\netsh.exe PARAMS=advfirewall firewall delete rule name=”@c:\Program Files\AppFabric 1.1 for Windows Server\ApplicationServerResources.dll,-206″ LOGFILE=C:\Users\mssadmin\AppData\Local\Temp\AppServerSetup1_1_CustomActions(2013-10-27 10-38-40).log
Output: Deleted 1 rule(s).
Output: Ok.
ExitCode=0
27/10/2013 10:38:54 EXEPATH=c:\Windows\system32\\netsh.exe PARAMS=advfirewall firewall delete rule name=”@c:\Program Files\AppFabric 1.1 for Windows Server\ApplicationServerResources.dll,-202″ LOGFILE=C:\Users\mssadmin\AppData\Local\Temp\AppServerSetup1_1_CustomActions(2013-10-27 10-38-40).log
Output: Deleted 1 rule(s).
Output: Ok.
ExitCode=0
Executing action : Microsoft.ApplicationServer.InstallHelper.SQMTaskUninstallAction
Output: SUCCESS: The scheduled task “\Microsoft\Windows\AppFabric\Customer Experience Improvement Program\Consolidator” was successfully deleted.

based on the above error log could notice that ” is getting amended to the PSModulePath path. So for this what you have to do is to remove that ” from the PSModulePath enviornmentabl variable.

envvvariable

references:

http://social.msdn.microsoft.com/Forums/vstudio/en-US/8cf55972-e441-4107-8c0d-1692ad03213d/error-with-installation-of-appfabric-11-on-psmodulepath?forum=velocity

http://social.msdn.microsoft.com/Forums/sharepoint/ja-JP/290ff740-d8f1-426c-b7f0-1152dc481779/appfabric-installation-failed-because-installer-msi-returned-with-error-code-1603?forum=sharepointgeneralprevious

http://social.msdn.microsoft.com/Forums/vstudio/en-US/8338a53e-6b4f-44a8-ac7b-a287f3b4b20e/installation-problem-msi-error-1603-win-7-x64-appfabric-11?forum=velocity

http://support.microsoft.com/kb/310519/en-us

October 1, 2013

Restore-SPSite : 0x80070003

I was restoring a SharePoint site from a lab environment to Production.  This is one of the frequently used powershell commands that we use in addition to the Backup-SPSite.

Restore-SPSite http://ggvstg01:12160/discussionforum/GeneralDiscussi

-Path C:\Users\user\Desktop\Backup\GeneralDiscussion.bak –Force

Come on man, was worried to see the below error.

**Restore-SPSite : 
<nativehr>0x80070003</nativehr>
<nativestack></nativestack>
At line:1 char:1
2

So started to search on this error hence this is the first time I saw this error. Some posts says its related to managed path issue, advice us to check the managed path in both the environments. I checked, so in my case its nothing to do with the managed paths Hence the site had only one root site collection. In some post it says the SharePoint versions are different. I thought this might be correct hence in my lab environment it was the SharePoint enterprise version with the trial license. But in production it was the SharePoint Enterprise. Suddenly I thought of checking the SharePoint logs and the event viewer. I couldn’t see any specific error in the Share Point logs. Then moved to check on the Event Viewer. Ohhhh man, it was something related to the login which I used to execute the power shell command “insufficient SQL Database permission for user named domainaame\username”.

3

Finally logged into the SQL Server and applied the above said user the “sysadmin”permission and executed the restore command without any issue. 😀