Showing posts with label active. Show all posts
Showing posts with label active. Show all posts

Tuesday, March 27, 2012

Duplicate records are being inserted with one insert command.

This is like the bug from hell. It is kind of hard to explain, so
please bear with me.

Background Info: SQL Server 7.0, on an NT box, Active Server pages
with Javascript, using ADO objects.

I'm inserting simple records into a table. But one insert command is
placing 2 or 3 records into the table. The 'extra' records, have the
same data as the previous insert incident, (except for the timestamp).

Here is an example. Follow the values of the 'Search String' field:

I inserted one record at a time, in the following order (And only one
insert per item):
airplane
jet
dog
cat
mouse
tiger

After this, I should have had 6 records in the table. But, I ended
up with 11!

Here is what was recorded in the database:

Vid DateTime Type ProductName SearchString NumResults
cgcgGeorgeWeb3 Fri Sep 26 09:48:26 PDT 2003 i null airplane 112
cgcgGeorgeWeb3 Fri Sep 26 09:49:37 PDT 2003 i null jet 52
cgcgGeorgeWeb3 Fri Sep 26 09:50:00 PDT 2003 i null dog 49
cgcgGeorgeWeb3 Fri Sep 26 09:50:00 PDT 2003 i null jet 52
cgcgGeorgeWeb3 Fri Sep 26 09:50:00 PDT 2003 i null jet 52
cgcgGeorgeWeb3 Fri Sep 26 09:50:22 PDT 2003 i null dog 49
cgcgGeorgeWeb3 Fri Sep 26 09:50:22 PDT 2003 i null cat 75
cgcgGeorgeWeb3 Fri Sep 26 09:52:53 PDT 2003 i null mouse 64
cgcgGeorgeWeb3 Fri Sep 26 09:53:06 PDT 2003 i null tiger 14
cgcgGeorgeWeb3 Fri Sep 26 09:53:06 PDT 2003 i null mouse 64
cgcgGeorgeWeb3 Fri Sep 26 09:53:06 PDT 2003 i null mouse 64

Look at the timestamps, and notice which ones are the same.

I did one insert for 'dog' , but notice how 2 'jet' records were
inserted
at the same time. Then, when I inserted the 'cat' record, another
'dog' record was inserted. I waited awhile, and inserted mouse, and
only the mouse was inserted. But soon after, I inserted 'tiger', and 2
more mouse records were inserted.

If I wait awhile between inserts, then no extra records are inserted.
( Notice 'airplane', and the first 'mouse' entries. ) But if I insert
records right after one another, then the second record insertion also
inserts a record with data from the 1st insertion.

Here is the complete function, in Javascript (The main code of
interest
may start at the Query = "INSERT ... statement):
----------------------
//Write SearchTrack Record -----------

Search.prototype.writeSearchTrackRec = function(){
Response.Write ("<br>Calling function writeSearchTrack \n"); // for
debug
var Query;
var vid;
var type = "i"; // Type is image
var Q = "', '";
var datetime = "GETDATE()";
//Get the Vid
// First - try to get from the outVid var of Cookieinc
try{
vid = outVid;
}catch(e){
vid = Request.Cookies("CGIVid"); // Gets cookie id value
vid = ""+vid;
if (vid == 'undefined' || vid == ""){
vid = "ImageSearchNoVid";
}
}

try{
Query = "INSERT SearchTrack (Vid, Type, SearchString, DateTime,
NumResults) ";
Query += "VALUES ('"+vid+Q+type+Q+this.searchString+"',
"+datetime+","+this.numResults+ ")";
this.cmd.CommandText = Query;
this.cmd.Execute();
}catch(e){
writeGenericErrLog("Insert SearchTrack failed", "Vid: "+vid+"
- SearchString:: "+this.searchString+" - NumResults: "+this.numResults
, e.description);

}
}//end

--------------------
I also wrote a non-object oriented function, and created the command
object inside the function. But I had the same results.

I know that the function is not getting called multiple times
because I print out a message each time it is called.

This really stumps me. I'll really appreciate any help you can
offer.

Thanks,

George"george" <georgem@.crystalgraphics.com> wrote in message
news:620c2f02.0309261014.20789ca0@.posting.google.c om...
> This is like the bug from hell. It is kind of hard to explain, so
> please bear with me.

<snip
I have no idea what's causing the issue, but the usual advice is to use
Profiler to trace the SQL which is getting sent to the database. You may see
something in the statements which helps you pin down what's going on.
Another thing to check is if there is an INSERT trigger on the table.

Simon|||"Simon Hayes" <sql@.hayes.ch> wrote in message news:<3f756b8c_4@.news.bluewin.ch>...
> "george" <georgem@.crystalgraphics.com> wrote in message
> news:620c2f02.0309261014.20789ca0@.posting.google.c om...
> > This is like the bug from hell. It is kind of hard to explain, so
> > please bear with me.
> <snip>
> I have no idea what's causing the issue, but the usual advice is to use
> Profiler to trace the SQL which is getting sent to the database. You may see
> something in the statements which helps you pin down what's going on.
> Another thing to check is if there is an INSERT trigger on the table.
> Simon

Thanks for your help. I found the cause. This is a web page that
contained a form. The form had a button with an onClick event handler
that evolked a script that submitted the form. Well, I added another
form to the page, and wanted the form to be submitted when the user
pushed the 'enter' key, so I focused the new submit button, and put an
onSubmit event handler in the new form. But the onSubmit event handler
evolked the before-mentioned script, so apparently two forms were
being submitted. One form had a hidden form element that contained
the previous 'search string' and the other form had an input box for
the current 'search string'. It explains why 2 db inserts happened
when I submitted the form, but it does not explain why sometimes 3
inserts happened. Anyway, it was kind of difficult to debug, because
it was not evident that 2 forms were being submitted, because, to the
user, the page worked just fine.

Well, perhaps this incident will help someone else down the road who
may run into this situation.

George

Sunday, March 11, 2012

Dual trans logs

Hello,
I have a server with two active transaction logs on 1
database and need to remove one, the problem arises when
I try to. Anyone advise on a procedure to do this?
Thank you in advance,
Tom
tww@.ccsiservices.comExactly how are you attempting this and what is the actual error?
--
Andrew J. Kelly
SQL Server MVP
"Tom" <anonymous@.discussions.microsoft.com> wrote in message
news:009201c3a560$32807a30$a501280a@.phx.gbl...
> Hello,
> I have a server with two active transaction logs on 1
> database and need to remove one, the problem arises when
> I try to. Anyone advise on a procedure to do this?
> Thank you in advance,
> Tom
> tww@.ccsiservices.com|||Well I have not tried yet, though I spoke with someone
who was trying. I am off-site and will be going into the
office tomorrow to take a look. They opened database
properties in the Enterprise Manager and tried to just
delete the extra log file (which we are still trying to
figure out why it was put there) but it says something
about the file has to be empty to remove it..etc. If the
actual error is needed I can get it later today. I was
online and decided to post this query to see if anyone
had experience with this.
on a side note, the system is not secured and this extra
log file setting was setup on Wednesday this week, during
maintenance it was noticed. I have been out of the office
so I am still getting all the facts.
Thank you,
Tom
>--Original Message--
>Exactly how are you attempting this and what is the
actual error?
>--
>Andrew J. Kelly
>SQL Server MVP
>
>"Tom" <anonymous@.discussions.microsoft.com> wrote in
message
>news:009201c3a560$32807a30$a501280a@.phx.gbl...
>> Hello,
>> I have a server with two active transaction logs on 1
>> database and need to remove one, the problem arises
when
>> I try to. Anyone advise on a procedure to do this?
>> Thank you in advance,
>> Tom
>> tww@.ccsiservices.com
>
>.
>|||OK that's more to go on. Take a look at DBCC SHRINKFILE and pay attention
to the EMPTYFILE option in BooksOnLine. You need to move any data to the
other file and it gets marked so as it doesn't fill again. Then you can use
ALTER DATABASE to drop the file.
--
Andrew J. Kelly
SQL Server MVP
"Tom" <anonymous@.discussions.microsoft.com> wrote in message
news:01dd01c3a572$1a280130$a601280a@.phx.gbl...
> Well I have not tried yet, though I spoke with someone
> who was trying. I am off-site and will be going into the
> office tomorrow to take a look. They opened database
> properties in the Enterprise Manager and tried to just
> delete the extra log file (which we are still trying to
> figure out why it was put there) but it says something
> about the file has to be empty to remove it..etc. If the
> actual error is needed I can get it later today. I was
> online and decided to post this query to see if anyone
> had experience with this.
> on a side note, the system is not secured and this extra
> log file setting was setup on Wednesday this week, during
> maintenance it was noticed. I have been out of the office
> so I am still getting all the facts.
> Thank you,
> Tom
> >--Original Message--
> >Exactly how are you attempting this and what is the
> actual error?
> >
> >--
> >
> >Andrew J. Kelly
> >SQL Server MVP
> >
> >
> >"Tom" <anonymous@.discussions.microsoft.com> wrote in
> message
> >news:009201c3a560$32807a30$a501280a@.phx.gbl...
> >> Hello,
> >>
> >> I have a server with two active transaction logs on 1
> >> database and need to remove one, the problem arises
> when
> >> I try to. Anyone advise on a procedure to do this?
> >>
> >> Thank you in advance,
> >> Tom
> >> tww@.ccsiservices.com
> >
> >
> >.
> >|||Great! Thanks a ton, That will save some time.
Have a great weekend.
Tom
>--Original Message--
>OK that's more to go on. Take a look at DBCC SHRINKFILE
and pay attention
>to the EMPTYFILE option in BooksOnLine. You need to
move any data to the
>other file and it gets marked so as it doesn't fill
again. Then you can use
>ALTER DATABASE to drop the file.
>--
>Andrew J. Kelly
>SQL Server MVP
>
>"Tom" <anonymous@.discussions.microsoft.com> wrote in
message
>news:01dd01c3a572$1a280130$a601280a@.phx.gbl...
>> Well I have not tried yet, though I spoke with someone
>> who was trying. I am off-site and will be going into
the
>> office tomorrow to take a look. They opened database
>> properties in the Enterprise Manager and tried to just
>> delete the extra log file (which we are still trying to
>> figure out why it was put there) but it says something
>> about the file has to be empty to remove it..etc. If
the
>> actual error is needed I can get it later today. I was
>> online and decided to post this query to see if anyone
>> had experience with this.
>> on a side note, the system is not secured and this
extra
>> log file setting was setup on Wednesday this week,
during
>> maintenance it was noticed. I have been out of the
office
>> so I am still getting all the facts.
>> Thank you,
>> Tom
>> >--Original Message--
>> >Exactly how are you attempting this and what is the
>> actual error?
>> >
>> >--
>> >
>> >Andrew J. Kelly
>> >SQL Server MVP
>> >
>> >
>> >"Tom" <anonymous@.discussions.microsoft.com> wrote in
>> message
>> >news:009201c3a560$32807a30$a501280a@.phx.gbl...
>> >> Hello,
>> >>
>> >> I have a server with two active transaction logs on
1
>> >> database and need to remove one, the problem arises
>> when
>> >> I try to. Anyone advise on a procedure to do this?
>> >>
>> >> Thank you in advance,
>> >> Tom
>> >> tww@.ccsiservices.com
>> >
>> >
>> >.
>> >
>
>.
>

Friday, February 24, 2012

DTS with MSSQL2k failover

Hi,
Is DTS and bcp fully supported for use with MSSQL2k
active/active failover cluster?
--
Many thanks,
OskarI beleive the answer is yes, and I personally have not encountered any
problems... However your hardware must come from the Clustered HCL for ANY
clustering to be supported.
--
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.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
"Oskar" <anonymous@.discussions.microsoft.com> wrote in message
news:5b0401c48a89$6b26bcf0$a301280a@.phx.gbl...
> Hi,
> Is DTS and bcp fully supported for use with MSSQL2k
> active/active failover cluster?
>
> --
> Many thanks,
> Oskar
>

Sunday, February 19, 2012

DTS with MSSQL2k failover

Hi,
Is DTS and bcp fully supported for use with MSSQL2k
active/active failover cluster?
Many thanks,
Oskar
I beleive the answer is yes, and I personally have not encountered any
problems... However your hardware must come from the Clustered HCL for ANY
clustering to be supported.
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.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
"Oskar" <anonymous@.discussions.microsoft.com> wrote in message
news:5b0401c48a89$6b26bcf0$a301280a@.phx.gbl...
> Hi,
> Is DTS and bcp fully supported for use with MSSQL2k
> active/active failover cluster?
>
> --
> Many thanks,
> Oskar
>

DTS with MSSQL2k failover

Hi,
Is DTS and bcp fully supported for use with MSSQL2k
active/active failover cluster?
--
Many thanks,
OskarI beleive the answer is yes, and I personally have not encountered any
problems... However your hardware must come from the Clustered HCL for ANY
clustering to be supported.
--
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.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
"Oskar" <anonymous@.discussions.microsoft.com> wrote in message
news:5b0401c48a89$6b26bcf0$a301280a@.phx.gbl...
> Hi,
> Is DTS and bcp fully supported for use with MSSQL2k
> active/active failover cluster?
>
> --
> Many thanks,
> Oskar
>

DTS with MSSQL2k failover

Hi,
Is DTS and bcp fully supported for use with MSSQL2k
active/active failover cluster?
Many thanks,
OskarI beleive the answer is yes, and I personally have not encountered any
problems... However your hardware must come from the Clustered HCL for ANY
clustering to be supported.
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.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
"Oskar" <anonymous@.discussions.microsoft.com> wrote in message
news:5b0401c48a89$6b26bcf0$a301280a@.phx.gbl...
> Hi,
> Is DTS and bcp fully supported for use with MSSQL2k
> active/active failover cluster?
>
> --
> Many thanks,
> Oskar
>