Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Database Size and Actual Record remove
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Database Size and Actual Record remove

 Post Reply Post Reply
Author
meteor View Drop Down
Groupie
Groupie
Avatar

Joined: 31 August 2003
Location: Iran
Status: Offline
Points: 67
Post Options Post Options   Thanks (0) Thanks(0)   Quote meteor Quote  Post ReplyReply Direct Link To This Post Topic: Database Size and Actual Record remove
    Posted: 25 April 2004 at 2:45am

Hello
at Quick start: Think of that i have a data base with 2000 record's and 5 MB size after adding about 2000 record's to Data base DB size Changed to about 10MB but When I removed about 3000 records from DataBase it's Size dosnt changed and remained at 10MB(Seems records Removed Logically) ok Now add 1000 record's to DB and No change on Size . I think that when remove records it fill records with Empty(or Delete Logically them).and after adding new records it Replace New Recors With Removed One. not physically remove records Because DataBase Size Dos Not Changed;how think about this and how can I Remove Records Physically(effect to DB Size that if you added record DB size Change to Up and when Remove Record DB Size Change To down)

10000 records -> 10MB
Add 10000 records -> 20MB
Remove 15000 Records -> 20MB
Add 2000 records -> 20MB
Add 20000 Records -> 30MB

Is Any Command in Access 97 To ZAP(?) Database (like FoxPro)

Sorry For bad ENGLISH

Sincerely
--------------------
PowerFull Scripts For NTTacPlus
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 25 April 2004 at 3:23am
I think you want compact & repair
Back to Top
dj air View Drop Down
Senior Member
Senior Member
Avatar

Joined: 05 April 2002
Location: United Kingdom
Status: Offline
Points: 3627
Post Options Post Options   Thanks (0) Thanks(0)   Quote dj air Quote  Post ReplyReply Direct Link To This Post Posted: 25 April 2004 at 12:13pm

when using a database after deleteing records.. you have to do a compact & repair like mart said.

Back to Top
meteor View Drop Down
Groupie
Groupie
Avatar

Joined: 31 August 2003
Location: Iran
Status: Offline
Points: 67
Post Options Post Options   Thanks (0) Thanks(0)   Quote meteor Quote  Post ReplyReply Direct Link To This Post Posted: 25 April 2004 at 3:23pm
tanx for answers but i search for a way in programing . is any command that do this for me ? is any command in recordSet or Connections for compacting?
Sincerely
--------------------
PowerFull Scripts For NTTacPlus
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 25 April 2004 at 3:35pm
You don't need to do it programmatically. You can just download your database, open it in Access  and click Tools > Database Utilities > Compact and repair Database. Then save your database and upload it over the original database.
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 25 April 2004 at 3:36pm
btw If it's your forum database that you want to compact and repair I think there is a option to do it automatically in the admin panel.
Back to Top
dpyers View Drop Down
Senior Member
Senior Member


Joined: 12 May 2003
Status: Offline
Points: 3937
Post Options Post Options   Thanks (0) Thanks(0)   Quote dpyers Quote  Post ReplyReply Direct Link To This Post Posted: 25 April 2004 at 4:16pm

Lead me not into temptation... I know the short cut, follow me.
Back to Top
meteor View Drop Down
Groupie
Groupie
Avatar

Joined: 31 August 2003
Location: Iran
Status: Offline
Points: 67
Post Options Post Options   Thanks (0) Thanks(0)   Quote meteor Quote  Post ReplyReply Direct Link To This Post Posted: 25 April 2004 at 11:54pm

tanx tanx tanx ......
the final way found the two I think this two code Should Work

http://www.dotnetindex.com/articles/59/?SESSION=607828084&am p;REF=http%3A%2F%2Fwww%2Ehotscripts%2Ecom%2FDetailed%2F30553 %2Ehtml

<%
  oldFile = Server.MapPath("db.mdb")
  newFile = Server.MapPath("bak.mdb")

  strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="& oldFile
  strConnBak = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & newFile
    
  Set objJRO = Server.CreateObject("JRO.JetEngine")
   objJRO.CompactDatabase strConn, strConnBak
  Set objJRO = Nothing


  Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
  If objFSO.FileExists(newFile) And objFSO.FileExists(oldFile) Then
   objFSO.DeleteFile(oldFile)
   objFSO.MoveFile newFile, oldFile
   Response.Write "<font size=""+2"" color=""crimson"">Compact and Repair was successful.</font>"
  Else
   Response.Write "<font size=""+2"" color=""crimson"">Compact and Repair failed.</font>"
  End If

  Set objFSO = Nothing
  %>
------------------------------------------------------------ --

at :
http://dmxzone.com/ShowDetail.asp?NewsId=6398

<% Option Explicit %>
<%
'Dimension variables
Dim objJetEngine 'Holds the jet database engine object
Dim objFSO 'Holds the FSO object
Dim strCompactDB 'Holds the destination of the compacted database
Dim strDbPathAndName
Dim strCon

strDbPathAndName = Server.MapPath("database.mdb")
strCon = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & strDbPathAndName
%>
<html>
<head>
<title>Compact And Repair Access Database</title>
</head>
<body>
<h2>Compact And Repair Access Database</h2>
<br />
<%
'If this is a post back run the compact and repair
If Request.Form("postBack") Then %>
<table width="80%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<ol>
<%

'Create an intence of the FSO object
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

'Back up the database
objFSO.CopyFile strDbPathAndName, Replace(strDbPathAndName, ".mdb", "-backup.mdb", 1, -1, 1)

Response.Write(" <li>Database backed up to:-<br/><span>" & Replace(strDbPathAndName, ".mdb", "-backup.mdb", 1, -1, 1) & "</span><br /><br /></li>")



'Create an intence of the JET engine object
Set objJetEngine = Server.CreateObject("JRO.JetEngine")

'Get the destination and name of the compacted database
strCompactDB = Replace(strDbPathAndName, ".mdb", "-tmp.mdb", 1, -1, 1)

'Compact database
objJetEngine.CompactDatabase strCon, "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & strCompactDB

'Display text that new compact db is created
Response.Write(" <li>New compacted database:-<br/><span>" & strCompactDB & "</span><br /><br /></li>")

'Release Jet object
Set objJetEngine = Nothing




'Delete old database
objFSO.DeleteFile strDbPathAndName

'Display text that that old db is deleted
Response.Write(" <li>Old uncompacted database deleted:-<br/><span>" & strDbPathAndName & "</span><br /><br /></li>")



'Rename temporary database to old name
objFSO.MoveFile strCompactDB, strDbPathAndName

'Display text that that old db is deleted
Response.Write(" <li>Rename compacted database from:-<br/><span>" & strCompactDB & "</span><br />To:-<br /><span>" & strDbPathAndName & "</span><br /><br /></li>")


'Release FSO object
Set objFSO = Nothing


Response.Write(" The Access database is now compacted and repaired")

%></ol></td>
</tr>
</table>
<%
Else

%>
<p

Sincerely
--------------------
PowerFull Scripts For NTTacPlus
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.