PDA

View Full Version : Database Errors - how to fix?


Jose Cardoso
Mon 2nd Apr '01, 12:15pm
I'm being hammered with the following e-mail every few seconds:

Database error in vBulletin: Invalid SQL: INSERT INTO session (sessionid,userid,ipaddress,lastactivity,location) VALUES (NULL,0,'213.38.158.114',986224376,'/board/showthread.php?threadid=6484')
mysql error: Duplicate entry '404519' for key 1
mysql error number: 1062
Date: Monday 02nd of April 2001 11:12:56 AM
Script: /board/showthread.php?threadid=6484
Referer:

Does anyone know what could be causing this?

Mike Sullivan
Mon 2nd Apr '01, 12:39pm
That's a corrupt table. You can use (my)isamchk to fix it, or the easiest way is probably to drop the table and recreate it: (the session table doesn't have any really critical data)

DROP TABLE session;
CREATE TABLE session (
sessionid MEDIUMINT UNSIGNED AUTO_INCREMENT NOT NULL,
userid SMALLINT UNSIGNED NOT NULL,
ipaddress CHAR(20) NOT NULL,
lastactivity INT UNSIGNED NOT NULL,
location CHAR(250) NOT NULL,
PRIMARY KEY(sessionid)
);

Jose Cardoso
Mon 2nd Apr '01, 12:53pm
Thanks Ed. Dropping it seemed to be the best solution and the problem has now gone.

I've taken a backup just in case :)

jamez
Wed 20th Jun '01, 1:06pm
I'm having similar problems. I've dumped the session table and added the new table to date. What is a fix..

My errors are..

<!-- Database error in vBulletin: Invalid SQL:
SELECT
session.userid AS sessionuserid,
post.*,post.username AS postusername,post.ipaddress AS ip,user.*,userfield.*,icon.title as icontitle,icon.iconpath,
attachment.attachmentid,attachment.filename,attach ment.visible AS attachmentvisible,attachment.counter
,avatar.avatarpath,NOT ISNULL(customavatar.avatardata) AS hascustomavatar,customavatar.dateline AS avatardateline
FROM
post
LEFT JOIN icon ON icon.iconid=post.iconid
LEFT JOIN user ON user.userid=post.userid
LEFT JOIN userfield ON userfield.userid=user.userid
LEFT JOIN avatar ON avatar.avatarid=user.avatarid
LEFT JOIN customavatar ON customavatar.userid=user.userid
LEFT JOIN attachment ON attachment.attachmentid=post.attachmentid
LEFT JOIN session ON (session.userid = user.userid
AND session.userid > 0

AND session.lastactivity>993051301)
WHERE
post.postid IN (0,72,75,79)
ORDER BY dateline

mysql error: Got error 28 from table handler
mysql error number: 1030
Date: Wednesday 20th of June 2001 11:50:01 AM
Script: /gardenforum/showthread.php?s=&threadid=42
Referer: http://utahgardener.com/gardenforum/forumdisplay.php?s=&forumid=30

Mike Sullivan
Wed 20th Jun '01, 1:15pm
That's a different error.

Ensure that both the partition where MySQL is (/var usually) and the area where it writes temp files to (usually /tmp) have sufficient space.

Then I suggest running (my)isamchk on all your tables. (or use repair.php as included in vB)

jamez
Wed 20th Jun '01, 1:44pm
So, I've done the repair and nothing. I Still get the error below. Can you recommend any other fixes before I restore to a previous back up before the problems.


<!-- Database error in vBulletin: Invalid SQL:
SELECT
session.userid AS sessionuserid,
post.*,post.username AS postusername,post.ipaddress AS ip,user.*,userfield.*,icon.title as icontitle,icon.iconpath,
attachment.attachmentid,attachment.filename,attach ment.visible AS attachmentvisible,attachment.counter
,avatar.avatarpath,NOT ISNULL(customavatar.avatardata) AS hascustomavatar,customavatar.dateline AS avatardateline
FROM
post
LEFT JOIN icon ON icon.iconid=post.iconid
LEFT JOIN user ON user.userid=post.userid
LEFT JOIN userfield ON userfield.userid=user.userid
LEFT JOIN avatar ON avatar.avatarid=user.avatarid
LEFT JOIN customavatar ON customavatar.userid=user.userid
LEFT JOIN attachment ON attachment.attachmentid=post.attachmentid
LEFT JOIN session ON (session.userid = user.userid
AND session.userid > 0

AND session.lastactivity>993053577)
WHERE
post.postid IN (0,189)
ORDER BY dateline

steven
Wed 20th Jun '01, 3:08pm
jamez- Mike told you
Ensure that both the partition where MySQL is (/var usually) and the area where it writes temp files to (usually /tmp) have sufficient space. If you are on a shared hosting account, contact your host and tell them that the mysql partitition is full, and see what they do about it

jamez
Wed 20th Jun '01, 3:36pm
I just figured I've screwed up my database somehow because the user ids are messed up (I think that because I've changed two users and added them back into the forums.) But, you guys know best. I sent my host a trouble ticket.
BTW I'm on server host2.hrwebservices.net @HR if anybody else is having the same problem.

InfosaurusBC
Tue 26th Jun '01, 4:00pm
James

I am on HR2 as well and my database got screwed too. Here is the error I got.
"Database error in vBulletin: Invalid SQL: SELECT DISTINCT user.email,thread.title FROM post,user,thread WHERE thread.threadid=173 AND post.threadid=173 AND post.userid=user.userid AND post.email=1 AND user.userid<>1 AND user.lastactivity>
mysql error: You have an error in your SQL syntax near '' at line 1
mysql error number: 1064
Date: Tuesday 26th of June 2001 02:39:38 PM
Script: /newreply.php3
Referer: http://www.theangryinvestor.com/newreply.php3?action=newreply&threadid=173"

Any reply to your ticket? I have got none.

Anybody else know of a quick fix?

Cheers,

DAN

InfosaurusBC
Tue 26th Jun '01, 4:36pm
James

I am on HR2 as well and my database got screwed too. Here is the error I got.
"Database error in vBulletin: Invalid SQL: SELECT DISTINCT user.email,thread.title FROM post,user,thread WHERE thread.threadid=173 AND post.threadid=173 AND post.userid=user.userid AND post.email=1 AND user.userid<>1 AND user.lastactivity>
mysql error: You have an error in your SQL syntax near '' at line 1
mysql error number: 1064
Date: Tuesday 26th of June 2001 02:39:38 PM
Script: /newreply.php3
Referer: http://www.theangryinvestor.com/newreply.php3?action=newreply&threadid=173"

Any reply to your ticket? I have got none.

Anybody else know of a quick fix?

Cheers,

DAN

chilliboy
Wed 27th Jun '01, 6:03am
Hi,

I'm also on host2 @ hostrocket and my database got totally screwed yesterday - probably around the same time as you two.

See thread: http://vbulletin.com/forum/showthread.php?s=&threadid=21323&highlight=myisamchk

Anyone know how to fix the problem with myisamchk - or is it something that should be left until hostrocket fixes the route of the problem (it can't be just a coincidence!!).