AKN420658

Monitor_AKN420658 (UnitMonitor)

Cross-database ownership chaining has been disabled on the rtcdyn database

Knowledge Base article:

External

http://go.microsoft.com/fwlink/?LinkId=266330

Element properties:

TargetMicrosoft.KnowledgeServices.Lync.2010.CentralMgmtDatabase
Parent MonitorSystem.Health.ConfigurationState
CategoryAlert
EnabledTrue
Alert GenerateTrue
Alert SeverityError
Alert PriorityHigh
Alert Auto ResolveTrue
Monitor TypeMicrosoft.KnowledgeServices.Library.PowerShellMonitorEx
RemotableTrue
AccessibilityPublic
Alert Message
Cross-database ownership chaining has been disabled on the rtcdyn database
<Details>
<Content>The cross-database ownership chaining option has been disabled for the rtcdyn database. If this setting is disabled the Front End Service will fail to start on your Lync Server. Please refer to the following KB article for more information.</Content>
<CollectedInformation />
</Details>
RunAsMicrosoft.KnowledgeServices.ElevatedAccount
CommentSupportTopic=TBD;VersionNumber=1.0.0.0;

Source Code:

<UnitMonitor ID="Monitor_AKN420658" Comment="SupportTopic=TBD;VersionNumber=1.0.0.0;" Accessibility="Public" Enabled="true" Target="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.CentralMgmtDatabase" ParentMonitorID="Health!System.Health.ConfigurationState" Remotable="true" Priority="High" RunAs="KnowledgeServicesLibrary!Microsoft.KnowledgeServices.ElevatedAccount" TypeID="KnowledgeServicesLibrary!Microsoft.KnowledgeServices.Library.PowerShellMonitorEx" ConfirmDelivery="true">
<Category>Alert</Category>
<AlertSettings AlertMessage="MonitorMessagec48ad6c30c8d4044ba4071e0673f31ff">
<AlertOnState>Error</AlertOnState>
<AutoResolve>true</AutoResolve>
<AlertPriority>High</AlertPriority>
<AlertSeverity>Error</AlertSeverity>
</AlertSettings>
<OperationalStates>
<OperationalState ID="Success" MonitorTypeStateID="Success" HealthState="Success"/>
<OperationalState ID="Error" MonitorTypeStateID="Error" HealthState="Error"/>
</OperationalStates>
<Configuration>
<ScriptName>AKN420658.ps1</ScriptName>
<Parameters>
<Parameter>
<Name>SQLInstanceName</Name>
<Value>$Target/Property[Type="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.CentralMgmtDatabase"]/sqlinstancename$</Value>
</Parameter>
<Parameter>
<Name>PoolFQDN</Name>
<Value>$Target/Property[Type="MicrosoftKnowledgeServicesLyncLibrary!Microsoft.KnowledgeServices.Lync.2010.CentralMgmtDatabase"]/poolFQDN$</Value>
</Parameter>
</Parameters>
<ScriptBody><Script>


param($SQLInstanceName,$PoolFQDN)

$ErrorActionPreference = "Stop"

# Set up the arguments
$scriptargs = new-object psobject
$scriptargs | add-member NoteProperty "SQLInstanceName" $SQLInstanceName
$scriptargs | add-member NoteProperty "PoolFQDN" $PoolFQDN

# Set up the output
$global:scriptoutput = new-object psobject
$scriptoutput | add-member NoteProperty "HasIssue" $false
#-----------------------------------------------------
# MAIN CODE SECTION
#-----------------------------------------------------
$scriptenv = New-Object psobject
$scriptenv | Add-Member NoteProperty "RuntimeError" $false
$scriptenv | Add-Member NoteProperty "HasIssue" $false

function DetectDbChaining()
{
$SQL = $scriptargs.PoolFQDN
$SQLInst = $scriptargs.SQLInstanceName

$connString = "Server=" + $SQL.ToString() + "\" + "$SQLInst" + ";" + "Database=master;Integrated Security=true"
if($SQLInst -ieq "")
{
$connString = "Server=" + $SQL.ToString()+ ";Database=master;Integrated Security=true"
}

$oConnection = New-Object System.Data.SqlClient.SqlConnection
$oConnection.ConnectionString = $connString
$oConnection.Open()
$oSQLCommand = New-Object System.Data.SqlClient.SqlCommand
$oSQLCommand.CommandText = "select is_db_chaining_on, name from sys.databases where name = 'rtcdyn'"
$oSQLCommand.Connection = $oConnection
$oSqlReader = $oSQLCommand.ExecuteReader()
If($oSqlReader.HasRows)
{
while ($oSqlReader.Read())
{
$dbChainingStatus = $oSqlReader["is_db_chaining_on"]
if ($dbChainingStatus -eq 0)
{
#Raise Alert
$ScriptEnv.HasIssue = $true
break;
}
}
}
$oSqlReader.Close()
$oConnection.Close()
}

# Main Function
function AdvisorRule($scriptargs, $scriptoutput)
{
if ($script:lyncPSVer -eq 2010)
{
trap [Exception]
{
$scriptenv.RuntimeError = $true
continue
}

$scriptoutput.HasIssue = $false

DetectDbChaining

if($scriptenv.HasIssue -eq $true -and $scriptenv.RuntimeError -eq $false)
{
$scriptoutput.HasIssue = $true
}
}
}
AdvisorRule $scriptargs $scriptoutput

# set the output
$mom = new-object -comobject "MOM.ScriptAPI"
$bag = $mom.CreatePropertyBag()

if ($scriptoutput.HasIssue -ne $null)
{
$bag.AddValue("HasIssue", $scriptoutput.HasIssue)
}

$bag

</Script></ScriptBody>
<SnapIns/>
<TimeoutSeconds>300</TimeoutSeconds>
<Schedule>15300</Schedule>
<ErrorExpression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="Boolean">Property[@Name='HasIssue']</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="Boolean">true</Value>
</ValueExpression>
</SimpleExpression>
</ErrorExpression>
<SuccessExpression>
<Not>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="Boolean">Property[@Name='HasIssue']</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="Boolean">true</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</Not>
</SuccessExpression>
</Configuration>
</UnitMonitor>