Qlik Community

QlikView Documents

Documents for QlikView related information.

Creating a daily backup

MindaugasBacius
Valued Contributor III

Creating a daily backup

The backup function will launch every night via command file managed in Task Scheduler. It will copy the files in specified folders and will paste it in a safe place. The idea is to have the backup for every weekday and update it every day.

Tags (2)
Labels (1)
Comments
beck_bakytbek
Honored Contributor

Bacius,

it is very interesting issue, thanks a lot for your sharing

0 Likes
markodonovan
Valued Contributor

Hi Mindaugas,

I think I will try to use this to refresh source qvds in my development environment.

BTW try launch instead of 'The backup function will lunch'.

A very useful document, taking responsibility for your own backups can save a lot of problems.

Thanks

Mark

0 Likes
santiago_respane
Valued Contributor

Very useful, thanks for sharing!!

0 Likes
Partner
Partner

First "Always have a backup plan"

However I would not recommend using XCOPY as a backup solution. You should use Robocopy instead.

Robocopy has several advantages

- multi-threaded copying

- mirroring or synchronisation mode between the destination and source (XCOPY only copies it does not remove files that no longer exist)

- automatic retry and copy resumption

Below a sample script:

It creates folders for each day of the week (1 to 7)

It generates a datestamped logfile containing info about the backup progress,

- Total files vs Copied / Skipped / Mismatch and FAILED

- Time to backup and size

It only requires 1 task to schedule / maintain and check.

Batch script:

@ECHO OFF

TITLE Backing up your data

:: Create date / time variables (Year,Month,Day,DayOfWeek,Hour,Minute,Second)

:: We use

:: - Year, Month, Day for backuplog filename

:: - DayOfWeek for backup subdirectory

::

for /f %%x in ('wmic path win32_localtime get /format:list ^| findstr "="') do set %%x

:: Generic variables

set logfile=%Year%%Month%%Day%backup.log

:: Setting variables

:: - Data source and target location (unc paths \\servername\sharename are supported)

set source=C:\Qlik\DataFolder

set target=\\Backupserver\Backupsharename

:: Setting files or patterns to exclude. You can enter multiple files on a single line

:: Examples

:: *.csv

:: *.csv *.qvd

set excludefiles=*.csv *.qvd

:: Robocopy parameters used

:: - From folder

:: - To folder

:: - /MIR :: Mirrors a directory tree (deleted files / folders that have been deleted in the source)

:: - /R:1 :: Number of Retries on failed copies: default 1 million

:: - /W:3 :: Wait time between retries: default is 30 seconds

:: - /XF :: Exclude files, usage : /XF [file] [file]. The use of wildcards * and ? is allowed

:: - LOG: :: Creates logfile with output instead of onscreen

:: - /TS :: Include source timestamps in output

:: - /NP :: No progress during backup of files in output

::

:: more info see https://social.technet.microsoft.com/wiki/contents/articles/1073.robocopy-and-a-few-examples.aspx

ECHO Start backup - %Hour%:%Minute%:%Second%

robocopy %source% %target%\%DayOfWeek% /MIR /R:1 /W:3 /XF %excludefiles% /LOG:%logfile% /TS /NP

TIMEOUT 10

Version history
Revision #:
1 of 1
Last update:
‎2016-09-15 01:10 PM
Updated by: