Browse
 
Tools
Categories

How to create a OneSource Database Backup script

Author: support staff Reference Number: AA-01189 Created: 2011-02-21 20:59 Last Updated: 2016-12-31 13:33 0 Rating/ Voters

*** Important Notes ***

  • The following backup script ONLY backs up the all-in-one OneSource data file. It does NOT provide a correct backup if you have turned on the 'distributed database' option in the Company Setup & Preferences (which distributes your data tables into 13 smaller databases) UNLESS the file is 'edited' to include ALL 13 of the additional data files in the script as well.  (See the section below called: How to Manually Modify the Backup Script to Backup all OneSource Distributed Database Files)
  • The backup script is NOT intended to replace any backup routines you already have in place for OneSource or the rest of the files on your server.  This tool is only intended to give you added peace of mind if you want to make a back up of your single OneSource data file on the fly.
  • We have found that MOST of our OneSource customers, when a backup is needed, do not have one.  We now offer a daily, human verified backup service for your crucial OneSource files.

How to Create a OneSource Backup Script file

  • Click Tools > Admin Tools > Create Database Backup Script.  This will create a new icon on your desktop called OneSource Database Backup.vbs.  Anytime this icon is double clicked it will locate your data file and copy/rename it.  
    • Note: If your data file is ever moved you will need to delete the script and make a new one.
    • Be sure to read all pop-up messages and routinely double check the process to make sure the process is completing successfully.  
    • IT IS HIGHLY RECOMMENDED THAT YOU DO NOT IMPLICITLY TRUST THIS BACKUP PROCESS, OR ANY OTHER BACKUP MECHANISM OR SERVICE.  ROUTINELY VERIFY THE SUCCESS AND VALIDITY OF ALL DATA BACKUPS ***.

How to manually modify the default OneSource backup script to backup distributed databases

  • Create a backup script following the steps above.
  • Right click on the newly created script and click Edit.
  • Make a new FOLDER to store your backups.  In this example the new folder created was: C:\OneSource\LocalScriptBackups\  (Also, note that the place that says YourCompanyDataFile below needs to be replaced by the name of your company data file).
  • Modify the file (or copy and paste the data below into the file) so it looks like the code below: 

Dim fromfile
Dim tofile
Dim mytime
Dim p
Dim p1
Dim mm
Dim dd
Dim yyyy
Dim t
Dim strWSH
aDate = Date
t = Int(Timer)
p = InStr(aDate, "/")
mm = Right("0" & Left(aDate, p - 1), 2)
p1 = InStr(p + 1, aDate, "/")
dd = Right("0" & Mid(aDate, p + 1, (p1 - p) - 1), 2)
yyyy = Right(aDate, 4)

MsgBox "This Proccess Will Make A Disk-To-Disk Backup Copy Of The Specified File(s)."

Set FS = CreateObject("Scripting.FileSystemObject")
fromfile = "C:\OneSource\Data\YourCompanyDataFile.mdb"
tofile = "C:\OneSource\LocalScriptBackups\" & yyyy & mm & dd & "." & "NationalAutoParts.mdb." & t & ".BAK"
FS.CopyFile fromfile, tofile

fromfile = "C:\OneSource\Data\osap.mdb"
tofile = "C:\OneSource\LocalScriptBackups\" & yyyy & mm & dd & "." & "osap.mdb." & t & ".BAK"
FS.CopyFile fromfile, tofile

fromfile = "C:\OneSource\Data\osar.mdb"
tofile = "C:\OneSource\LocalScriptBackups\" & yyyy & mm & dd & "." & "osar.mdb." & t & ".BAK"
FS.CopyFile fromfile, tofile

fromfile = "C:\OneSource\Data\osbk.mdb"
tofile = "C:\OneSource\LocalScriptBackups\" & yyyy & mm & dd & "." & "osbk.mdb." & t & ".BAK"
FS.CopyFile fromfile, tofile

fromfile = "C:\OneSource\Data\oscsa.mdb"
tofile = "C:\OneSource\LocalScriptBackups\" & yyyy & mm & dd & "." & "oscsa.mdb." & t & ".BAK"
FS.CopyFile fromfile, tofile

fromfile = "C:\OneSource\Data\osgl.mdb"
tofile = "C:\OneSource\LocalScriptBackups\" & yyyy & mm & dd & "." & "osgl.mdb." & t & ".BAK"
FS.CopyFile fromfile, tofile

fromfile = "C:\OneSource\Data\osicm.mdb"
tofile = "C:\OneSource\LocalScriptBackups\" & yyyy & mm & dd & "." & "osicm.mdb." & t & ".BAK"
FS.CopyFile fromfile, tofile

fromfile = "C:\OneSource\Data\osinv1.mdb"
tofile = "C:\OneSource\LocalScriptBackups\" & yyyy & mm & dd & "." & "osinv1.mdb." & t & ".BAK"
FS.CopyFile fromfile, tofile

fromfile = "C:\OneSource\Data\osinv2.mdb"
tofile = "C:\OneSource\LocalScriptBackups\" & yyyy & mm & dd & "." & "osinv2.mdb." & t & ".BAK"
FS.CopyFile fromfile, tofile

fromfile = "C:\OneSource\Data\oslog.mdb"
tofile = "C:\OneSource\LocalScriptBackups\" & yyyy & mm & dd & "." & "oslog.mdb." & t & ".BAK"
FS.CopyFile fromfile, tofile

fromfile = "C:\OneSource\Data\osonlineorders.mdb"
tofile = "C:\OneSource\LocalScriptBackups\" & yyyy & mm & dd & "." & "osonlineorders.mdb." & t & ".BAK"
FS.CopyFile fromfile, tofile

fromfile = "C:\OneSource\Data\ospo.mdb"
tofile = "C:\OneSource\LocalScriptBackups\" & yyyy & mm & dd & "." & "ospo.mdb." & t & ".BAK"
FS.CopyFile fromfile, tofile

fromfile = "C:\OneSource\Data\osqu.mdb"
tofile = "C:\OneSource\LocalScriptBackups\" & yyyy & mm & dd & "." & "osqu.mdb." & t & ".BAK"
FS.CopyFile fromfile, tofile

fromfile = "C:\OneSource\Data\ossa.mdb"
tofile = "C:\OneSource\LocalScriptBackups\" & yyyy & mm & dd & "." & "ossa.mdb." & t & ".BAK"
FS.CopyFile fromfile, tofile

MsgBox "Disk-To-Disk Backup Process Complete."