查看: 1019|回复: 15
|
MySQL 为什么会 data loss ??
[复制链接]
|
|
我有一个问题就是在什么的情况下会data loss 呢?
我是用asp + Mysql的。
平时我test的时候都不会data loss
有时就有人告诉我他们data loss.
不是一个两个,而是在他那时insert 的 data 全部loss。
也没有error。有error他们会说的。
为什么会这样呢? |
|
|
|
|
|
|
|
发表于 18-9-2005 10:12 PM
|
显示全部楼层
试试做一个 sql history log,
来看看到底是什么时候发生的。 |
|
|
|
|
|
|
|
发表于 19-9-2005 09:38 AM
|
显示全部楼层
原帖由 红发 于 18-9-2005 03:50 PM 发表
我有一个问题就是在什么的情况下会data loss 呢?
我是用asp + Mysql的。
平时我test的时候都不会data loss
有时就有人告诉我他们data loss.
不是一个两个,而是在他那时insert 的 data 全部loss。
也没 ...
红发老弟,
你是不是有用BeginTrans, Rollback 之类的东东, 但你的Exception Handler那里做到不“美”。 Rollback 了你也不懂? |
|
|
|
|
|
|
|

楼主 |
发表于 19-9-2005 10:15 PM
|
显示全部楼层
原帖由 flashang 于 18-9-2005 10:12 PM 发表
试试做一个 sql history log,
来看看到底是什么时候发生的。
那个要如何作呢?
我只知道他们insert的data都没有去到我的mysql database 里。
又没有error。
我test的时候都没有这个问题。
data都insert的到。 |
|
|
|
|
|
|
|

楼主 |
发表于 19-9-2005 10:23 PM
|
显示全部楼层
原帖由 chinjw 于 19-9-2005 09:38 AM 发表
红发老弟,
你是不是有用BeginTrans, Rollback 之类的东东, 但你的Exception Handler那里做到不“美”。 Rollback 了你也不懂?
chinjw大哥,然你失望了。
我是用普通的insert。
你教我的那个beginTrans 和 Rollback的东东我没有去用他。
因为我还是不是很明白。
我用其他的方法。
但是我看php得好相是用array的东东。
哈,我也不是很清楚php的是用什么方法来做到的啦。 |
|
|
|
|
|
|
|
发表于 20-9-2005 09:01 AM
|
显示全部楼层
原帖由 红发 于 19-9-2005 10:23 PM 发表
chinjw大哥,然你失望了。
我是用普通的insert。
你教我的那个beginTrans 和 Rollback的东东我没有去用他。
因为我还是不是很明白。
我用其他的方法。
但是我看php得好相是用array的东东。
哈,我也不 ...
如flashang所说的,做些log file 来trace 你的statement lor..
你将做任insert statement 时 的 step 都write log 进你的log file(比如:拿connection string 成功,then 就 write log :"Success Get Connection String"; 开 Connection 成功就write log :"Success Open Connection"...etc) 酱你就懂那里出错了。 |
|
|
|
|
|
|
|

楼主 |
发表于 20-9-2005 01:40 PM
|
显示全部楼层
|
|
|
|
|
|
|
发表于 20-9-2005 02:04 PM
|
显示全部楼层
原帖由 红发 于 20-9-2005 01:40 PM 发表
是不是write进那个Text File里。
Yup~~
Objective is trace ur insert progress..:sp: |
|
|
|
|
|
|
|

楼主 |
发表于 20-9-2005 10:25 PM
|
显示全部楼层
我还有一个疑问。
就是当我connect不到database的时候或
database里没有这个table时都会有error的。
为什么他们不会遇到error的????
还可以continue去insert他们的data呢??????
而且不是一个两个,
而是很多个data。
在哪一段时间loss掉10多个data。(30minutes 到 60minutes之间)
那就有一点奇怪了。(我是这样认为的) |
|
|
|
|
|
|
|
发表于 20-9-2005 10:33 PM
|
显示全部楼层
原帖由 红发 于 20-9-2005 10:25 PM 发表
我还有一个疑问。
就是当我connect不到database的时候或
database里没有这个table时都会有error的。
为什么他们不会遇到error的????
还可以continue去insert他们的data呢??????
而且不是一个 ...
error control 有没有做好呢?connect 不到或 table not found 应该出 error message 吧? |
|
|
|
|
|
|
|

楼主 |
发表于 20-9-2005 11:02 PM
|
显示全部楼层
就是没有才奇怪loh.
minimum会page cannot display的吗。
平时我用都没有这个问题的。
不知道是不是他们没有insert data就说data loss。
怕老板鸟他就说data loss? |
|
|
|
|
|
|
|
发表于 21-9-2005 08:45 AM
|
显示全部楼层
原帖由 红发 于 20-9-2005 11:02 PM 发表
就是没有才奇怪loh.
minimum会page cannot display的吗。
平时我用都没有这个问题的。
不知道是不是他们没有insert data就说data loss。
怕老板鸟他就说data loss?
也有可能,
如要肯定的话,可post上来让大家研究,研究(如不介意的话)
或在你的app加上write log 的 function.
无论user在干什么你也可以write在log file.
在有data loss的问题的话你就可以拿你的log跟他们理论。(你的log file 有记录时间,可问他们己时insert data的,当你check回你的log file, 如发现他们所讲的时间你的app 跟本末run过,那就肯定他们讲大话了) |
|
|
|
|
|
|
|

楼主 |
发表于 21-9-2005 12:47 PM
|
显示全部楼层
yaloh, i think do a log file is a nice choose.
every time said data loss....
later i will post my source code.
wait....... |
|
|
|
|
|
|
|

楼主 |
发表于 23-9-2005 02:15 PM
|
显示全部楼层
- pass2.asp
- <!--#include file="conn.asp"-->
- <% RequireLogin = True %>
- <!--#include file="secure.asp"-->
- <% username=session("username")
- set rs=server.CreateObject("adodb.Recordset")
- sql="Select * From usr where username='"&username&"'"
- Rs.Open sql,conn
- location=rs("location")
- rs.close%>
- <%action=request.QueryString("action")
- select case action
- case "add"
- serialno=Trim(Request.Form("serialno"))
- rdate=(FormatDateTime(date(),vblongdate))
- brand=Trim(Request.Form("brand"))
- nbmodel=Trim(Request.Form("nbmodel"))
- ram=Trim(Request.Form("ram"))
- disk=Trim(Request.Form("disk"))
- drive=Trim(Request.Form("drive"))
- mouse=Trim(Request.Form("mouse"))
- statu=Trim(Request.Form("statu"))
- set rs=server.CreateObject("adodb.recordset")
- sql="select * from nb where serialno='"&serialno&"'"
- rs.open sql,conn,3,2
- if not (rs.bof and rs.eof) then
- response.Redirect("editnb.asp?action=fail")
- else
- sql="insert into nb (serialno, rdate, brand, nbmodel, ram, disk, drive, mouse, location, statu)values ('"&serialno&"', '"&rdate&"', '"&brand&"', '"&nbmodel&"', '"&ram&"', '"&disk&"', '"&drive&"', '"&mouse&"', '"&location&"', '"&statu&"')"
- conn.Execute (sql)
- okstring="<html><head><meta http-equiv=Content-Type content=text/html; charset=UTF-8><title>Add Success</title><meta http-equiv=refresh content=5;URL=viewnb.asp></head>"
- okstring=okstring+"<body><font color=#FF6000><div align=center><b>"&serialno&"</b>,already successful insert into the database.<br><a href=viewnb.asp>click here to insert another Product.</a></div></font></body></html>"
- response.Write(okstring)
- rs.close
- conn.close
- end if
- case "edit"
- id=Trim(request.QueryString("id"))
- brand=Trim(Request.Form("brand"))
- nbmodel=Trim(Request.Form("nbmodel"))
- disk=Trim(Request.Form("disk"))
- ram=Trim(Request.Form("ram"))
- drive=Trim(Request.Form("drive"))
- mouse=Trim(Request.Form("mouse"))
- location=Trim(Request.Form("location"))
- statu=Trim(Request.Form("statu"))
- sql="update nb set brand='"&brand&"', nbmodel='"&nbmodel&"', disk='"&disk&"', ram='"&ram&"', drive='"&drive&"', mouse='"&mouse&"', location='"&location&"', statu='"&statu&"' where id='"&id&"'"
- conn.Execute (sql)
- okstring="<html><head><meta http-equiv=Content-Type content=text/html; charset=UTF-8><title>Edit Success</title><meta http-equiv=refresh content=5;URL=viewnb.asp></head>"
- okstring=okstring+"<body><font color=#FF6000><div align=center>You already successful update the database.<br><a href=viewnb.asp>Click Here to View Others Products Details.</a></div></font></body></html>"
- response.Write(okstring)
- conn.close
- end select%>
复制代码
[ 本帖最后由 红发 于 23-9-2005 02:18 PM 编辑 ] |
|
|
|
|
|
|
|

楼主 |
发表于 23-9-2005 02:16 PM
|
显示全部楼层
- <%
- LoggedIn = (len(session("username"))> 0)
- LoggedIn = (len(session("password"))> 0)
- IF RequireLogin THEN
- if Not LoggedIn then
- response.redirect("login.asp")
- end if
- END IF
- Response.CacheControl = "no-cache"
- Response.AddHeader "Pragma", "no-cache"
- Response.Expires = -1
- %>
复制代码
- <%
- connection = "dsn=info;driver={myodbd driver};server=localhost;uid=root;pwd=chen1983;database=info"
- set conn = server.createobject("adodb.connection")
- conn.open connection
- %>
复制代码 |
|
|
|
|
|
|
|

楼主 |
发表于 23-9-2005 02:25 PM
|
显示全部楼层
|
|
|
|
|
|
| |
本周最热论坛帖子
|