Showing posts with label sql2k. Show all posts
Showing posts with label sql2k. Show all posts

Wednesday, March 28, 2012

Scheduling perl scripts with sqlagent

SQL2K SP3a Win2k Pro SP4
Probably one for people using perl for scripting.
I'm having a problem scheduling perl scripts to run with sql agent.
All permissions are OK, PERL5LIB is set and the script will run perfectly
from the command line
When running through sql agent the following:
cmd /c "perl s:\production\getdbspaceused.pl"
It seems it won't pick up the PERL5LIB environment variable. Any ideas,
(without explicitly putting the path to the modules directory) or am I going
to have to use windows scheduler'
I've got task scheduler to run this (but i want the success/failure
notification available from sql agent)
TIA.
KevinI use ActivePerl from www.activestate.com, and have never
had any problem scheduling a Perl script via SQLServer
Agent, though I use Windows Task Scheduler more often to
run Perl scripts. If you have ActivePerl installed on the
server, you can just run a Perl script as (plus whatever
command line switches you may have) using an Operating
System Command job step type.
perl yourScript.pl
perl.exe should already be on the system path.
Linchi
>--Original Message--
>SQL2K SP3a Win2k Pro SP4
>Probably one for people using perl for scripting.
>I'm having a problem scheduling perl scripts to run with
sql agent.
>All permissions are OK, PERL5LIB is set and the script
will run perfectly
>from the command line
>When running through sql agent the following:
> cmd /c "perl s:\production\getdbspaceused.pl"
>It seems it won't pick up the PERL5LIB environment
variable. Any ideas,
>(without explicitly putting the path to the modules
directory) or am I going
>to have to use windows scheduler'
>I've got task scheduler to run this (but i want the
success/failure
>notification available from sql agent)
>
>TIA.
>Kevin
>
>.
>|||Hello Kevin,
Could you please try to run cmd /c "perl s:\production\getdbspaceused.pl"
using xp_cmdshell in the Query Analyser ?
Does that work without any problem ? If yes, you might want to create a Job
to run the same cmd and that way you can use the
SQL Agent successs/failure notifications.
Honestly, I have no experience with running the PERL scripts, but just
wanted to see if above works. Please let me know.
Thanks for using MSDN Managed Newsgroups.
Vikrant Dalwale
Microsoft SQL Server Support Professional
This posting is provided "AS IS" with no warranties, and confers no rights.
Get secure !! For info, please visit http://www.microsoft.com/security.
Please reply to Newsgroups only.
--
| From: <KJGNews@.hotmail.com>
| Subject: Scheduling perl scripts with sqlagent
| Date: Wed, 21 Jan 2004 09:21:02 -0000
| Lines: 24
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <OTbE$9$3DHA.1428@.TK2MSFTNGP12.phx.gbl>
| Newsgroups: microsoft.public.sqlserver.server
| NNTP-Posting-Host: 62.190.182.219
| Path:
cpmsftngxa07.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP08
.phx.gbl!TK2MSFTNGP12.phx.gbl
| Xref: cpmsftngxa07.phx.gbl microsoft.public.sqlserver.server:325288
| X-Tomcat-NG: microsoft.public.sqlserver.server
|
| SQL2K SP3a Win2k Pro SP4
|
| Probably one for people using perl for scripting.
|
| I'm having a problem scheduling perl scripts to run with sql agent.
|
| All permissions are OK, PERL5LIB is set and the script will run perfectly
| from the command line
|
| When running through sql agent the following:
| cmd /c "perl s:\production\getdbspaceused.pl"
|
| It seems it won't pick up the PERL5LIB environment variable. Any ideas,
| (without explicitly putting the path to the modules directory) or am I
going
| to have to use windows scheduler'
|
| I've got task scheduler to run this (but i want the success/failure
| notification available from sql agent)
|
|
| TIA.
| Kevin
|
|
||||Thanks everybody for the help.
I came in this morning and the job has run, successfully and I don't know
why, although
I'm happy about this. Can only assume it took a period of time before the
environment
variable was recognised by the OS?
Anyway, thanks once again.
"Vikrant V Dalwale [MSFT]" <vikrantd@.online.microsoft.com> wrote in message
news:AZhoRpJ4DHA.3648@.cpmsftngxa07.phx.gbl...
>
> Hello Kevin,
> Could you please try to run cmd /c "perl s:\production\getdbspaceused.pl"
> using xp_cmdshell in the Query Analyser ?
> Does that work without any problem ? If yes, you might want to create a
Job
> to run the same cmd and that way you can use the
> SQL Agent successs/failure notifications.
> Honestly, I have no experience with running the PERL scripts, but just
> wanted to see if above works. Please let me know.
> Thanks for using MSDN Managed Newsgroups.
> Vikrant Dalwale
> Microsoft SQL Server Support Professional
>
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> Get secure !! For info, please visit http://www.microsoft.com/security.
> Please reply to Newsgroups only.
> --
> | From: <KJGNews@.hotmail.com>
> | Subject: Scheduling perl scripts with sqlagent
> | Date: Wed, 21 Jan 2004 09:21:02 -0000
> | Lines: 24
> | X-Priority: 3
> | X-MSMail-Priority: Normal
> | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
> | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
> | Message-ID: <OTbE$9$3DHA.1428@.TK2MSFTNGP12.phx.gbl>
> | Newsgroups: microsoft.public.sqlserver.server
> | NNTP-Posting-Host: 62.190.182.219
> | Path:
>
cpmsftngxa07.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP08
> phx.gbl!TK2MSFTNGP12.phx.gbl
> | Xref: cpmsftngxa07.phx.gbl microsoft.public.sqlserver.server:325288
> | X-Tomcat-NG: microsoft.public.sqlserver.server
> |
> | SQL2K SP3a Win2k Pro SP4
> |
> | Probably one for people using perl for scripting.
> |
> | I'm having a problem scheduling perl scripts to run with sql agent.
> |
> | All permissions are OK, PERL5LIB is set and the script will run
perfectly
> | from the command line
> |
> | When running through sql agent the following:
> | cmd /c "perl s:\production\getdbspaceused.pl"
> |
> | It seems it won't pick up the PERL5LIB environment variable. Any ideas,
> | (without explicitly putting the path to the modules directory) or am I
> going
> | to have to use windows scheduler'
> |
> | I've got task scheduler to run this (but i want the success/failure
> | notification available from sql agent)
> |
> |
> | TIA.
> | Kevin
> |
> |
> |
>

Scheduling perl scripts with sqlagent

SQL2K SP3a Win2k Pro SP4
Probably one for people using PERL for scripting.
I'm having a problem scheduling PERL scripts to run with sql agent.
All permissions are OK, PERL5LIB is set and the script will run perfectly
from the command line
When running through sql agent the following:
cmd /c "perl s:\production\getdbspaceused.pl"
It seems it won't pick up the PERL5LIB environment variable. Any ideas,
(without explicitly putting the path to the modules directory) or am I going
to have to use windows scheduler'
I've got task scheduler to run this (but i want the success/failure
notification available from sql agent)
TIA.
KevinI use ActivePerl from www.activestate.com, and have never
had any problem scheduling a PERL script via SQLServer
Agent, though I use Windows Task Scheduler more often to
run PERL scripts. If you have ActivePerl installed on the
server, you can just run a PERL script as (plus whatever
command line switches you may have) using an Operating
System Command job step type.
perl yourScript.pl
perl.exe should already be on the system path.
Linchi
quote:

>--Original Message--
>SQL2K SP3a Win2k Pro SP4
>Probably one for people using PERL for scripting.
>I'm having a problem scheduling PERL scripts to run with

sql agent.
quote:

>All permissions are OK, PERL5LIB is set and the script

will run perfectly
quote:

>from the command line
>When running through sql agent the following:
> cmd /c "perl s:\production\getdbspaceused.pl"
>It seems it won't pick up the PERL5LIB environment

variable. Any ideas,
quote:

>(without explicitly putting the path to the modules

directory) or am I going
quote:

>to have to use windows scheduler'
>I've got task scheduler to run this (but i want the

success/failure
quote:

>notification available from sql agent)
>
>TIA.
>Kevin
>
>.
>
|||Hello Kevin,
Could you please try to run cmd /c "perl s:\production\getdbspaceused.pl"
using xp_cmdshell in the Query Analyser ?
Does that work without any problem ? If yes, you might want to create a Job
to run the same cmd and that way you can use the
SQL Agent successs/failure notifications.
Honestly, I have no experience with running the PERL scripts, but just
wanted to see if above works. Please let me know.
Thanks for using MSDN Managed Newsgroups.
Vikrant Dalwale
Microsoft SQL Server Support Professional
This posting is provided "AS IS" with no warranties, and confers no rights.
Get secure !! For info, please visit http://www.microsoft.com/security.
Please reply to Newsgroups only.
| From: <KJGNews@.hotmail.com>
| Subject: Scheduling PERL scripts with sqlagent
| Date: Wed, 21 Jan 2004 09:21:02 -0000
| Lines: 24
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <OTbE$9$3DHA.1428@.TK2MSFTNGP12.phx.gbl>
| Newsgroups: microsoft.public.sqlserver.server
| NNTP-Posting-Host: 62.190.182.219
| Path:
cpmsftngxa07.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP08
.phx.gbl!TK2MSFTNGP12.phx.gbl
| Xref: cpmsftngxa07.phx.gbl microsoft.public.sqlserver.server:325288
| X-Tomcat-NG: microsoft.public.sqlserver.server
|
| SQL2K SP3a Win2k Pro SP4
|
| Probably one for people using PERL for scripting.
|
| I'm having a problem scheduling PERL scripts to run with sql agent.
|
| All permissions are OK, PERL5LIB is set and the script will run perfectly
| from the command line
|
| When running through sql agent the following:
| cmd /c "perl s:\production\getdbspaceused.pl"
|
| It seems it won't pick up the PERL5LIB environment variable. Any ideas,
| (without explicitly putting the path to the modules directory) or am I
going
| to have to use windows scheduler'
|
| I've got task scheduler to run this (but i want the success/failure
| notification available from sql agent)
|
|
| TIA.
| Kevin
|
|
||||Thanks everybody for the help.
I came in this morning and the job has run, successfully and I don't know
why, although
I'm happy about this. Can only assume it took a period of time before the
environment
variable was recognised by the OS?
Anyway, thanks once again.
"Vikrant V Dalwale [MSFT]" <vikrantd@.online.microsoft.com> wrote in message
news:AZhoRpJ4DHA.3648@.cpmsftngxa07.phx.gbl...
quote:

>
> Hello Kevin,
> Could you please try to run cmd /c "perl s:\production\getdbspaceused.pl"
> using xp_cmdshell in the Query Analyser ?
> Does that work without any problem ? If yes, you might want to create a

Job
quote:

> to run the same cmd and that way you can use the
> SQL Agent successs/failure notifications.
> Honestly, I have no experience with running the PERL scripts, but just
> wanted to see if above works. Please let me know.
> Thanks for using MSDN Managed Newsgroups.
> Vikrant Dalwale
> Microsoft SQL Server Support Professional
>
> This posting is provided "AS IS" with no warranties, and confers no

rights.
quote:

> Get secure !! For info, please visit http://www.microsoft.com/security.
> Please reply to Newsgroups only.
> --
> | From: <KJGNews@.hotmail.com>
> | Subject: Scheduling PERL scripts with sqlagent
> | Date: Wed, 21 Jan 2004 09:21:02 -0000
> | Lines: 24
> | X-Priority: 3
> | X-MSMail-Priority: Normal
> | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
> | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
> | Message-ID: <OTbE$9$3DHA.1428@.TK2MSFTNGP12.phx.gbl>
> | Newsgroups: microsoft.public.sqlserver.server
> | NNTP-Posting-Host: 62.190.182.219
> | Path:
>

cpmsftngxa07.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP08
quote:

> phx.gbl!TK2MSFTNGP12.phx.gbl
> | Xref: cpmsftngxa07.phx.gbl microsoft.public.sqlserver.server:325288
> | X-Tomcat-NG: microsoft.public.sqlserver.server
> |
> | SQL2K SP3a Win2k Pro SP4
> |
> | Probably one for people using PERL for scripting.
> |
> | I'm having a problem scheduling PERL scripts to run with sql agent.
> |
> | All permissions are OK, PERL5LIB is set and the script will run

perfectly
quote:

> | from the command line
> |
> | When running through sql agent the following:
> | cmd /c "perl s:\production\getdbspaceused.pl"
> |
> | It seems it won't pick up the PERL5LIB environment variable. Any ideas,
> | (without explicitly putting the path to the modules directory) or am I
> going
> | to have to use windows scheduler'
> |
> | I've got task scheduler to run this (but i want the success/failure
> | notification available from sql agent)
> |
> |
> | TIA.
> | Kevin
> |
> |
> |
>

Monday, March 12, 2012

Scheduled DTS Package not running

I have a DTS package setup that runs just fine when I fire
it off as a DTS package, but when I schedule it to run it
fails.
I'm running SQL2K, sp3. SQLAgent is running.
Has anyone seen this before ?
TIA...
Michael.What is the package trying to do when it fails? This can happen because of
privileges (or lack thereof) of the SQL Agent service account that differ
from the privileges used when running the package from Enterprise Manager.
Bob
Microsoft Consulting Services
--
This posting is provided AS IS with no warranties, and confers no rights.|||as indicated before it depends on a number of things . .
1) if DTS references a file that SQLAgent Account cannot Access/does not hav
e access to
2) if non-sysadmin created SQLAgentJob and SQLProxy a/c exist then job will
be executed in SQLProxy a/c context
3) if DTS is executed using exec xp_cmdshell 'DTSRun' or xp_cmdshell exists
inside DTS and SQLAgent job creator account does not have rights to execute
xp_cmdshell and no sqlproxy account then could get the problem.
hope this helps|||The first part is an ActiveX script that gets file names
off a dir. and inserts them into a table.
The acct mesSQL01 is the account that SQL logs in under as
well as SQLAgent. It is also the owner of the DTS Package,
and has full control on the dir that it is looking on.
heres the fail message that is returned by sendmail:
STATUS: Failed
MESSAGES: The job failed. Unable to determine if
the owner (WILL\mesql01) of job GetFileName has server
access (reason: Could not obtain information about Windows
NT group/user 'WILL\mesql01'. [SQLSTATE 42000] (Error
8198))
I'm gonna start tearing it apart to see if there are other
parts of it that it CAN run. I am quite at a loss here.
Thanks for your help !!
m.

>--Original Message--
>What is the package trying to do when it fails? This can
happen because of
>privileges (or lack thereof) of the SQL Agent service
account that differ
>from the privileges used when running the package from
Enterprise Manager.
>--
>Bob
>Microsoft Consulting Services
>--
>This posting is provided AS IS with no warranties, and
confers no rights.
>
>.
>|||Ok, I think I've nailed down what is causing it to fail,
but I can't seem to find a solution.
Here's the ActiveX script...
Function Main()
Dim FSys
Dim Folder
Dim Files
Dim Comm
Dim Conn
Set FSys = CreateObject
("Scripting.FileSystemObject")
Set Folder = FSys.GetFolder
("\\fsq\Files\DM\Lab\TechReports")
Set Files = Folder.files
Set Conn = CreateObject("ADODB.Connection")
Set Comm = CreateObject("ADODB.Command")
With Conn
.Provider = "sqloledb"'
.open "Data Source = fsq\Mes_SQL01;
Initial Catalog =Lab Tech Library; User id=MesSQL01;
password=xxxxx"
end with
Set Comm.ActiveConnection = Conn
It all works with the WITH statement stuff rem'ed out, so
it's the stuff in the WITH statement that is causing the
fail, even though the MesSQL01 acct is a Domain account,
and has Admin priv on the SQL server. It even fails when I
log on as MesSQL01 and run the package local.
Why would this fail, even though it has the permissions ?
This is the domain acct that the server and SQLAgent logs
in under ?
help ?
TIA

>--Original Message--
>What is the package trying to do when it fails? This can
happen because of
>privileges (or lack thereof) of the SQL Agent service
account that differ
>from the privileges used when running the package from
Enterprise Manager.
>--
>Bob
>Microsoft Consulting Services
>--
>This posting is provided AS IS with no warranties, and
confers no rights.
>
>.
>|||Need to connect with trusted connection(not )
your account is a trusted connection therefore no requirement to have userid
and password
Dim IsTrusted ' IsTrusted is 0 by default
Dim oServer
Dim strServer
' Create DMO server object
Set oServer = CreateObject("SQLDMO.SQLServer")
' Use secure login and then login (trusted connection)
IsTrusted = 0
oServer.LoginSecure = True
' connect to the server requested
oServer.Connect (strServer)

Scheduled DTS Package not running

I have a DTS package setup that runs just fine when I fire
it off as a DTS package, but when I schedule it to run it
fails.
I'm running SQL2K, sp3. SQLAgent is running.
Has anyone seen this before ?
TIA...
Michael.What is the package trying to do when it fails? This can happen because of
privileges (or lack thereof) of the SQL Agent service account that differ
from the privileges used when running the package from Enterprise Manager.
--
Bob
Microsoft Consulting Services
--
This posting is provided AS IS with no warranties, and confers no rights.|||as indicated before it depends on a number of things . .
1) if DTS references a file that SQLAgent Account cannot Access/does not have access t
2) if non-sysadmin created SQLAgentJob and SQLProxy a/c exist then job will be executed in SQLProxy a/c contex
3) if DTS is executed using exec xp_cmdshell 'DTSRun' or xp_cmdshell exists inside DTS and SQLAgent job creator account does not have rights to execute xp_cmdshell and no sqlproxy account then could get the problem
hope this helps|||The first part is an ActiveX script that gets file names
off a dir. and inserts them into a table.
The acct mesSQL01 is the account that SQL logs in under as
well as SQLAgent. It is also the owner of the DTS Package,
and has full control on the dir that it is looking on.
heres the fail message that is returned by sendmail:
STATUS: Failed
MESSAGES: The job failed. Unable to determine if
the owner (WILL\mesql01) of job GetFileName has server
access (reason: Could not obtain information about Windows
NT group/user 'WILL\mesql01'. [SQLSTATE 42000] (Error
8198))
I'm gonna start tearing it apart to see if there are other
parts of it that it CAN run. I am quite at a loss here.
Thanks for your help !!
m.
>--Original Message--
>What is the package trying to do when it fails? This can
happen because of
>privileges (or lack thereof) of the SQL Agent service
account that differ
>from the privileges used when running the package from
Enterprise Manager.
>--
>Bob
>Microsoft Consulting Services
>--
>This posting is provided AS IS with no warranties, and
confers no rights.
>
>.
>|||Ok, I think I've nailed down what is causing it to fail,
but I can't seem to find a solution.
Here's the ActiveX script...
Function Main()
Dim FSys
Dim Folder
Dim Files
Dim Comm
Dim Conn
Set FSys = CreateObject
("Scripting.FileSystemObject")
Set Folder = FSys.GetFolder
("\\fsq\Files\DM\Lab\TechReports")
Set Files = Folder.files
Set Conn = CreateObject("ADODB.Connection")
Set Comm = CreateObject("ADODB.Command")
With Conn
.Provider = "sqloledb"'
.open "Data Source = fsq\Mes_SQL01;
Initial Catalog =Lab Tech Library; User id=MesSQL01;
password=xxxxx"
end with
Set Comm.ActiveConnection = Conn
It all works with the WITH statement stuff rem'ed out, so
it's the stuff in the WITH statement that is causing the
fail, even though the MesSQL01 acct is a Domain account,
and has Admin priv on the SQL server. It even fails when I
log on as MesSQL01 and run the package local.
Why would this fail, even though it has the permissions ?
This is the domain acct that the server and SQLAgent logs
in under ?
help ?
TIA
>--Original Message--
>What is the package trying to do when it fails? This can
happen because of
>privileges (or lack thereof) of the SQL Agent service
account that differ
>from the privileges used when running the package from
Enterprise Manager.
>--
>Bob
>Microsoft Consulting Services
>--
>This posting is provided AS IS with no warranties, and
confers no rights.
>
>.
>|||Need to connect with trusted connection(not
your account is a trusted connection therefore no requirement to have userid and passwor
Dim IsTrusted ' IsTrusted is 0 by defaul
Dim oServe
Dim strServe
' Create DMO server object
Set oServer = CreateObject("SQLDMO.SQLServer"
' Use secure login and then login (trusted connection
IsTrusted = 0
oServer.LoginSecure = Tru
' connect to the server requeste
oServer.Connect (strServer)