Client Information Back-Ups

Hello! We are looking into possibly using the OpenPVMS software for our clinic but had a question about how exactly the information is backed up- Is it backed up by OpenVPMS or locally by us? If OpenPVMS is backing up the information how do we know it's level of security for our client's sake? Also, is there an option to have the information backed-up locally?

Thank you for any help!!

-stingop1988

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Re: Client Information Back-Ups

The OpenVPMS software uses a MySQL database to store all of its data.

You simply need to back up this database using the mysqldump tool provided as part of the MySQL installation. Typically you would schedule this to be run nightly, and the database dump stored offsite.

-Tim

Re: Client Information Back-Ups

Since Mysql 5 the removed the sheduling abilities of a mysqladministrator package, (thats now in the commercial offering)

However I have attached below my backup script...it does a daily backup at 4am.  and rotates them down to a weekly backup and then at the end of the month it does monthly....which is archived

simlply copy this to a batch file under windows (mines called sqlbackup.bat).  I copied mysqldump to this directory from my mysql installation.  You may need to create a user with the correct priveledges under mysql to allow them to backup.  Enter there username and password in the appropriate part of the script.  Also make sure you set the server ip or url.  You shouldnt be backing up to the same computer the server is installed on...but if you have to at least backup to a removable harddrive.

 

Run

SQLBACKUP --install

to create a directory structure under your backup directory

SQLBACKUP --ADDSHEDULEDTASK

will try and create a task under your schedule of jobs OR you can make one manually.

test the newly created schedule task and your done.

START SQLBACKUP.bat

  @ECHO OFF
SET VERSIONMAJOR=10
SET VERSIONMINOR=6

FOR /f "tokens=1-4 delims=/ " %%a IN ('date/t') DO (
SET dw=%%a
SET dd=%%b
SET mm=%%c
SET yy=%%d
)

REM *** VERIFY AND UPDATE THESE SETTINGS BEFORE INITIAL RUN ***
REM *** mysqldir must point to the \bin directory! ***
SET bkupdir=C:\BACKUP\BACKUPSUBDIR
SET mysqldir=C:\BACKUP
REM *** I copied MYSQLDUMP into this directory
SET dbhost=10.1.1.1
SET dbuser=backupuser
SET dbpass=backupuserpassword
REM *** END USER CONFIGURABLE SETTINGS ***

IF /i "%1" == "--INSTALL" GOTO INSTALLER
IF /i "%1" == "--CREATEDIRS" GOTO CREATEDIRS
IF /i "%1" == "--ADDSCHEDULEDTASK" GOTO TASKSCHED
IF ""%1"" == """" GOTO ALLDB
IF /i "%1" == "--ALL" GOTO ALLDB
IF /i "%1:~0,2%" == "--" GOTO PARAMERROR

SET ALLDBS=0
SET dbnames=%1
SET dbnamesf=%1
SHIFT
:setArgs
IF ""%1""=="""" GOTO BKUP
SET dbnames=%dbnames% %1
SET dbnamesf=%dbnamesf%_%1
SHIFT
GOTO setArgs

:ALLDB
SET ALLDBS=1
SET dbnames=ALL DATABASES
SET dbnamesf=ALL_DATABASES

:BKUP
@ECHO MySQLdump script for Windows v%VERSIONMAJOR%.%VERSIONMINOR% > %bkupdir%\dbBkup_%dbnamesf%_%yy%%mm%%dd%.log
@ECHO. >> %bkupdir%\dbBkup_%dbnamesf%_%yy%%mm%%dd%.log
@ECHO MySQLdump script for Windows v%VERSIONMAJOR%.%VERSIONMINOR%
@ECHO.

IF NOT EXIST %bkupdir%\INSTALLED.OK (
@ECHO DIRECTORY STRUCTURE NOT IN PLACE. >> %bkupdir%\dbBkup_%dbnamesf%_%yy%%mm%%dd%.log
@ECHO PLEASE RUN %0 --INSTALL OR %0 --CREATEDIRS >> %bkupdir%\dbBkup_%dbnamesf%_%yy%%mm%%dd%.log
@ECHO FAILED TO BACKUP DATABASES. >> %bkupdir%\dbBkup_%dbnamesf%_%yy%%mm%%dd%.log
@ECHO DIRECTORY STRUCTURE NOT IN PLACE.
@ECHO PLEASE RUN %0 --INSTALL OR %0 --CREATEDIRS
@ECHO FAILED TO BACKUP DATABASES.
GOTO BOTTOM
)

@ECHO Beginning backup of %dbnames%... >> %bkupdir%\dbBkup_%dbnamesf%_%yy%%mm%%dd%.log
@ECHO Beginning backup of %dbnames%...

IF %ALLDBS% == 1 (
SET dumpparams=--host=%dbhost% -u %dbuser% -p%dbpass% -A -f -x -q --create-options --flush-privileges -r %bkupdir%\dbBkup_%dbnamesf%_%yy%%mm%%dd%.sql
) ELSE (
SET dumpparams=--host=%dbhost% -u %dbuser% -p%dbpass% -f -x -q --create-options --flush-privileges -r %bkupdir%\dbBkup_%dbnamesf%_%yy%%mm%%dd%.sql --databases %dbnames%
)

%mysqldir%\mysqldump %dumpparams% >> %bkupdir%\dbBkup_%dbnamesf%_%yy%%mm%%dd%.log

@ECHO Done! New File: dbBkup_%dbnamesf%_%yy%%mm%%dd%.sql >> %bkupdir%\dbBkup_%dbnamesf%_%yy%%mm%%dd%.log
@ECHO Done! New File: dbBkup_%dbnamesf%_%yy%%mm%%dd%.sql

COPY /Y %bkupdir%\dbBkup_%dbnamesf%_%yy%%mm%%dd%.sql /A %bkupdir%\Daily\dbBkup_%dbnamesf%_%dw%.sql /A > NUL
@ECHO Created Daily Backup: Daily\dbBkup_%dbnamesf%_%dw%.sql >> %bkupdir%\dbBkup_%dbnamesf%_%yy%%mm%%dd%.log
@ECHO Created Daily Backup: Daily\dbBkup_%dbnamesf%_%dw%.sql

REM Check to see if it's time for the Weekend backup
IF /i "%dw%" NEQ "Sat" GOTO SKIPWKBK
IF EXIST %bkupdir%\Weekly\safety_%dbnamesf%_%yy%%mm%%dd%.txt GOTO WKCUR
IF NOT EXIST %bkupdir%\Weekly\dbBkup_%dbnamesf%_Current.sql GOTO WKCUR
IF NOT EXIST %bkupdir%\Weekly\dbBkup_%dbnamesf%_Previous.sql GOTO WKPRE
IF NOT EXIST %bkupdir%\Weekly\dbBkup_%dbnamesf%_Previous_2.sql GOTO WKPR2
MOVE /Y %bkupdir%\Weekly\dbBkup_%dbnamesf%_Previous_2.sql %bkupdir%\Weekly\dbBkup_%dbnamesf%_Previous_3.sql > NUL
:WKPR2
MOVE /Y %bkupdir%\Weekly\dbBkup_%dbnamesf%_Previous.sql %bkupdir%\Weekly\dbBkup_%dbnamesf%_Previous_2.sql > NUL
:WKPRE
MOVE /Y %bkupdir%\Weekly\dbBkup_%dbnamesf%_Current.sql %bkupdir%\Weekly\dbBkup_%dbnamesf%_Previous.sql > NUL
:WKCUR
COPY /Y %bkupdir%\dbBkup_%dbnamesf%_%yy%%mm%%dd%.sql /A %bkupdir%\Weekly\dbBkup_%dbnamesf%_Current.sql /A > NUL
@ECHO. > %bkupdir%\Weekly\safety_%dbnamesf%_%yy%%mm%%dd%.txt
@ECHO Created Weekly Backup: Weekly\dbBkup_%dbnamesf%_Current.sql >> %bkupdir%\dbBkup_%dbnamesf%_%yy%%mm%%dd%.log
@ECHO Created Weekly Backup: Weekly\dbBkup_%dbnamesf%_Current.sql

:SKIPWKBK
REM if (day >= 28) write EoM backup
IF %dd% GEQ 28 (
COPY /Y %bkupdir%\dbBkup_%dbnamesf%_%yy%%mm%%dd%.sql /A %bkupdir%\Monthly\dbBkup_%dbnamesf%_%mm%.sql /A > NUL
@ECHO Created End of Month Backup: Monthly\dbBkup_%dbnamesf%_%mm%.sql >> %bkupdir%\dbBkup_%dbnamesf%_%yy%%mm%%dd%.log
@ECHO Created End of Month Backup: Monthly\dbBkup_%dbnamesf%_%mm%.sql
)

DEL /q /f %bkupdir%\dbBkup_%dbnamesf%_%yy%%mm%%dd%.sql

@ECHO Backup stored in rotating archives. >> %bkupdir%\dbBkup_%dbnamesf%_%yy%%mm%%dd%.log
@ECHO. >> %bkupdir%\dbBkup_%dbnamesf%_%yy%%mm%%dd%.log
@ECHO End MySQLdump Script >> %bkupdir%\dbBkup_%dbnamesf%_%yy%%mm%%dd%.log
@ECHO Backup stored in rotating archives.
@ECHO.
@ECHO End MySQLdump Script
GOTO BOTTOM

:INSTALLER
@ECHO VERIFY: Path to mysqldump: %mysqldir%
@ECHO VERIFY: Path to backups: %bkupdir%
@ECHO VERIFY: MySQL User: %dbuser%
@ECHO VERIFY: MySQL Pass: %dbpass%
@ECHO VERIFY: MySQL Host: %dbhost%
IF NOT EXIST %bkupdir%\INSTALLED.OK (
@ECHO ALERT: Backup directory does not exist. Create base directory and subdirectories?
SET /p domkdir=[Y/N]:
IF /i "%domkdir%" == "N" (
@ECHO ALERT: CANNOT CONTINUE WITHOUT DIRECTORIES IN PLACE.
GOTO BOTTOM
)
)
:CREATEDIRS
IF NOT EXIST %bkupdir%\INSTALLED.OK (
MD "%bkupdir%" > NUL
MD "%bkupdir%\Daily" > NUL
MD "%bkupdir%\Weekly" > NUL
MD "%bkupdir%\Monthly" > NUL
@ECHO INSTALLED CORRECTLY > %bkupdir%\INSTALLED.OK
)
GOTO BOTTOM

:TASKSCHED
@ECHO Preparing add Scheduled Task...
:STUPIDUSER1
SET /p taskuser=Domain\User to run task:
IF /i ""%taskuser%"" == """" GOTO STUPIDUSER1
:STUPIDUSER2
SET /p taskpwd1=Password:
SET /p taskpwd2=Confirm Password:
IF %taskpwd1% NEQ %taskpwd2% GOTO STUPIDUSER2
:STUPIDUSER3
SET /p taskname=Task name:
IF /i ""%taskname%"" == """" GOTO STUPIDUSER3
SET /p taskparam=Parameters to pass to batch file:
SCHTASKS /Create /SC DAILY /ST 04:00:00 /TN "%taskname%" /TR "%~f0 %taskparam%" /RU "%taskuser%" /RP %taskpwd1%
GOTO BOTTOM

:PARAMERROR
@ECHO ERROR: Unknown Parameter Passed.
@ECHO Current supported parameters:
@ECHO --ALL - Backup all databases, same as passing nothing to batch file
@ECHO --ADDSCHEDULEDTASK - Adds a scheduled task for this process
@ECHO --CREATEDIRS - Creates Directory Structure
@ECHO --INSTALL - Creates directory structure and outputs configuration settings that need verification

:BOTTOM  

 END SQLBACKUP.bat

END SQLBACKUP.BAT

Re: Client Information Back-Ups

Ben - a question and an observation:

Q: is there any reason why you didn't use the --single-transaction option.  In my case (where the system is running 24/7) I will need this.

O: have you seen that Percona has what looks like a useful backup too - see http://www.percona.com/software/percona-xtrabackup - currently its for Linux systems, but they have a windows version in alpha testing.

Regards, Tim G

Re: Client Information Back-Ups

My data wont be in use...unless something has gone pear shapped at 4am (when I set the backup)

hence I used LOCK ALL TABLES (-x)

from mysql...

The --single-transaction option and the --lock-tables option are mutually exclusive because LOCK TABLES causes any pending transactions to be committed implicitly.

I think Lock all tables in a situation where no or very low use would occur is probably more reliable than single transaction.

See below why Single transaction might fail(all be it very unlikely)

While a --single-transaction dump is in process, to ensure a valid dump file (correct table contents and binary log coordinates), no other connection should use the following statements: ALTER TABLE, CREATE TABLE, DROP TABLE, RENAME TABLE, TRUNCATE TABLE. A consistent read is not isolated from those statements, so use of them on a table to be dumped can cause the SELECT that is performed by mysqldump to retrieve the table contents to obtain incorrect contents or fail.

 

With regard to percona Im now taking a look.

**ADDITION**
I looked at Percona - a version for windows is still in alpha (1.6) and has not been updated. my concern here is that it seems they wont maintain it, therefore reliability is questionable.  The ability to do incremental backup would be very nice though.

Tim I also run a mysql slave master setup ...just because I can...and wanted to test it out...which provides excellent redundancy.

Re: Client Information Back-Ups

MySQL GUI Tools v5.0 is still available and includes MySQL Administrator which provides a simple interface for regular and scheduled backups; it's not the latest version, but it's probably a lot easier for a new entrant to OpenVPMS to get started with.  I use it regularly to backup to both local internal and external drives and cloud sites (eg dropbox), and I regularly restore the latest backup to my "learning/demo" OpenVPMS on a laptop.

The installers for MySQL GUI Tools are located at:
http://downloads.mysql.com/archives.php?p=mysql-gui-tools

and the specific installer for Windows (v5.0r17) is:
http://downloads.mysql.com/archives/mysql-gui-tools/mysql-gui-tools-5.0-...

A tutorial for using MySQL GUI Tools is located at:
http://openvpms.org/documentation/backing-and-restoring-your-openvpms-data

Re: Client Information Back-Ups

Firstly is it possible to move this thread to implementation (I shouldnt have created it here)


That being said:

Be aware if you use my script above to backup ALL DATABASES the backup includes the mysql performance schema, which is a memory only database that exists while the server is running.   Backing it up is probably pointless.  The ALL DATABASES option really exists to do bare metal restores...IE the hard drive collapsed and you lost the entire database. Mostly you should add the database you want to backup as a parameter. 

If you do restore an backup that included all that info - you will find that you get a restore error

 ERROR 1142 (42000) at line 2111: SELECT,LOCK TABL command denied to user 'root'@'server' for table 'cond_instances' 

It doesnt seem to affect data consistency of the table however you can add the --SKIP-LOCKED-TABLES parameter to the restore to avoid the error.

The concern is that the restored mysql instance is inconsistent.  In this case the advice would be to stop an restart the server after a restore at this level.  This clears the tables in memory and removes inconsitencies in the performance schema.

Syndicate content