dsccommunity / SqlServerDsc

This module contains DSC resources for deployment and configuration of Microsoft SQL Server.
MIT License
361 stars 225 forks source link

SqlSetup: Existing TempDb log files stops setup.exe process without visible error #525

Closed crshnbrn66 closed 6 years ago

crshnbrn66 commented 7 years ago

if you run a dsc config and the configuration senses that the log files are present it halts the configuration and marks the configuration complete. But if you look at the log file the Process stopped because log files already exist. if you then delete the log files and re-run the DSC configuration. It installs properly.

(01) 2017-04-21 15:48:53 Slp: Received request to add the following file to Watson reporting: C:\Users\user\AppData\Local\Temp\tmp196A.tmp (01) 2017-04-21 15:48:53 Slp: The following is an exception stack listing the exceptions in outermost to innermost order (01) 2017-04-21 15:48:53 Slp: Inner exceptions are being indented (01) 2017-04-21 15:48:53 Slp: (01) 2017-04-21 15:48:53 Slp: Exception type: Microsoft.SqlServer.Chainer.Infrastructure.InputSettingValidationException (01) 2017-04-21 15:48:53 Slp: Message: (01) 2017-04-21 15:48:53 Slp: The tempdb database file tempdb.mdf already exists in P:\Apps\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Data. (01) 2017-04-21 15:48:53 Slp: HResult : 0x851a002e (01) 2017-04-21 15:48:53 Slp: FacilityCode : 1306 (51a) (01) 2017-04-21 15:48:53 Slp: ErrorCode : 46 (002e) (01) 2017-04-21 15:48:53 Slp: Data: (01) 2017-04-21 15:48:53 Slp: SQL.Setup.FailureCategory = InputSettingValidationFailure (01) 2017-04-21 15:48:53 Slp: DisableWatson = true (01) 2017-04-21 15:48:53 Slp: Stack:

Version of the Operating System, SQL Server and PowerShell the DSC Target Node is running: Microsoft Windows Server 2016 Datacenter

Major Minor Build Revision


10 0 14393 0
Name Value


PSVersion 5.1.14393.693
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.693
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

What module (SqlServer or SQLPS) and which version of the module the DSC Target Node is running: attempting to install sql server 2016

Version of the DSC module you're using, or 'dev' if you're using current dev branch: xSQLServerSetup xSQLServer 7.0.0.0

johlju commented 7 years ago

You wouldn't have the verbose logs from this run? Could you provide us with the configuration you were using?

You mean that it did not throw any error at all? At the end of the Set-TargetResource function it runs the Test-TargetResource function to validate that all features was installed. If not it will throw an error. You mean that it never throw an error?

crshnbrn66 commented 7 years ago

configuration: <# .EXAMPLE This example shows how to install a named instance of SQL Server on a single server, from an UNC path. .NOTES Assumes the credentials assigned to SourceCredential have read permission on the share and on the UNC path. The media will be copied locally, using impersonation with the credentials provided in SourceCredential, so that the SYSTEM account can access the media locally.

    SQL Server setup is run using the SYSTEM account. Even if SetupCredential is provided
    it is not used to install SQL Server at this time (see issue #139).

>

Configuration Install-Sql2016 { [CmdletBinding()] param ( [Parameter(Mandatory = $true)] [ValidateNotNullorEmpty()] [System.Management.Automation.PSCredential] [System.Management.Automation.Credential()] $SqlInstallCredential,

    [Parameter()]
    [ValidateNotNullorEmpty()]
    [System.Management.Automation.PSCredential]
    [System.Management.Automation.Credential()]
    $SqlAdministratorCredential = $SqlInstallCredential,

    [Parameter(Mandatory = $true)]
    [ValidateNotNullorEmpty()]
    [System.Management.Automation.PSCredential]
    [System.Management.Automation.Credential()]
    $SqlServiceCredential,

    [Parameter()]
    [ValidateNotNullorEmpty()]
    [System.Management.Automation.PSCredential]
    [System.Management.Automation.Credential()]
    $SqlAgentServiceCredential = $SqlServiceCredential
)

Import-DscResource -ModuleName xSQLServer
Import-DscResource –ModuleName 'PSDesiredStateConfiguration'
node PGVDVOSRS212D
{
    #region Install prerequisites for SQL Server
    WindowsFeature 'NetFramework35' {
       Name = 'NET-Framework-Core'
       Source = 'C:\Windows\WinSxS' # Assumes built-in Everyone has read permission to the share and path.
       Ensure = 'Present'
    }

    WindowsFeature 'NetFramework45' {
       Name = 'NET-Framework-45-Core'
       Ensure = 'Present'
    }
    #endregion Install prerequisites for SQL Server

    #region Install SQL Server
    xSQLServerSetup 'InstallNamedInstance-MSSQLSERVER'
    {
        InstanceName = 'MSSQLSERVER'
        Features = 'SQLENGINE,CONN,IS,BC,BOL,Tools'
        SQLCollation = 'SQL_Latin1_General_CP1_CI_AS'
        SQLSvcAccount = $SqlServiceCredential
        AgtSvcAccount = $SqlAgentServiceCredential
        ASSvcAccount = $SqlServiceCredential
        SQLSysAdminAccounts = 'company\Domain Database Admins', $SqlAdministratorCredential.UserName
        ASSysAdminAccounts = 'COMPANY\SQL Administrators', $SqlAdministratorCredential.UserName
        SetupCredential = $SqlInstallCredential
        InstallSharedDir = 'D:\Apps\Microsoft SQL Server'
        InstallSharedWOWDir = 'D:\Apps (x86)\Microsoft SQL Server'
        InstanceDir = 'D:\Apps\Microsoft SQL Server'
        InstallSQLDataDir = 'C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Data'
        SQLUserDBDir = 'M:\Apps\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Data'
        SQLUserDBLogDir = 'L:\Apps\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Data'
        SQLTempDBDir = 'P:\Apps\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Data'
        SQLTempDBLogDir = 'L:\Apps\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Log'
        SQLBackupDir = 'E:\Apps\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Backup'
        ASConfigDir = 'D:\Apps\Microsoft SQL Server\MSOLAP13.MSSQLSERVER\Config'
        ASDataDir = 'M:\Apps\Microsoft SQL Server\MSOLAP13.MSSQLSERVER\Data'
        ASLogDir = 'L:\Apps\Microsoft SQL Server\MSOLAP13.MSSQLSERVER\Log'
        ASBackupDir = 'E:\Apps\Microsoft SQL Server\MSOLAP13.MSSQLSERVER\Backup'
        ASTempDir = 'P:\Apps\Microsoft SQL Server\MSOLAP13.MSSQLSERVER\Temp'
        SourcePath = '\\server\dba\Microsoft SQL Server\2016'
        SourceCredential = $SqlInstallCredential
        UpdateEnabled = 'False'
        ForceReboot = $false
        BrowserSvcStartupType = 'Automatic'

        DependsOn = '[WindowsFeature]NetFramework35','[WindowsFeature]NetFramework45'
    }
    #endregion Install SQL Server
}

} $password = 'Password'| ConvertTo-SecureString -AsPlainText -Force $credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList 'company\username', $password $ConfigurationData = @{ AllNodes = @( @{ NodeName = "*" PSDscAllowPlainTextPassword = $true PSDscAllowDomainUser = $true InstallerServiceAccount = "company\username" AdminAccount = "company\username" } @{ NodeName = "DBServer1" SQLServers = @( @{ InstanceName = "MSSQLSERVER" } ) }

)

} $InstallerServiceAccount = $credential # Get-Credential "company\username"

run from command line:

Install-Sql2016 -ConfigurationData $ConfigurationData -PsDscRunAsCredential $credential -SqlInstallCredential $credential -SqlAdministratorCredential $credential -SqlServiceCredential $credential -SqlAgentServiceCredential $credential Start-DscConfiguration -Path .\SQLInstall -Verbose -Wait -Force

Log is attached

Detail.txt

johlju commented 6 years ago

I can see the error you mention in the logs.

01) 2017-04-21 15:39:45 Slp: Validation for setting 'SQLTEMPDBDIR' failed. Error message: The tempdb database file tempdb.mdf already exists in P:\Apps\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Data.
(01) 2017-04-21 15:39:45 Slp: Validation for setting 'TEMPDBDATADIRECTORIES' failed. Error message: The tempdb database file tempdb.mdf already exists in P:\Apps\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Data.
(01) 2017-04-21 15:39:45 Slp: Validation for setting 'SQLTEMPDBLOGDIR' failed. Error message: The tempdb database file templog.ldf already exists in p:\Apps\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Data.
(01) 2017-04-21 15:39:45 Slp: Validation for setting 'TEMPDBLOGDIRECTORY' failed. Error message: The tempdb database file templog.ldf already exists in p:\Apps\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Data.
...
(01) 2017-04-21 15:39:48 Slp:     Message: 
(01) 2017-04-21 15:39:48 Slp:         The tempdb database file tempdb.mdf already exists in P:\Apps\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Data.
(01) 2017-04-21 15:39:48 Slp:     HResult : 0x851a002e
(01) 2017-04-21 15:39:48 Slp:         FacilityCode : 1306 (51a)
(01) 2017-04-21 15:39:48 Slp:         ErrorCode : 46 (002e)

The summary.txt would have shown this error.

This looks like the same problem as in issues #406, that we can't catch the error stream. Let's track the issue there. Closing this issue.