Posts

Showing posts from April, 2013

SQL2008R2: Error-Model database ldf file missing- Database 'model' cannot be opened due to inaccessible files or insufficient memory or disk space.

Image
While trying to restart SQL service, I am getting the below error message.
Then I had a look in the error log file. (Refer below section)
2013-03-14 10:56:06.95 ServerMicrosoft SQL Server 2008 R2 (RTM) - 10.50.1600.1 (Intel X86) Apr2 2010 15:53:02 Copyright (c) Microsoft Corporation Developer Edition on Windows NT 5.1 <X86> (Build 2600: Service Pack 3)
2013-03-14 10:56:06.95 Server(c) Microsoft Corporation. 2013-03-14 10:56:06.95 ServerAll rights reserved. 2013-03-14 10:56:06.95 ServerServer process ID is 26684. 2013-03-14 10:56:06.95 ServerAuthentication mode is MIXED. 2013-03-14 10:56:06.95 ServerLogging SQL Server messages in file 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQL2008R2\MSSQL\Log\ERRORLOG'. 2013-03-14 10:56:06.95 ServerThis instance of SQL Server last reported using a process ID of 16596 at 14/03/2013 10:55:54 (local) 14/03/2013 10:55:54 (UTC). This is an informational message only; no user action is required. 2013-03-14 10:56:06.96 ServerRegistry startup pa…

SQL2008R2: License Key of an SQL Server instance by Powershell

Image
Step1: Navigate to the Powershell by Right Click SQL Server ->Start Powershell.
Step2: Then write the below function in the Powershell.
function Get-SQLserverKey { param ($targets = ".") $hklm = 2147483650 $regPath = "SOFTWARE\Microsoft\Microsoft SQL Server\100\Tools\Setup" $regValue1 = "DigitalProductId" $regValue2 = "PatchLevel" $regValue3 = "Edition" Foreach ($target in $targets) { $productKey = $null       $win32os = $null $wmi = [WMIClass]"\\$target\root\default:stdRegProv" $data = $wmi.GetBinaryValue($hklm,$regPath,$regValue1) [string]$SQLver = $wmi.GetstringValue($hklm,$regPath,$regValue2).svalue [string]$SQLedition = $wmi.GetstringValue($hklm,$regPath,$regValue3).svalue $binArray = ($data.uValue)[52..66] $charsArray = "B","C","D","F","G","H","J","K","M","P","Q","R","T","V",&qu…