Showing posts with label shared. Show all posts
Showing posts with label shared. Show all posts

Tuesday, March 20, 2012

Scheduled Jobs

When creating a scheduled job is it possible to output the file to a shared drive on the network
When browsing for file location whien creating the job only local physical drives are shown and when inputting unc share the job fails
any ideas ?If you know the name/IP address of the network file then you can output the file by using:

\\servername\d$\data\filename.dat

where 'd$' is the drive you're writing to on that server.

(NB This doesn't work if you are doing any file handling using the Scripting Runtime DLL through T-SQL)

Wednesday, March 7, 2012

Schedule OSQL Job to send output to shared drive

I'm trying to schedule a job in Enterprise Manager...the job is using osql a
nd I'm trying to send the output file to a shared drive on another server.
Here's an example:
osql -E -dmaster -Q"sp_who" -o\\servername\sharename\filename
When I run this at a cmd prompt, the job works just fine, sending the output
file to the share. When I use the job scheduler in SQL Server, I get the e
rror: Cannot open output file - <filename>. No such file or directory. I'v
e confirmed the path I'm us
ing is correct.
Is the job scheduler just unable to write to a shared drive? Any suggestion
s to work around this?
Any input is greatly appreciated!
Thanks,
Jennifermaybe a silly question, but have you confirmed that the Server can in fact
see that particular share?
Brian Moran
Principal Mentor
Solid Quality Learning
SQL Server MVP
http://www.solidqualitylearning.com
"Jennifer" <anonymous@.discussions.microsoft.com> wrote in message
news:7E0330E7-92F8-4F1A-B8CC-191FCBB40534@.microsoft.com...
quote:

> I'm trying to schedule a job in Enterprise Manager...the job is using osql

and I'm trying to send the output file to a shared drive on another server.
quote:

> Here's an example:
> osql -E -dmaster -Q"sp_who" -o\\servername\sharename\filename
> When I run this at a cmd prompt, the job works just fine, sending the

output file to the share. When I use the job scheduler in SQL Server, I get
the error: Cannot open output file - <filename>. No such file or directory.
I've confirmed the path I'm using is correct.
quote:

> Is the job scheduler just unable to write to a shared drive? Any

suggestions to work around this?
quote:

> Any input is greatly appreciated!
> Thanks,
> Jennifer
|||Jobs run under the permission of SQL AGent... make sure SQL Agent has the
correct permissions on the file directory.
Wayne Snyder, MCDBA, SQL Server MVP
Computer Education Services Corporation (CESC), Charlotte, NC
www.computeredservices.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Jennifer" <anonymous@.discussions.microsoft.com> wrote in message
news:7E0330E7-92F8-4F1A-B8CC-191FCBB40534@.microsoft.com...
quote:

> I'm trying to schedule a job in Enterprise Manager...the job is using osql

and I'm trying to send the output file to a shared drive on another server.
quote:

> Here's an example:
> osql -E -dmaster -Q"sp_who" -o\\servername\sharename\filename
> When I run this at a cmd prompt, the job works just fine, sending the

output file to the share. When I use the job scheduler in SQL Server, I get
the error: Cannot open output file - <filename>. No such file or directory.
I've confirmed the path I'm using is correct.
quote:

> Is the job scheduler just unable to write to a shared drive? Any

suggestions to work around this?
quote:

> Any input is greatly appreciated!
> Thanks,
> Jennifer
|||Yes, the server can see that share. If I run the exact syntax at a command
prompt, the job works fine. If I run the same syntax in the job scheduler,
I get the error "cannot open output file."
The SQL Server Agent on both servers is running under the same domain accoun
t, and that account is an administrator on both servers. Are there any othe
r permissions I need to check?|||What Windows user account were you logged in when you ran the osql command
at the command prompt? Were you using the same SQL Server Agent service
account?
After you have logged in using the same SQL Server Agent account, open a
command prompt and type
cmd>dir \\servername\sharename\filename
This will tell you whether the account can see the share.
Alternatively, you can also open a command prompt as follows:
cmd>runas /user:yourDomain\SQLAgentAccount cmd
and then test osql in that new command prompt.
Linchi Shea
linchi_shea@.NOSPAMml.com
"Jennifer" <anonymous@.discussions.microsoft.com> wrote in message
news:D1C109D1-F526-491F-B6BE-D08F47478B62@.microsoft.com...
quote:

> Yes, the server can see that share. If I run the exact syntax at a

command prompt, the job works fine. If I run the same syntax in the job
scheduler, I get the error "cannot open output file."
quote:

> The SQL Server Agent on both servers is running under the same domain

account, and that account is an administrator on both servers. Are there
any other permissions I need to check?|||Yes, I can see the shared drive from the cmd prompt. The problem is the job
scheduled through Enterprise Manager cannot see the shared drive.

Schedule OSQL Job to send output to shared drive

I'm trying to schedule a job in Enterprise Manager...the job is using osql and I'm trying to send the output file to a shared drive on another server.
Here's an example:
osql -E -dmaster -Q"sp_who" -o\\servername\sharename\filename
When I run this at a cmd prompt, the job works just fine, sending the output file to the share. When I use the job scheduler in SQL Server, I get the error: Cannot open output file - <filename>. No such file or directory. I've confirmed the path I'm using is correct.
Is the job scheduler just unable to write to a shared drive? Any suggestions to work around this?
Any input is greatly appreciated!
Thanks,
Jennifermaybe a silly question, but have you confirmed that the Server can in fact
see that particular share?
--
Brian Moran
Principal Mentor
Solid Quality Learning
SQL Server MVP
http://www.solidqualitylearning.com
"Jennifer" <anonymous@.discussions.microsoft.com> wrote in message
news:7E0330E7-92F8-4F1A-B8CC-191FCBB40534@.microsoft.com...
> I'm trying to schedule a job in Enterprise Manager...the job is using osql
and I'm trying to send the output file to a shared drive on another server.
> Here's an example:
> osql -E -dmaster -Q"sp_who" -o\\servername\sharename\filename
> When I run this at a cmd prompt, the job works just fine, sending the
output file to the share. When I use the job scheduler in SQL Server, I get
the error: Cannot open output file - <filename>. No such file or directory.
I've confirmed the path I'm using is correct.
> Is the job scheduler just unable to write to a shared drive? Any
suggestions to work around this?
> Any input is greatly appreciated!
> Thanks,
> Jennifer|||Jobs run under the permission of SQL AGent... make sure SQL Agent has the
correct permissions on the file directory.
--
Wayne Snyder, MCDBA, SQL Server MVP
Computer Education Services Corporation (CESC), Charlotte, NC
www.computeredservices.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Jennifer" <anonymous@.discussions.microsoft.com> wrote in message
news:7E0330E7-92F8-4F1A-B8CC-191FCBB40534@.microsoft.com...
> I'm trying to schedule a job in Enterprise Manager...the job is using osql
and I'm trying to send the output file to a shared drive on another server.
> Here's an example:
> osql -E -dmaster -Q"sp_who" -o\\servername\sharename\filename
> When I run this at a cmd prompt, the job works just fine, sending the
output file to the share. When I use the job scheduler in SQL Server, I get
the error: Cannot open output file - <filename>. No such file or directory.
I've confirmed the path I'm using is correct.
> Is the job scheduler just unable to write to a shared drive? Any
suggestions to work around this?
> Any input is greatly appreciated!
> Thanks,
> Jennifer|||Yes, the server can see that share. If I run the exact syntax at a command prompt, the job works fine. If I run the same syntax in the job scheduler, I get the error "cannot open output file."
The SQL Server Agent on both servers is running under the same domain account, and that account is an administrator on both servers. Are there any other permissions I need to check?|||What Windows user account were you logged in when you ran the osql command
at the command prompt? Were you using the same SQL Server Agent service
account?
After you have logged in using the same SQL Server Agent account, open a
command prompt and type
cmd>dir \\servername\sharename\filename
This will tell you whether the account can see the share.
Alternatively, you can also open a command prompt as follows:
cmd>runas /user:yourDomain\SQLAgentAccount cmd
and then test osql in that new command prompt.
--
Linchi Shea
linchi_shea@.NOSPAMml.com
"Jennifer" <anonymous@.discussions.microsoft.com> wrote in message
news:D1C109D1-F526-491F-B6BE-D08F47478B62@.microsoft.com...
> Yes, the server can see that share. If I run the exact syntax at a
command prompt, the job works fine. If I run the same syntax in the job
scheduler, I get the error "cannot open output file."
> The SQL Server Agent on both servers is running under the same domain
account, and that account is an administrator on both servers. Are there
any other permissions I need to check?|||Yes, I can see the shared drive from the cmd prompt. The problem is the job scheduled through Enterprise Manager cannot see the shared drive.