Alpha Video Training
Results 1 to 1 of 1

Thread: Fixed number of rollbacks - Cyclic clean backup zips for users

  1. #1
    "Certified" Alphaholic Ray in Capetown's Avatar
    Real Name
    Ray Hendler
    Join Date
    Jan 2009
    Location
    South Africa
    Posts
    2,036

    Default Fixed number of rollbacks - Cyclic clean backup zips for users

    If using DBFs (SQL has rollback functionality).
    A5 Incremental backup is for disaster recovery.
    -- Maintain a fixed number of rollback points and include selected group/s of tables that manage themselves.

    At the start of a routine where many tables will be updated, simply call backitup() and Set a flag to prevent user collision.
    If the full update does not complete, the relevant data files prior to that are fully intact. Otherwise release the flag.

    Code:
    FUNCTION Backitup AS C () 'Can use parameters for any of the specific settings highlighted
    Srvrdrv = left(:a5.get_path(),3) 'Will pick up the drive letter
    how_many=  20    'Retain the last how_many-1 backups
    zip_filename = Srvrdrv +Foldername+ chr(92) + Zipname
    for i=1 to how_many
    	If .not. file.exists(full_zip_filename+str(i,2,0)+".zip") then
    	  thiszip=full_zip_filename+str(i,2,0)
    	  exit for
    	End if
    next
    if i=how_many ' Has reached the limit prepare next backup to begin at 1
    		i=0
    end if
    If file.exists(full_zip_filename+str(i+1,2,0)+".zip") then
        file.remove(full_zip_filename+str(i+1,2,0)+".zip")
    end if
    FILE.ZIP(thiszip,:a5.get_path()+ chr(92) +"invL*.*")
    .....
    FILE.ZIP(thiszip,:a5.get_path()+ chr(92) +"gltran.d??")
    ui_msg_box("Zipped Database","Database saved as"+crlf()+thiszip)
    END FUNCTION
    This is working code.
    The files will be numbered from 1 to n with the oldest one always deleted. The next backup will use that number and delete the next and around to 1.
    Any improvements welcome and maybe an Xdlg for recovery.
    Last edited by Ray in Capetown; 06-26-2013 at 03:06 PM.

Similar Threads

  1. Preventing users from logging in during backup
    By Sooty57 in forum Alpha Five Version 9 - Desktop Applications
    Replies: 5
    Last Post: 01-18-2011, 03:11 AM
  2. Email four pdfs only one zips and sends
    By John Fringer in forum Alpha Five Version 9 - Desktop Applications
    Replies: 2
    Last Post: 04-27-2008, 09:43 PM
  3. at midnight force all users out of Alpha5 & do auto backup
    By oldtony in forum Alpha Five Version 8
    Replies: 1
    Last Post: 09-20-2007, 11:19 PM
  4. Number of users
    By Bob Whitaker in forum Alpha Five Version 5
    Replies: 0
    Last Post: 11-28-2002, 08:49 AM
  5. Number Of Users
    By Phil Rolf in forum Alpha Five Version 4
    Replies: 5
    Last Post: 02-04-2001, 09:35 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •