473,395 Members | 1,368 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Backup backend.mdb into separate folders?

Who can help me to create a backup strategy that will copy the
backend.mdb into separate folders representing either the time, or just
folders that are sequentially numbered.
I need this for rollback purposes.

Nov 13 '05 #1
4 2625
First you need to use a not Connected Form or all Form
connected to BE must be closed and execute the BE Copy.

You need to save on Registry the BE name or extract it
from Tabledefs connetc propery and do what the code below
do.

dim strName as string
dim strFolder as string
strName= BE_NAME & "_" & Format(Now(), "ddmmyy")
strFolder="C:\"
FileCopy Me.lstFolder, strFolder & strName

I prefere to store the BeckUp DefaultFolder and the BE name
on a INI file, you can do it in any other way.

Bye
--
@Alex (Alessandro Baraldi)
---------------------------------------------------------------------------
http://www.sitocomune.com/
http://www.mantuanet.it/alessandro.baraldi/
---------------------------------------------------------------------------
"DMTman" <ro******@softhome.net> ha scritto nel messaggio
news:11*********************@f14g2000cwb.googlegro ups.com...
Who can help me to create a backup strategy that will copy the
backend.mdb into separate folders representing either the time, or just
folders that are sequentially numbered.
I need this for rollback purposes.

Nov 13 '05 #2
*snicker*

I have absolutely no idea what you're talking about.

Can you put it a little more in layman's terms?

I'm the Network Administrator in charge of backing it up.
I'm not a DBA or Access programmer.

Derrick

Nov 13 '05 #3
I've just done a quick google for:

automated backup software freeware

Maybe you could find a bit of freeware software to do it for you. A
couple of these sites had software that does unattended backups.

Dave

DMTman wrote:
*snicker*

I have absolutely no idea what you're talking about.

Can you put it a little more in layman's terms?

I'm the Network Administrator in charge of backing it up.
I'm not a DBA or Access programmer.

Derrick


Nov 13 '05 #4
DMTman wrote:
Who can help me to create a backup strategy that will copy the
backend.mdb into separate folders representing either the time, or just folders that are sequentially numbered.
I need this for rollback purposes.


What follows is an ugly little vscript that I run on the task manager
to backup. It zips up the current file and uploads to the server. I
think it keeps five versions. It won't backup if there is a lock
file(ldb). It also compacts the database and has rudimentary logging.
Do with it what you will. Enjoy!

'This is Dan's latest and greatest semi reusable access database backup
tool
'You need to declare the name of the log file, the name of the database
you
'want to back up, the path to the database you ant to backup, the path
to
'the local folder where the work wil take place. You will also need
the zip
'and unzip folders in the local folder. finally you will need the
workgroupfile.mdw
'in the local working folder. The zip and unzip can be found here
'http://www.info-zip.org/pub/infozip/

On Error Resume next

dim dbEngine
dim fso
dim wshShell
dim txtStr
dim strLog
dim strPathToBackup
dim strLocalWorkingDirectory
dim strDatabase
dim strCompactDatabase
dim I

strLog = "NameOfLog.txt"

strDatabase = "DataBaseToBeBackedUp.mdb"

strPathToBackup = "DirectoryWhere Database lives\"

strLocalWorkingDirectory = "DirectoryOnLocalHardDrive\"

set fso = wscript.createobject("scripting.filesystemobject")

set txtStr = fso.opentextfile(strLocalWorkingDirectory &
strLog,8,true,0)

txtStr.writeline(cstr(now))

if fso.fileexists(strPathToBackup & strDatabase) then

txtStr.writeline("Reached network and found file")

else

txtStr.writeline("Could not reach network ABORTING")
txtStr.close
set txtStr = nothing
set fso = nothing
wscript.quit 0

end if

if fso.fileexists(strPathToBackup &
left(strDatabase,len(strDatabase)-3) & "ldb") then

txtStr.writeline("Lock file found ABORTING")
txtStr.close
set txtStr = nothing
set fso = nothing
wscript.quit 0

end if

fso.copyfile strPathToBackup &
strDatabase,strLocalWorkingDirectory,true

If err.number = 0 then

txtStr.writeline(strDatabase & " copied to local directory")

else

txtStr.writeline("An error occuried copying " & strDatabase & " to
local directory ABORTING")

txtStr.close
set txtStr = nothing
set fso = nothing
wscript.quit 0

end if

set wshShell = wscript.createobject("wscript.shell")

wshShell.run chr(34) & strLocalWorkingDirectory & "Zip\zip.exe" &
chr(34) & space(1) & "-j" & space(1) _
& chr(34) & strLocalWorkingDirectory &
left(strDatabase,len(strDatabase)-3) & "zip" & chr(34) & space(1) _
& chr(34) & strLocalWorkingDirectory & strDatabase &
chr(34),2,true

If err.number = 0 then

txtStr.writeline(strDatabase & " successfully zipped")

else

txtStr.writeline("An error occuried zipping " & strDatabase & "
ABORTING ")
txtStr.close
set txtStr = nothing
set fso = nothing
set wshShell = nothing
wscript.quit 0
end if

wshShell.run chr(34) & strLocalWorkingDirectory & "UnZIp\unzip.exe" &
chr(34) & space(1) & "-t" & space(1) _
& chr(34) & strLocalWorkingDirectory &
left(strDatabase,len(strDatabase)-3) & "zip" & chr(34),2,true

If err.number = 0 then

txtStr.writeline(strDatabase & " archive tested OK")
set wshShell = nothing

else

txtStr.writeline("Test of Archive FAILED " & strDatabase & " ABORTING
")
txtStr.close
set txtStr = nothing
set fso = nothing
set wshShell = nothing
wscript.quit 0

end if

for I = 5 to 2 step -1

if fso.fileexists(strPathToBackup & cstr(I - 1) &
left(strDatabase,len(strDatabase)-3) & "zip") then

fso.copyfile strPathToBackup & cstr(I - 1) &
left(strDatabase,len(strDatabase)-3) & "zip", _
strPathToBackup & cstr(I) &
left(strDatabase,len(strDatabase)-3) & "zip",true

end if

next

if fso.fileexists(strPathToBackup &
left(strDatabase,len(strDatabase)-3) & "zip") then

fso.copyfile strPathToBackup & left(strDatabase,len(strDatabase)-3) &
"zip",strPathToBackup & "2" & left(strDatabase,len(strDatabase)-3) &
"zip"

end if

if err.number = 0 then

txtStr.writeline("Backups rotated on server")

else

txtStr.writeline("Error rotating backups on server ABORTING")
txtStr.close
set txtStr = nothing
set fso = nothing
wscript.quit 0

end if
fso.copyfile strLocalWorkingDirectory &
left(strDatabase,len(strDatabase)-3) & "zip",strPathToBackup,true

if err.number = 0 then

txtStr.writeline("Current archive successfully uploaded")

else

txtStr.writeline("Error uploading current archive ABORTING")
txtStr.close
set txtStr = nothing
set fso = nothing
set wshShell = nothing
wscript.quit 0

end if

set dbEngine = wscript.createobject("dao.dbengine.36")

dbEngine.systemdb = strLocalWorkingDirectory & "workgroupfile.mdw"
dbEngine.defaultuser = "user"
dbEngine.defaultpassword = "password"

dbEngine.compactdatabase strLocalWorkingDirectory &
strDatabase,strLocalWorkingDirectory & "compact" & strDatabase

if err.number = 0 then

txtStr.writeline("Database compacted successfully")
set dbEngine = nothing
else

txtStr.writeline("Error compacting database ABORTING")
txtStr.close
set txtStr = nothing
set fso = nothing
set wshShell = nothing
set dbEngine = nothing
wscript.quit 0

end if

fso.copyfile strLocalWorkingDirectory & "compact" &
strDatabase,strPathToBackup & strDatabase,true

if err.number = 0 then

txtStr.writeline("Compacted database uploaded to server")

else

txtStr.writeline("Error uploading database to the server ABORTING")
txtStr.close
set txtStr = nothing
set fso = nothing
set wshShell = nothing
wscript.quit 0

end if

if fso.fileexists(strLocalWorkingDirectory & strDatabase) then

fso.deletefile strLocalWorkingDirectory & strDatabase

end if

if fso.fileexists(strLocalWorkingDirectory & "compact" & strDatabase)
then

fso.deletefile strLocalWorkingDirectory & "compact" & strDatabase

end if

if fso.fileexists(strLocalWorkingDirectory &
left(strDatabase,len(strDatabase)-3) & "zip") then

fso.deletefile strLocalWorkingDirectory &
left(strDatabase,len(strDatabase)-3) & "zip"

end if

txtStr.writeline("Local TempFiles deleted. Uploading log file")

fso.copyfile strLocalWorkingDirectory & strLog,strPathToBackup,true

txtStr.writeline("Log FIle Uploaded")
txtStr.close
set txtStr = nothing
set fso = nothing

Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: acko bogicevic | last post by:
Hi everyone I have the folowing situations with my backups. With Database Maintenance Plan is created backup strategy. Full Backup is performing every day at 1.00 am. And Romove files older than:...
1
by: Jason | last post by:
In SQL 2000, is there an advantage to defining and using a backup device versus just backing up to disk? Currently, I've got a SQL Backup job set to run once per day, with transaction log...
6
by: Eric Herber | last post by:
I've a question regarding db2 (V8.1) and database backups going to a storage manager like TSM for example. As I can see in the storage manager if I backup the complete database over the TSM API...
2
by: Terry Bell | last post by:
My client has an A97 application, been running for 7 years, split front/backend. They backup each night and sometimes half way through each day. If the backend corrupts, they restore the latest...
1
by: AquilaV | last post by:
Ciao a tutti, ho un problema che non riesco a risolvere nonostante abbia girato mille newsgroup... Ho creato un'applicazione con access divisa in frontend e backend. Dall'interfaccia principale...
7
RobH
by: RobH | last post by:
When trying to View the Backup Log through the Server Management interface when logged in as Administrator, the screen reports the following error. "You do not have the correct permissions to view...
6
by: bg_ie | last post by:
Hi, My company's backend is located at a location with a long address, something like - //our_servers/server_number_one/our_department/our_devision/ our_results/our_databases/backend.be I...
0
Niheel
by: Niheel | last post by:
The importance of backups can never be emphasized enough. In Vista Ultimate and Windows Server 2008, there is a built in feature to take care of backups called Windows Complete PC Backup and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.