功能失调的克隆

时间:2015-02-10 08:40:51

标签: database ssms sspi

已克隆数据库服务器。操作系统为"Microsoft Windows XP Professional Version 2002 Service Pack 3"。查询环境为"Microsoft SQL Server 2008 Management Studio 10.0.4000.0"

克隆后,注意到以下行为。尝试从机器外部进行连接但在同一域内时,可以读取以下错误消息:"Cannot generate SSPI context. (.Net SqlClient Data Provider)"

在计算机内部,可以使用"Microsoft SQL Server 2008 Management Studio"查询环境连接到数据库服务器。

但是,尝试运行SQLCmd命令行工具时,会显示以下错误:

C:\<Directory>>SQLCmd -S DBA2\<Instance> -i C:\<Directory>\<FileName>.SQL
HResult 0x80090322, Level 16, State 1
SQL Server Network Interfaces: The target principal name is incorrect.
Sqlcmd: Error: Microsoft SQL Server Native Client 10.0 : Cannot generate SSPI context.

ServicePrincipalNames按以下方式设置:

C:\PROGRA~1\SUPPOR~1>setspn DBA2
Registered ServicePrincipalNames for CN=DBA2,CN=Computers,DC=<Company>,DC=com:
VProRecovery Backup Exec System Recovery Agent 7.0/DBA2.<Company>.com
HOST/DBA2
HOST/DBA2.<Company>.com

从Microsoft Windows XP Professional光盘运行"C:\PROGRA~1\SUPPOR~1\ADSIEDIT.MSC"支持工具时,我们可以在"ADSI Edit \ Domain [<Site>.<Company>.com] \ DC=<Company>,DC=com"路径下面看到"CN=Computers"叶子。在"Properties"对话框的"Security"标签内,"Group or user names:"列表下方,有"SELF"条目。按下"Advanced"按钮后,将生成"Advanced Security Settings for Computers"对话框。在"Permissions"标签的"Permission entries:"列表下,还有一个名称为"SELF"的条目。按"Edit..."按钮,将显示"Permission Entry for Computers"对话框。在"Properties"标签的"Permissions:"列表中,没有"Read ServicePrincipalName"权限和"Write ServicePrincipalName"权限的条目。

这可能是以下命令失败的原因:

C:\PROGRA~1\SUPPOR~1>setspn -r DBA2
Registering ServicePrincipalNames for CN=DBA2,CN=Computers,DC=<Company>,DC=com
HOST/DBA2.<Company>
HOST/DBA2
Failed to assign SPN to account 'CN=DBA2,CN=Computers,DC=<Company>,DC=com', 0x2098

即使在克隆的数据库服务器上有重置ServicePrincipalName的权限,是否会解决来自同一域内SQLCmd和机器外部的连接?

1 个答案:

答案 0 :(得分:0)

实际上,是的,在正确的权限设置在正确的位置后,这解决了问题。

必须在ServicePrincipalNames用户上设置SQL,如下所示:

C:\PROGRA~1\SUPPOR~1>setspn -a mssqlsvc/dba2:1433 <Company>\<UserName>
Registering ServicePrincipalNames for CN=<UserName>,OU=Reporting Security,OU=Security Groups,OU=Romania,DC=<Company>,DC=com
        mssqlsvc/dba2:1433
Updated object

C:\PROGRA~1\SUPPOR~1>setspn -a mssqlsvc/dba2.<Company>.com:1433 <Company>\<UserName>
Registering ServicePrincipalNames for CN=<UserName>,OU=Reporting Security,OU=Security Groups,OU=Romania,DC=<Company>,DC=com
        mssqlsvc/dba2.<Company>.com:1433
Updated object

C:\PROGRA~1\SUPPOR~1>setspn -l dba2
Registered ServicePrincipalNames for CN=DBA2,OU=Romania Machines,OU=Romania,DC=<Company>,DC=com:
    VProRecovery Backup Exec System Recovery Agent 7.0/DBA2.<Company>.com
    HOST/DBA2
    HOST/DBA2.<Company>.com

C:\PROGRA~1\SUPPOR~1>setspn -l <UserName>
Registered ServicePrincipalNames for CN=<UserName>,OU=Reporting Security,OU=Security Groups,OU=Romania,DC=<Company>,DC=com:
    MSSQLSvc/DBA2.<Company>.com:<Company>_RO
    mssqlsvc/dba2.<Company>.com:1433
    mssqlsvc/dba2:1433

希望这可能会帮助那些可能遇到同样问题的人。