Discussion:
.bat Windows-Scheduled database dump
(too old to reply)
unknown
2009-08-22 20:52:44 UTC
Permalink
I put together two files. One file (the batch file)
contains the command to run isql with the parameters
required to access the database. This file also identifies
an input file that contains SQL to be processed. The second
file is the input file itself that contains the dump
database sql command.

When I manually log into isql, I can run the dump database
command as listed in the second file and it runs seamlessly.
However, when I run the batch file, nothing happens. Can
someone look at the two attached files and let me know what
I've done wrong. I just can't see what the problem may be.

Regards,
Shawn

PS - I had to submit the bat file in .txt format since it's
not permissible to attach applications and such to postings.
In my world, this file was datadump.bat.
unknown
2009-08-22 20:57:29 UTC
Permalink
After postig, I noticed I'm not able to open the attached
files so in case others can't open them either, I'll just
post the internal contents of the files here.

The syntax within the batch file is as follows:
run isql.exe -Sserver -Uuid -Ppwd -Ddb
-ic:\temp\datadump.sql -oc:\temp\datadump.out

The syntax within the sql file is as follows:
dump database db to datadumpdevice
go

Thanks,
Shawn
Post by unknown
I put together two files. One file (the batch file)
contains the command to run isql with the parameters
required to access the database. This file also
identifies an input file that contains SQL to be
processed. The second file is the input file itself that
contains the dump database sql command.
When I manually log into isql, I can run the dump database
command as listed in the second file and it runs
seamlessly.
However, when I run the batch file, nothing happens. Can
someone look at the two attached files and let me know
what I've done wrong. I just can't see what the problem
may be.
Regards,
Shawn
PS - I had to submit the bat file in .txt format since
it's not permissible to attach applications and such to
postings.
In my world, this file was datadump.bat.
[datadumpbat.txt]
run isql.exe -Sserver -Uuid -Ppwd -Ddb
-ic:\temp\datadump.sql -oc:\temp\datadump.out <a
href="/cgi-bin/webnews.cgi/datadump.sql?cmd=itempart-4012&
part=3/datadump.sql">datadump.sql</a> dump database db to
datadumpdevice go
[Attachment: datadumpbat.txt]
[Attachment: datadump.sql]
Mark A. Parsons
2009-08-22 21:17:59 UTC
Permalink
What happens if you issue the 'run isql ...' command from a command window? Does it perform the dump or generate an error?

I don't 'do' Windows scripting (I prefer to use cygwin), but I'm wondering if the scheduled version of your script is
failing to pick up your Sybase environment variables thus leading to a failure of the 'run isql ...' command? (Does the
scheduler have any sort of errorlog that would capture any error messages? perhaps the windows event log?)

Have you tried modifying your batch file to first execute the c:/sybase/sybase.bat script in order to load your Sybase
environment settings, and then issue the 'run isql ...' syntax?
Post by unknown
After postig, I noticed I'm not able to open the attached
files so in case others can't open them either, I'll just
post the internal contents of the files here.
run isql.exe -Sserver -Uuid -Ppwd -Ddb
-ic:\temp\datadump.sql -oc:\temp\datadump.out
dump database db to datadumpdevice
go
Thanks,
Shawn
Post by unknown
I put together two files. One file (the batch file)
contains the command to run isql with the parameters
required to access the database. This file also
identifies an input file that contains SQL to be
processed. The second file is the input file itself that
contains the dump database sql command.
When I manually log into isql, I can run the dump database
command as listed in the second file and it runs
seamlessly.
However, when I run the batch file, nothing happens. Can
someone look at the two attached files and let me know
what I've done wrong. I just can't see what the problem
may be.
Regards,
Shawn
PS - I had to submit the bat file in .txt format since
it's not permissible to attach applications and such to
postings.
In my world, this file was datadump.bat.
[datadumpbat.txt]
run isql.exe -Sserver -Uuid -Ppwd -Ddb
-ic:\temp\datadump.sql -oc:\temp\datadump.out <a
href="/cgi-bin/webnews.cgi/datadump.sql?cmd=itempart-4012&
part=3/datadump.sql">datadump.sql</a> dump database db to
datadumpdevice go
[Attachment: datadumpbat.txt]
[Attachment: datadump.sql]
unknown
2009-08-24 14:15:01 UTC
Permalink
Mark,

No, the environment variables are loaded. When I go into
the command line and type "isql.exe -Sserver -Uuid -Ppwd
-Ddb" it opens the isql window with me automatically logged
into the server and set to the declared database. There
must be some issue with the -i and -o flags. The -i I
thought was to define a Transact SQL input file that would
be processed. The -o was for logging results to an output
file. I've double checked the paths of the files several
times to ensure they are accurate yet when I run my batch
file it continues to write to a Pwd (no extension) file.
Any other ideas?

Shawn
Post by Mark A. Parsons
What happens if you issue the 'run isql ...' command from
a command window? Does it perform the dump or generate an
error?
I don't 'do' Windows scripting (I prefer to use cygwin),
but I'm wondering if the scheduled version of your script
is failing to pick up your Sybase environment variables
thus leading to a failure of the 'run isql ...' command?
(Does the scheduler have any sort of errorlog that would
capture any error messages? perhaps the windows event
log?)
Have you tried modifying your batch file to first execute
the c:/sybase/sybase.bat script in order to load your
Sybase environment settings, and then issue the 'run isql
...' syntax?
Post by unknown
After postig, I noticed I'm not able to open the
attached files so in case others can't open them either,
I'll just post the internal contents of the files here.
run isql.exe -Sserver -Uuid -Ppwd -Ddb
-ic:\temp\datadump.sql -oc:\temp\datadump.out
dump database db to datadumpdevice
go
Thanks,
Shawn
Post by unknown
I put together two files. One file (the batch file)
contains the command to run isql with the parameters
required to access the database. This file also
identifies an input file that contains SQL to be
processed. The second file is the input file itself
that >> contains the dump database sql command.
Post by unknown
Post by unknown
When I manually log into isql, I can run the dump
database >> command as listed in the second file and it
runs >> seamlessly.
Post by unknown
Post by unknown
However, when I run the batch file, nothing happens.
Can >> someone look at the two attached files and let me
know >> what I've done wrong. I just can't see what the
problem >> may be.
Post by unknown
Post by unknown
Regards,
Shawn
PS - I had to submit the bat file in .txt format since
it's not permissible to attach applications and such to
postings.
In my world, this file was datadump.bat.
[datadumpbat.txt]
run isql.exe -Sserver -Uuid -Ppwd -Ddb
-ic:\temp\datadump.sql -oc:\temp\datadump.out <a
href="/cgi-bin/webnews.cgi/datadump.sql?cmd=itempart-4012&
Post by unknown
Post by unknown
part=3/datadump.sql">datadump.sql</a> dump database db
to >> datadumpdevice go
Post by unknown
Post by unknown
[Attachment: datadumpbat.txt]
[Attachment: datadump.sql]
unknown
2009-08-24 14:26:41 UTC
Permalink
Also, it's worth mentioning that when I'm in ISQL, I can
successfully run the script that's being requested as input
using the -i flag in the master batch file (namely "dump
database db to datadumpdevice").

It's also worth mentioning that the directories and
filenames being used as input and output have no spaces or
dashes in them to confuse isql.

Thus, the problem seems to fall squarely on the use of the
-i and -o flags. Is there another flag that I can use to
issue a solo command rather than requesting an input file
with transact sql statements? If so, a sample would help.

Thanks again,
Shawn
Post by unknown
Mark,
No, the environment variables are loaded. When I go into
the command line and type "isql.exe -Sserver -Uuid -Ppwd
-Ddb" it opens the isql window with me automatically
logged into the server and set to the declared database.
There must be some issue with the -i and -o flags. The -i
I thought was to define a Transact SQL input file that
would be processed. The -o was for logging results to an
output file. I've double checked the paths of the files
several times to ensure they are accurate yet when I run
my batch file it continues to write to a Pwd (no
extension) file. Any other ideas?
Shawn
Post by Mark A. Parsons
What happens if you issue the 'run isql ...' command
from a command window? Does it perform the dump or
generate an error?
I don't 'do' Windows scripting (I prefer to use cygwin),
but I'm wondering if the scheduled version of your
script is failing to pick up your Sybase environment
variables thus leading to a failure of the 'run isql
...' command? (Does the scheduler have any sort of
errorlog that would capture any error messages? perhaps
the windows event log?)
Have you tried modifying your batch file to first
execute the c:/sybase/sybase.bat script in order to load
your Sybase environment settings, and then issue the
'run isql ...' syntax?
Post by unknown
After postig, I noticed I'm not able to open the
attached files so in case others can't open them
either, I'll just post the internal contents of the
files here. >
Post by unknown
run isql.exe -Sserver -Uuid -Ppwd -Ddb
-ic:\temp\datadump.sql -oc:\temp\datadump.out
dump database db to datadumpdevice
go
Thanks,
Shawn
Post by unknown
I put together two files. One file (the batch file)
contains the command to run isql with the parameters
required to access the database. This file also
identifies an input file that contains SQL to be
processed. The second file is the input file itself
that >> contains the dump database sql command.
Post by unknown
Post by unknown
When I manually log into isql, I can run the dump
database >> command as listed in the second file and it
runs >> seamlessly.
Post by unknown
Post by unknown
However, when I run the batch file, nothing happens.
Can >> someone look at the two attached files and let me
know >> what I've done wrong. I just can't see what the
problem >> may be.
Post by unknown
Post by unknown
Regards,
Shawn
PS - I had to submit the bat file in .txt format
since >> it's not permissible to attach applications and
such to >> postings.
Post by unknown
Post by unknown
In my world, this file was datadump.bat.
[datadumpbat.txt]
run isql.exe -Sserver -Uuid -Ppwd -Ddb
-ic:\temp\datadump.sql -oc:\temp\datadump.out <a
href="/cgi-bin/webnews.cgi/datadump.sql?cmd=itempart-4012&
Post by Mark A. Parsons
Post by unknown
Post by unknown
part=3/datadump.sql">datadump.sql</a> dump database
datadumpbat.txt] >> [Attachment: datadump.sql]
Mark A. Parsons
2009-08-24 14:37:19 UTC
Permalink
What I was suggesting you try is the full *run isql* command from the command prompt, eg:

C:\>run isql.exe -Sserver -Uuid -Ppwd -Ddb -ic:\temp\datadump.sql -oc:\temp\datadump.out

This should validate the use of the '-i' and '-o' options, as well as validate isql's ability to locate your input file
and write to the output file.

We know that manually logging into isql and manually issuing the command succeeds, what I want you to do is to simulate
what the scheduled job is doing, ie, issue the same command that's being issued by the scheduler.

---------

As for the environment variables ... we know they're loaded ok for your manual attempts, but how do you know they're
loaded successfully by the scheduler process?

---------

And there's still the question of what (if any) messages are generated in the scheduler log when the scheduled job fails
to run? or perhaps the windows event logs?
Post by unknown
Mark,
No, the environment variables are loaded. When I go into
the command line and type "isql.exe -Sserver -Uuid -Ppwd
-Ddb" it opens the isql window with me automatically logged
into the server and set to the declared database. There
must be some issue with the -i and -o flags. The -i I
thought was to define a Transact SQL input file that would
be processed. The -o was for logging results to an output
file. I've double checked the paths of the files several
times to ensure they are accurate yet when I run my batch
file it continues to write to a Pwd (no extension) file.
Any other ideas?
Shawn
Post by Mark A. Parsons
What happens if you issue the 'run isql ...' command from
a command window? Does it perform the dump or generate an
error?
I don't 'do' Windows scripting (I prefer to use cygwin),
but I'm wondering if the scheduled version of your script
is failing to pick up your Sybase environment variables
thus leading to a failure of the 'run isql ...' command?
(Does the scheduler have any sort of errorlog that would
capture any error messages? perhaps the windows event
log?)
Have you tried modifying your batch file to first execute
the c:/sybase/sybase.bat script in order to load your
Sybase environment settings, and then issue the 'run isql
...' syntax?
Post by unknown
After postig, I noticed I'm not able to open the
attached files so in case others can't open them either,
I'll just post the internal contents of the files here.
run isql.exe -Sserver -Uuid -Ppwd -Ddb
-ic:\temp\datadump.sql -oc:\temp\datadump.out
dump database db to datadumpdevice
go
Thanks,
Shawn
Post by unknown
I put together two files. One file (the batch file)
contains the command to run isql with the parameters
required to access the database. This file also
identifies an input file that contains SQL to be
processed. The second file is the input file itself
that >> contains the dump database sql command.
Post by unknown
Post by unknown
When I manually log into isql, I can run the dump
database >> command as listed in the second file and it
runs >> seamlessly.
Post by unknown
Post by unknown
However, when I run the batch file, nothing happens.
Can >> someone look at the two attached files and let me
know >> what I've done wrong. I just can't see what the
problem >> may be.
Post by unknown
Post by unknown
Regards,
Shawn
PS - I had to submit the bat file in .txt format since
it's not permissible to attach applications and such to
postings.
In my world, this file was datadump.bat.
[datadumpbat.txt]
run isql.exe -Sserver -Uuid -Ppwd -Ddb
-ic:\temp\datadump.sql -oc:\temp\datadump.out <a
href="/cgi-bin/webnews.cgi/datadump.sql?cmd=itempart-4012&
Post by unknown
Post by unknown
part=3/datadump.sql">datadump.sql</a> dump database db
to >> datadumpdevice go
Post by unknown
Post by unknown
[Attachment: datadumpbat.txt]
[Attachment: datadump.sql]
unknown
2009-08-24 15:44:12 UTC
Permalink
Mark,

I tried running the full command via the command prompt 2
days ago BUT I wasn't getting any results. I was getting
neither a resulting output file NOR would I see the
resulting .dat file of the dump. Ummmmm...but today is a
different story. ?????

I tried this several times the other day but I was getting
nothing. Yet when I broke the pieces apart and issued the
command excluding the input/output files, it worked. Then I
could request the dump using the sytax from the input file
to do the database dump.

The ONLY thing I can think of other than the inexplicable is
that I tried this BEFORE issuing the first database dump. I
may have been testing using the log dump which of course is
not possible before the initial database dump. However, I
would have expected to have at least gotten the output file
generated with the detail saying such.

Either way, it seems to be working today. What changed
between now and then is anyone's guess...but hey, it's
working.

Thanks for your help!

Shawn
Post by Mark A. Parsons
What I was suggesting you try is the full *run isql*
C:\>run isql.exe -Sserver -Uuid -Ppwd -Ddb
-ic:\temp\datadump.sql -oc:\temp\datadump.out
This should validate the use of the '-i' and '-o' options,
as well as validate isql's ability to locate your input
file and write to the output file.
We know that manually logging into isql and manually
issuing the command succeeds, what I want you to do is to
simulate what the scheduled job is doing, ie, issue the
same command that's being issued by the scheduler.
---------
As for the environment variables ... we know they're
loaded ok for your manual attempts, but how do you know
they're loaded successfully by the scheduler process?
---------
And there's still the question of what (if any) messages
are generated in the scheduler log when the scheduled job
fails to run? or perhaps the windows event logs?
Post by unknown
Mark,
No, the environment variables are loaded. When I go
into the command line and type "isql.exe -Sserver -Uuid
-Ppwd -Ddb" it opens the isql window with me
automatically logged into the server and set to the
declared database. There must be some issue with the -i
and -o flags. The -i I thought was to define a Transact
SQL input file that would be processed. The -o was for
logging results to an output file. I've double checked
the paths of the files several times to ensure they are
accurate yet when I run my batch file it continues to
write to a Pwd (no extension) file. Any other ideas?
Shawn
Post by Mark A. Parsons
What happens if you issue the 'run isql ...' command
from >> a command window? Does it perform the dump or
generate an >> error?
Post by unknown
Post by Mark A. Parsons
I don't 'do' Windows scripting (I prefer to use cygwin)
, >> but I'm wondering if the scheduled version of your
script >> is failing to pick up your Sybase environment
variables >> thus leading to a failure of the 'run isql
..' command? >> (Does the scheduler have any sort of
errorlog that would >> capture any error messages?
perhaps the windows event >> log?)
Post by unknown
Post by Mark A. Parsons
Have you tried modifying your batch file to first
execute >> the c:/sybase/sybase.bat script in order to
load your >> Sybase environment settings, and then issue
the 'run isql >> ...' syntax?
Post by unknown
Post by Mark A. Parsons
Post by unknown
After postig, I noticed I'm not able to open the
attached files so in case others can't open them
either, >>> I'll just post the internal contents of the
files here. >>>
Post by unknown
Post by Mark A. Parsons
Post by unknown
run isql.exe -Sserver -Uuid -Ppwd -Ddb
-ic:\temp\datadump.sql -oc:\temp\datadump.out
dump database db to datadumpdevice
go
Thanks,
Shawn
Post by unknown
I put together two files. One file (the batch file)
contains the command to run isql with the parameters
required to access the database. This file also
identifies an input file that contains SQL to be
processed. The second file is the input file itself
that >> contains the dump database sql command.
Post by unknown
Post by unknown
When I manually log into isql, I can run the dump
database >> command as listed in the second file and it
runs >> seamlessly.
Post by unknown
Post by unknown
However, when I run the batch file, nothing happens.
Can >> someone look at the two attached files and let
me >> know >> what I've done wrong. I just can't see what
the >> problem >> may be.
Post by unknown
Post by Mark A. Parsons
Post by unknown
Post by unknown
Regards,
Shawn
PS - I had to submit the bat file in .txt format
since >>>> it's not permissible to attach applications and
such to >>>> postings.
Post by unknown
Post by Mark A. Parsons
Post by unknown
Post by unknown
In my world, this file was datadump.bat.
[datadumpbat.txt]
run isql.exe -Sserver -Uuid -Ppwd -Ddb
-ic:\temp\datadump.sql -oc:\temp\datadump.out <a
href="/cgi-bin/webnews.cgi/datadump.sql?cmd=itempart-4012&
Post by unknown
Post by Mark A. Parsons
Post by unknown
Post by unknown
part=3/datadump.sql">datadump.sql</a> dump database
db >> to >> datadumpdevice go
Post by unknown
Post by Mark A. Parsons
Post by unknown
Post by unknown
[Attachment: datadumpbat.txt]
[Attachment: datadump.sql]
unknown
2009-09-04 20:33:44 UTC
Permalink
I was mistaken in my most recent reporting. When I run the
command "isql.exe -Sserver -Uuserid -Ppassword -Ddatabase
-iD:\sybase\dump.sql -oD:\sybase\dump.out" by way of
Start...Run...it runs successfully. It process and writes
the output to the out file and backs up the database. If
this same command is embedded in a batch file, run as a
scheduled task, or executed in any other way, it fails.
When it fails, it creates a Pwd file with nothing in it.

Why would it run successfully when issued via
Start...Run...but fail to run in every other way?

Any ideas? We're baffled.

Shawn
Post by unknown
Mark,
I tried running the full command via the command prompt 2
days ago BUT I wasn't getting any results. I was getting
neither a resulting output file NOR would I see the
resulting .dat file of the dump. Ummmmm...but today is a
different story. ?????
I tried this several times the other day but I was getting
nothing. Yet when I broke the pieces apart and issued the
command excluding the input/output files, it worked. Then
I could request the dump using the sytax from the input
file to do the database dump.
The ONLY thing I can think of other than the inexplicable
is that I tried this BEFORE issuing the first database
dump. I may have been testing using the log dump which of
course is not possible before the initial database dump.
However, I would have expected to have at least gotten the
output file generated with the detail saying such.
Either way, it seems to be working today. What changed
between now and then is anyone's guess...but hey, it's
working.
Thanks for your help!
Shawn
Post by Mark A. Parsons
What I was suggesting you try is the full *run isql*
C:\>run isql.exe -Sserver -Uuid -Ppwd -Ddb
-ic:\temp\datadump.sql -oc:\temp\datadump.out
This should validate the use of the '-i' and '-o'
options, as well as validate isql's ability to locate
your input file and write to the output file.
We know that manually logging into isql and manually
issuing the command succeeds, what I want you to do is
to simulate what the scheduled job is doing, ie, issue
the same command that's being issued by the scheduler.
---------
As for the environment variables ... we know they're
loaded ok for your manual attempts, but how do you know
they're loaded successfully by the scheduler process?
---------
And there's still the question of what (if any) messages
are generated in the scheduler log when the scheduled
job fails to run? or perhaps the windows event logs?
Post by unknown
Mark,
No, the environment variables are loaded. When I go
into the command line and type "isql.exe -Sserver
-Uuid -Ppwd -Ddb" it opens the isql window with me
automatically logged into the server and set to the
declared database. There must be some issue with the
-i and -o flags. The -i I thought was to define a
Transact SQL input file that would be processed. The
-o was for logging results to an output file. I've
double checked the paths of the files several times to
ensure they are accurate yet when I run my batch file
it continues to write to a Pwd (no extension) file.
Any other ideas? >
Post by unknown
Shawn
Post by Mark A. Parsons
What happens if you issue the 'run isql ...' command
from >> a command window? Does it perform the dump or
generate an >> error?
Post by unknown
Post by Mark A. Parsons
I don't 'do' Windows scripting (I prefer to use
cygwin) , >> but I'm wondering if the scheduled version
of your script >> is failing to pick up your Sybase
environment variables >> thus leading to a failure of
the 'run isql ..' command? >> (Does the scheduler have
any sort of errorlog that would >> capture any error
messages? perhaps the windows event >> log?)
Post by unknown
Post by Mark A. Parsons
Have you tried modifying your batch file to first
execute >> the c:/sybase/sybase.bat script in order to
load your >> Sybase environment settings, and then
issue the 'run isql >> ...' syntax?
Post by unknown
Post by Mark A. Parsons
Post by unknown
After postig, I noticed I'm not able to open the
attached files so in case others can't open them
either, >>> I'll just post the internal contents of the
files here. >>>
Post by unknown
Post by Mark A. Parsons
Post by unknown
run isql.exe -Sserver -Uuid -Ppwd -Ddb
-ic:\temp\datadump.sql -oc:\temp\datadump.out
dump database db to datadumpdevice
go
Thanks,
Shawn
Post by unknown
I put together two files. One file (the batch
file) >>>> contains the command to run isql with the
parameters >>>> required to access the database. This
file also >>>> identifies an input file that contains
SQL to be >>>> processed. The second file is the input
file itself >> that >> contains the dump database sql
command. >>>> When I manually log into isql, I can run
the dump >> database >> command as listed in the second
file and it >> runs >> seamlessly.
Post by unknown
Post by Mark A. Parsons
Post by unknown
Post by unknown
However, when I run the batch file, nothing
happens. >> Can >> someone look at the two attached
files and let me >> know >> what I've done wrong. I
just can't see what the >> problem >> may be.
Post by unknown
Post by Mark A. Parsons
Post by unknown
Post by unknown
Regards,
Shawn
PS - I had to submit the bat file in .txt format
since >>>> it's not permissible to attach applications
and such to >>>> postings.
Post by unknown
Post by Mark A. Parsons
Post by unknown
Post by unknown
In my world, this file was datadump.bat.
[datadumpbat.txt]
run isql.exe -Sserver -Uuid -Ppwd -Ddb
-ic:\temp\datadump.sql -oc:\temp\datadump.out <a
href="/cgi-bin/webnews.cgi/datadump.sql?cmd=itempart-4012&
Post by Mark A. Parsons
Post by unknown
Post by Mark A. Parsons
Post by unknown
Post by unknown
part=3/datadump.sql">datadump.sql</a> dump database
datadumpbat.txt] >>>> [Attachment: datadump.sql]
Mark A. Parsons
2009-09-04 20:44:04 UTC
Permalink
As I've mentioned before, my guess is that the scheduled job is not loading your Sybase environment variables, thus
causing the 'isql' command to fail.

What happens if in your script file the first thing you do is run the %SYBASE%/SYBASE.bat file and *then* run the isql
command?

-----------

And *again* ... have you checked the Windows event log around the time that the script is suppose to run? If the script
file is generating an error it will send the error message to the client front-end, but since this is a scheduled job
(ie, no client front-end) there's a good chance that any error messages will get dumped in the Windows event log.

If this is a case of your Sybase environment variables not being sent then I'd expect to see a message in the Windows
event logs stating something to the effect that 'isql' is an invalid command.
Post by unknown
I was mistaken in my most recent reporting. When I run the
command "isql.exe -Sserver -Uuserid -Ppassword -Ddatabase
-iD:\sybase\dump.sql -oD:\sybase\dump.out" by way of
Start...Run...it runs successfully. It process and writes
the output to the out file and backs up the database. If
this same command is embedded in a batch file, run as a
scheduled task, or executed in any other way, it fails.
When it fails, it creates a Pwd file with nothing in it.
Why would it run successfully when issued via
Start...Run...but fail to run in every other way?
Any ideas? We're baffled.
Shawn
Post by unknown
Mark,
I tried running the full command via the command prompt 2
days ago BUT I wasn't getting any results. I was getting
neither a resulting output file NOR would I see the
resulting .dat file of the dump. Ummmmm...but today is a
different story. ?????
I tried this several times the other day but I was getting
nothing. Yet when I broke the pieces apart and issued the
command excluding the input/output files, it worked. Then
I could request the dump using the sytax from the input
file to do the database dump.
The ONLY thing I can think of other than the inexplicable
is that I tried this BEFORE issuing the first database
dump. I may have been testing using the log dump which of
course is not possible before the initial database dump.
However, I would have expected to have at least gotten the
output file generated with the detail saying such.
Either way, it seems to be working today. What changed
between now and then is anyone's guess...but hey, it's
working.
Thanks for your help!
Shawn
Post by Mark A. Parsons
What I was suggesting you try is the full *run isql*
C:\>run isql.exe -Sserver -Uuid -Ppwd -Ddb
-ic:\temp\datadump.sql -oc:\temp\datadump.out
This should validate the use of the '-i' and '-o'
options, as well as validate isql's ability to locate
your input file and write to the output file.
We know that manually logging into isql and manually
issuing the command succeeds, what I want you to do is
to simulate what the scheduled job is doing, ie, issue
the same command that's being issued by the scheduler.
---------
As for the environment variables ... we know they're
loaded ok for your manual attempts, but how do you know
they're loaded successfully by the scheduler process?
---------
And there's still the question of what (if any) messages
are generated in the scheduler log when the scheduled
job fails to run? or perhaps the windows event logs?
Post by unknown
Mark,
No, the environment variables are loaded. When I go
into the command line and type "isql.exe -Sserver
-Uuid -Ppwd -Ddb" it opens the isql window with me
automatically logged into the server and set to the
declared database. There must be some issue with the
-i and -o flags. The -i I thought was to define a
Transact SQL input file that would be processed. The
-o was for logging results to an output file. I've
double checked the paths of the files several times to
ensure they are accurate yet when I run my batch file
it continues to write to a Pwd (no extension) file.
Any other ideas? >
Post by unknown
Shawn
Post by Mark A. Parsons
What happens if you issue the 'run isql ...' command
from >> a command window? Does it perform the dump or
generate an >> error?
Post by unknown
Post by Mark A. Parsons
I don't 'do' Windows scripting (I prefer to use
cygwin) , >> but I'm wondering if the scheduled version
of your script >> is failing to pick up your Sybase
environment variables >> thus leading to a failure of
the 'run isql ..' command? >> (Does the scheduler have
any sort of errorlog that would >> capture any error
messages? perhaps the windows event >> log?)
Post by unknown
Post by Mark A. Parsons
Have you tried modifying your batch file to first
execute >> the c:/sybase/sybase.bat script in order to
load your >> Sybase environment settings, and then
issue the 'run isql >> ...' syntax?
Post by unknown
Post by Mark A. Parsons
Post by unknown
After postig, I noticed I'm not able to open the
attached files so in case others can't open them
either, >>> I'll just post the internal contents of the
files here. >>>
Post by unknown
Post by Mark A. Parsons
Post by unknown
run isql.exe -Sserver -Uuid -Ppwd -Ddb
-ic:\temp\datadump.sql -oc:\temp\datadump.out
dump database db to datadumpdevice
go
Thanks,
Shawn
Post by unknown
I put together two files. One file (the batch
file) >>>> contains the command to run isql with the
parameters >>>> required to access the database. This
file also >>>> identifies an input file that contains
SQL to be >>>> processed. The second file is the input
file itself >> that >> contains the dump database sql
command. >>>> When I manually log into isql, I can run
the dump >> database >> command as listed in the second
file and it >> runs >> seamlessly.
Post by unknown
Post by Mark A. Parsons
Post by unknown
Post by unknown
However, when I run the batch file, nothing
happens. >> Can >> someone look at the two attached
files and let me >> know >> what I've done wrong. I
just can't see what the >> problem >> may be.
Post by unknown
Post by Mark A. Parsons
Post by unknown
Post by unknown
Regards,
Shawn
PS - I had to submit the bat file in .txt format
since >>>> it's not permissible to attach applications
and such to >>>> postings.
Post by unknown
Post by Mark A. Parsons
Post by unknown
Post by unknown
In my world, this file was datadump.bat.
[datadumpbat.txt]
run isql.exe -Sserver -Uuid -Ppwd -Ddb
-ic:\temp\datadump.sql -oc:\temp\datadump.out <a
href="/cgi-bin/webnews.cgi/datadump.sql?cmd=itempart-4012&
Post by Mark A. Parsons
Post by unknown
Post by Mark A. Parsons
Post by unknown
Post by unknown
part=3/datadump.sql">datadump.sql</a> dump database
datadumpbat.txt] >>>> [Attachment: datadump.sql]
unknown
2009-09-05 01:45:34 UTC
Permalink
I have a feeling this is an ASE 12.5.1 / Windows 2003
compatibility issue. Sybase pulled a not-so-nice one right
after my customer purchased version 12.5.1 some years
back...namely they made version 12.5.2 which was Windows
2003 certified as an upgrade, meaning a USP was required or
the upgrade was only available at a cost.

As my customer's first experience with Sybase, he was not
pleased. We navigated around the install by using Windows
NT compatibility mode THEN after that everything seemed to
be fine on Windows 2003, even though it was not certified
for Windows 2003 by Sybase. It looks like we just found our
first compatibility issue. It has to be...everything you've
recommended makes no difference. The only way it will run
successfully is to run the command from the Run prompt. It
will not run as a scheduled task. It will not run embedded
in a batch file. It just can't be scheduled.

Since there's no support for 12.5.1 any longer, let alone
for 12.5.1 on Windows 2003 Server, my recommendation to him
was to set up a policy to have an employee run this manually
every night. If times were better, I'm sure he'd consider
upgrading but we all know what the economy is like these
days.

Thanks for trying Mark. I appreciate it!

Shawn
Post by Mark A. Parsons
As I've mentioned before, my guess is that the scheduled
job is not loading your Sybase environment variables, thus
causing the 'isql' command to fail.
What happens if in your script file the first thing you do
is run the %SYBASE%/SYBASE.bat file and *then* run the
isql command?
-----------
And *again* ... have you checked the Windows event log
around the time that the script is suppose to run? If the
script file is generating an error it will send the error
message to the client front-end, but since this is a
scheduled job (ie, no client front-end) there's a good
chance that any error messages will get dumped in the
Windows event log.
If this is a case of your Sybase environment variables not
being sent then I'd expect to see a message in the Windows
event logs stating something to the effect that 'isql' is
an invalid command.
Post by unknown
I was mistaken in my most recent reporting. When I run
the command "isql.exe -Sserver -Uuserid -Ppassword
-Ddatabase -iD:\sybase\dump.sql -oD:\sybase\dump.out" by
way of Start...Run...it runs successfully. It process
and writes the output to the out file and backs up the
database. If this same command is embedded in a batch
file, run as a scheduled task, or executed in any other
way, it fails. When it fails, it creates a Pwd file
with nothing in it.
Why would it run successfully when issued via
Start...Run...but fail to run in every other way?
Any ideas? We're baffled.
Shawn
Post by unknown
Mark,
I tried running the full command via the command prompt
2 >> days ago BUT I wasn't getting any results. I was
getting >> neither a resulting output file NOR would I see
the >> resulting .dat file of the dump. Ummmmm...but
today is a >> different story. ?????
Post by unknown
Post by unknown
I tried this several times the other day but I was
getting >> nothing. Yet when I broke the pieces apart and
issued the >> command excluding the input/output files, it
worked. Then >> I could request the dump using the sytax
from the input >> file to do the database dump.
Post by unknown
Post by unknown
The ONLY thing I can think of other than the
inexplicable >> is that I tried this BEFORE issuing the
first database >> dump. I may have been testing using the
log dump which of >> course is not possible before the
initial database dump. >> However, I would have expected
to have at least gotten the >> output file generated with
the detail saying such. >>
Post by unknown
Post by unknown
Either way, it seems to be working today. What changed
between now and then is anyone's guess...but hey, it's
working.
Thanks for your help!
Shawn
Post by Mark A. Parsons
What I was suggesting you try is the full *run isql*
C:\>run isql.exe -Sserver -Uuid -Ppwd -Ddb
-ic:\temp\datadump.sql -oc:\temp\datadump.out
This should validate the use of the '-i' and '-o'
options, as well as validate isql's ability to locate
your input file and write to the output file.
We know that manually logging into isql and manually
issuing the command succeeds, what I want you to do is
to simulate what the scheduled job is doing, ie,
issue >>> the same command that's being issued by the
scheduler. >>>
Post by unknown
Post by unknown
Post by Mark A. Parsons
---------
As for the environment variables ... we know they're
loaded ok for your manual attempts, but how do you
know >>> they're loaded successfully by the scheduler
process? >>>
Post by unknown
Post by unknown
Post by Mark A. Parsons
---------
And there's still the question of what (if any)
messages >>> are generated in the scheduler log when the
scheduled >>> job fails to run? or perhaps the windows
event logs? >>>
Post by unknown
Post by unknown
Post by Mark A. Parsons
Post by unknown
Mark,
No, the environment variables are loaded. When I go
into the command line and type "isql.exe -Sserver
-Uuid -Ppwd -Ddb" it opens the isql window with me
automatically logged into the server and set to the
declared database. There must be some issue with the
-i and -o flags. The -i I thought was to define a
Transact SQL input file that would be processed. The
-o was for logging results to an output file. I've
double checked the paths of the files several times
to >>>> ensure they are accurate yet when I run my batch
file >>>> it continues to write to a Pwd (no extension)
file. >>> Any other ideas? >
Post by unknown
Post by unknown
Post by Mark A. Parsons
Post by unknown
Shawn
Post by Mark A. Parsons
What happens if you issue the 'run isql ...' command
from >> a command window? Does it perform the dump or
generate an >> error?
Post by unknown
Post by Mark A. Parsons
I don't 'do' Windows scripting (I prefer to use
cygwin) , >> but I'm wondering if the scheduled
version >>> of your script >> is failing to pick up your
Sybase >>> environment variables >> thus leading to a
failure of >>> the 'run isql ..' command? >> (Does the
scheduler have >>> any sort of errorlog that would >>
capture any error >>> messages? perhaps the windows event
Post by unknown
Post by unknown
log?) >>>>> Have you tried modifying your batch file to
first >>> execute >> the c:/sybase/sybase.bat script in
order to >>> load your >> Sybase environment settings,
and then >>> issue the 'run isql >> ...' syntax?
Post by unknown
Post by unknown
Post by Mark A. Parsons
Post by unknown
Post by Mark A. Parsons
Post by unknown
After postig, I noticed I'm not able to open the
attached files so in case others can't open them
either, >>> I'll just post the internal contents of
the >>> files here. >>>
Post by unknown
Post by unknown
Post by Mark A. Parsons
Post by unknown
Post by Mark A. Parsons
Post by unknown
run isql.exe -Sserver -Uuid -Ppwd -Ddb
-ic:\temp\datadump.sql -oc:\temp\datadump.out
dump database db to datadumpdevice
go
Thanks,
Shawn
Post by unknown
I put together two files. One file (the batch
file) >>>> contains the command to run isql with the
parameters >>>> required to access the database. This
file also >>>> identifies an input file that contains
SQL to be >>>> processed. The second file is the
input >>> file itself >> that >> contains the dump
database sql >>> command. >>>> When I manually log into
isql, I can run >>> the dump >> database >> command as
listed in the second >>> file and it >> runs >>
seamlessly. >>>>>>> However, when I run the batch file,
nothing >>> happens. >> Can >> someone look at the two
attached >>> files and let me >> know >> what I've done
wrong. I >>> just can't see what the >> problem >> may
be. >>>>>>> Regards,
Post by unknown
Post by unknown
Post by Mark A. Parsons
Post by unknown
Post by Mark A. Parsons
Post by unknown
Post by unknown
Shawn
PS - I had to submit the bat file in .txt format
since >>>> it's not permissible to attach applications
and such to >>>> postings.
Post by unknown
Post by Mark A. Parsons
Post by unknown
Post by unknown
In my world, this file was datadump.bat.
[datadumpbat.txt]
run isql.exe -Sserver -Uuid -Ppwd -Ddb
-ic:\temp\datadump.sql -oc:\temp\datadump.out <a
href="/cgi-bin/webnews.cgi/datadump.sql?cmd=itempart-4012&
Post by unknown
Post by unknown
Post by Mark A. Parsons
Post by unknown
Post by Mark A. Parsons
Post by unknown
Post by unknown
part=3/datadump.sql">datadump.sql</a> dump
database >>> db >> to >> datadumpdevice go >>>>
datadump.sql]
Mark A. Parsons
2009-09-05 15:46:35 UTC
Permalink
The fact that the script file and individual commands can be run at the command prompt would seem to imply that there
are no compatibility issues. While I guess there's always a possibility of a bug with the interaction between the
windows scheduler and ASE, it sounds more like either a) a script writing/format issue or b) configuration issue.

Unfortunately you (still) haven't told us exactly what you've tested and/or the results of said tests (eg, what happens
if you add SYBASE.bat to the scheduled script file? what error messages (if any) are generated by the scheduled script
file?) so .... we'll try this one last time ...



1 - create a test SQL script in c:\temp:

======================= c:\temp\test.sql
select convert(varchar,getdate(),109)
go
select @@servername
go
select @@version
go
=======================



2 - create a test batch script in c:\temp:

======================= c:\temp\test.bat
set
cd c:\temp
run isql.exe -Sserver -Uuid -Ppwd -Ddb -ic:\temp\test.sql -oc:\temp\test.out
=======================



3 - modify the windows scheduler job as follows:

- Start in: c:\temp
- Run: c:\temp\test.bat > test.bat.out 2>&1



4 - remove any pre-existing c:\temp\test.bat.out and c:\temp\test.out files



5 - schedule the job to run (since we're only running some SELECT statements just schedule this to run a couple minutes
from the time you're ready to test)



6 - post the entire contents of the c:\temp\test.bat.out and c:\temp\test.out files
Post by unknown
I have a feeling this is an ASE 12.5.1 / Windows 2003
compatibility issue. Sybase pulled a not-so-nice one right
after my customer purchased version 12.5.1 some years
back...namely they made version 12.5.2 which was Windows
2003 certified as an upgrade, meaning a USP was required or
the upgrade was only available at a cost.
As my customer's first experience with Sybase, he was not
pleased. We navigated around the install by using Windows
NT compatibility mode THEN after that everything seemed to
be fine on Windows 2003, even though it was not certified
for Windows 2003 by Sybase. It looks like we just found our
first compatibility issue. It has to be...everything you've
recommended makes no difference. The only way it will run
successfully is to run the command from the Run prompt. It
will not run as a scheduled task. It will not run embedded
in a batch file. It just can't be scheduled.
Since there's no support for 12.5.1 any longer, let alone
for 12.5.1 on Windows 2003 Server, my recommendation to him
was to set up a policy to have an employee run this manually
every night. If times were better, I'm sure he'd consider
upgrading but we all know what the economy is like these
days.
unknown
2009-09-13 19:35:15 UTC
Permalink
Mark,

Thanks for the detailed instructions. The only reason I
wasn't posting the files you were requesting is because,
quite frankly, I didn't have any files worth posting. Your
instructions helped to solve that.

Now, as you can see though, I still didn't post any files.
It looks like we can see the problem now. Our password for
logging into the database has a greater than sign in it. We
noticed when we looked at the test.bat.out file that the
password (let's say it was secret>pwd) was being truncated
to just secret. The >pwd was being appended to the end of
the command to be processed as 1>pwd.

Ex:
isql.exe -Sserver -Uuid -Psecret>pwd -Ddatabase -itest.sql
-otest.out

Resulting run command issued upon running the batch file:
isql.exe -Sserver -Uuid -Psecret -Ddatabase -itest.sql
-otest.out 1>pwd

Knowing this, my network admin guy did some research and
learned that characters | < > and sometimes ! are treated
special. It says you can prefix it with a ^ to have it be
treated normal. The moral of the story: don't use any of
those characters in your passwords!

Thanks Mark. We wouldn't have figured this one out without
your help!!!

Shawn

The moral of the story: don't use
Post by Mark A. Parsons
The fact that the script file and individual commands can
be run at the command prompt would seem to imply that
there are no compatibility issues. While I guess there's
always a possibility of a bug with the interaction between
the windows scheduler and ASE, it sounds more like either
a) a script writing/format issue or b) configuration
issue.
Unfortunately you (still) haven't told us exactly what
you've tested and/or the results of said tests (eg, what
happens if you add SYBASE.bat to the scheduled script
file? what error messages (if any) are generated by the
scheduled script file?) so .... we'll try this one last
time ...
======================= c:\temp\test.sql
select convert(varchar,getdate(),109)
go
go
go
=======================
======================= c:\temp\test.bat
set
cd c:\temp
run isql.exe -Sserver -Uuid -Ppwd -Ddb -ic:\temp\test.sql
-oc:\temp\test.out =======================
- Start in: c:\temp
- Run: c:\temp\test.bat > test.bat.out 2>&1
4 - remove any pre-existing c:\temp\test.bat.out and
c:\temp\test.out files
5 - schedule the job to run (since we're only running some
SELECT statements just schedule this to run a couple
minutes from the time you're ready to test)
6 - post the entire contents of the c:\temp\test.bat.out
and c:\temp\test.out files
Post by unknown
I have a feeling this is an ASE 12.5.1 / Windows 2003
compatibility issue. Sybase pulled a not-so-nice one
right after my customer purchased version 12.5.1 some
years back...namely they made version 12.5.2 which was
Windows 2003 certified as an upgrade, meaning a USP was
required or the upgrade was only available at a cost.
As my customer's first experience with Sybase, he was
not pleased. We navigated around the install by using
Windows NT compatibility mode THEN after that everything
seemed to be fine on Windows 2003, even though it was
not certified for Windows 2003 by Sybase. It looks like
we just found our first compatibility issue. It has to
be...everything you've recommended makes no difference.
The only way it will run successfully is to run the
command from the Run prompt. It will not run as a
scheduled task. It will not run embedded in a batch
file. It just can't be scheduled.
Since there's no support for 12.5.1 any longer, let
alone for 12.5.1 on Windows 2003 Server, my
recommendation to him was to set up a policy to have an
employee run this manually every night. If times were
better, I'm sure he'd consider upgrading but we all know
what the economy is like these days.
Loading...