附件\\ SERVER \ file.csv无效. [SQLSTATE 42000](错误22051).步骤失败 [英] Attachment file \\SERVER\file.csv is invalid. [SQLSTATE 42000] (Error 22051). The step failed
问题描述
我有4台SQL服务器:SQL Server 2005,SQL Server 2008,SQL Server 2008 R2和SQL Server 2012.
I've got 4 SQL servers: SQL Server 2005, SQL Server 2008, SQL Server 2008 R2 and SQL Server 2012.
在SQL Server 2008 R2中;我创建了一个SQL作业,该作业在每个星期一向我发送电子邮件,其中包含3个月以上的数据库上的SQL Server 2005,SQL Server 2008和SQL Server 2008 R2的报告,并且工作正常.
In SQL Server 2008 R2; I have created a SQL job that sends me email every Monday with reports from SQL Server 2005, SQL Server 2008 and SQL Server 2008 R2 on databases that are older than 3 months and it works just fine.
但是,现在,我想添加SQL Server 2012,该作业将失败,并显示以下错误:
But, now that I want to add SQL Server 2012, the job fails with the following error:
以用户身份执行:NT AUTHORITY \ SYSTEM.配置选项显示高级选项"从1更改为1.运行RECONFIGURE语句进行安装. [SQLSTATE 01000](消息15457)配置选项数据库邮件XP"从1更改为1.运行RECONFIGURE语句进行安装. [SQLSTATE 01000](消息15457)附件文件\\ ServerName \ ShareName \ Path \ SQL2012_DB.csv无效. [SQLSTATE 42000](错误22051).步骤失败.
Executed as user: NT AUTHORITY\SYSTEM. Configuration option 'show advanced options' changed from 1 to 1. Run the RECONFIGURE statement to install. [SQLSTATE 01000] (Message 15457) Configuration option 'Database Mail XPs' changed from 1 to 1. Run the RECONFIGURE statement to install. [SQLSTATE 01000] (Message 15457) Attachment file \\ServerName\ShareName\Path\SQL2012_DB.csv is invalid. [SQLSTATE 42000] (Error 22051). The step failed.
如果我在SQL Server 2012上创建相同的作业,则会发现SQL2008R2_DB.csv
无效.
If I create the same job on SQL Server 2012 I'm getting that the SQL2008R2_DB.csv
is invalid.
这是SQL Server 2008 R2上的工作步骤:
Here is the steps from the job on SQL Server 2008 R2:
sp_CONFIGURE 'show advanced', 1
GO
RECONFIGURE
GO
sp_CONFIGURE 'Database Mail XPs', 1
GO
RECONFIGURE
GO
USE msdb
GO
EXEC sp_send_dbmail
@profile_name='SQL2008R2',
@recipients=my.email@mail.com',
@subject='Old DBs',
@body='DBs attached in csv',
@file_attachments='\\ServerName\ShareName\Path\SQL05_DB.csv;\\ServerName\ShareName\Path\SQL2008_DB.csv;\\ServerName\ShareName\Path\SQL2008R2_DB.csv;\\ServerName\ShareName\Path\SQL2008R2_DB.csv'
我丢失的是SQL Server 2008 R2和SQL Server 2012之间的权限问题吗?
Is it a permission issue between SQL Server 2008 R2 and SQL Server 2012 that I'm missing or is it something else?
推荐答案
好,所以问题在于SQL服务帐户无权访问共享文件夹.这就是为什么我得到错误"Attachment file \\ServerName\ShareName\Path\SQL2008R2_DB.csv is invalid."
Ok, so the problem was that the SQL service account didn't have access to the shared folder. And that's why I got the error "Attachment file \\ServerName\ShareName\Path\SQL2008R2_DB.csv is invalid."
现在它可以正常工作;)
Now it works just fine ;)
这篇关于附件\\ SERVER \ file.csv无效. [SQLSTATE 42000](错误22051).步骤失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!