Category Archives: SQL Server Errors

Set Database File Permissions to SQL Server Service Account with PowerShell Script

When you change the SQL Server Account or attach Database Files from another computer you may notice the Access Denied error message in SQL Server Management Studio.

To overcome this issue, you may run the following Power Shell script to add the SQL Service User and a userdefined Local Admins Group to each single .mdf, .ldf, .ndf file. Manually setting permissions via Windows Explorer on the parent directory does not change the permissions for each file within.

It might be required to run he Script with elevated Administrative Rights.

function GetFiles($path, [string[]]$exclude) 
{ 
    foreach ($item in Get-ChildItem $path)
    {
        if ($exclude | Where {$item -like $_}) { continue }

        if (Test-Path $item.FullName -PathType Container) 
        {
            $item.FullName
            GetFiles $item.FullName $exclude
        } 
        else 
        { 
            $item.FullName
        }
    } 
}

function SetPermissions($file)
{
    if ($file -like "*.mdf" -or $file -like "*.ndf" -or $file -like "*.ldf" -or $file -like "*.ndf*")
    {
        $acl = Get-Acl $file
        $AccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule("{YOURDOMAIN}\{SQLSERVERDATABASEENGINESERVICEACCOUNT}","FullControl","Allow")
        $acl.SetAccessRule($AccessRule)
        $acl | Set-Acl $file

        $acl = Get-Acl $file
        $AccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule("{LOCALSERVER}\{LOCALSERVERADMINSGROUP}","FullControl","Allow")
        $acl.SetAccessRule($AccessRule)
        $acl | Set-Acl $file
    }
    else 
    {
        $file
    }
}

# First Directory to iterate recursively...
foreach ($file in GetFiles("G:\DWH"))
{
    SetPermissions($file)
}

# Second Directory to iterate recursively...
foreach ($file in GetFiles("P:\DWH"))
{
    SetPermissions($file)
}

SSIS Error: 0xc001000e The connection manager “” is not found.

Solution:

If your .dtsx XML file (search for LogProv) does not contain the tag “DTS:ConfigString=“, you missed to populate the Connection Configuration DropDown in the Logging-Wizard dialog:

<DTS:LogProviders>
    <DTS:LogProvider
      DTS:ConfigString="CON_DWH"
      DTS:CreationName="Microsoft.LogProviderSQLServer"
      DTS:Description="Schreibt Protokolleinträge für Ereignisse in eine SQL Server-Datenbank."
      DTS:DTSID="{9FE46402-8C22-49AB-887C-056C89DD00CE}"
      DTS:ObjectName="SSIS-Protokollanbieter für SQL Server">
      <DTS:ObjectData>
        <InnerObject />
      </DTS:ObjectData>
    </DTS:LogProvider>
  </DTS:LogProviders>

Fehler im OLAP-Speichermodul: Ein doppelter Attributschlüssel wurde bei der Verarbeitung gefunden

Fehler im OLAP-Speichermodul: Ein doppelter Attributschlüssel wurde bei der Verarbeitung gefunden:
Tabelle: TABELLE,
Spalte: SPALTENNAMEINTABELLE,
Wert: 0.
Das Attribut ist ‘ATTRIBUTENAMEINDIMENSION‘.

Mögliche Lösung:

Gehe zu ATTRIBUTENAMEINDIMENSION und entferne die Name-/ValueColumn-Einträge.

Ursache m.M.n: “Bug/Fehlverhalten” in SSAS

Weitere Hilfe, Warnungsfehler in Hierarchien hier:

https://social.msdn.microsoft.com/Forums/sqlserver/de-DE/91e6b21c-e9ad-43ea-8eb8-d6b5f543d27d/ssas-defaulteigenschaften-von-dimensionen-fhren-zu-warnungen

SQL Server Error Message 15562: The module being executed is not trusted. Either the owner of the database of the module needs to be granted authenticate permission, or the module needs to be digitally signed.

The easiest way to get rid of this error is:

ALTER DATABASE [DBNAME] SET TRUSTWORTHY ON

Deutsche Fehlermeldung:

Das ausgeführte Modul ist nicht vertrauenswürdig. Entweder dem Besitzer der Datenbank des Moduls muss die Authentifizierungsberechtigung erteilt werden oder das Modul muss digital signiert werden.