Backing Up a Windows OTRS Deployment

Dont create your support topics here! No new topics with questions allowed!

Moderator: crythias

Post Reply
DevinRob
OTRS newbie
Posts: 11
Joined: 02 Apr 2012, 22:00
OTRS Version?: 3.3.10

Backing Up a Windows OTRS Deployment

Post by DevinRob » 04 Apr 2012, 16:20

I thought I'd share this information here, since it took me some hunting around and trial and error to sort out. I'm not too familiar with working with MySQL or backing it up, but I put together a rudimentary batch file to accomplish this. Maybe it can serve to help someone else. I will also preface this with the fact that I have deployed OTRS on an OpenSUSE system, but in order to comply with governance we had to move it onto a Windows box.

Our test box is a standard Windows 7 machine. I've setup two batch files that are scheduled to run nightly. Here is the first batch file used to create a dump of the database and will datestamp the file name. It stores it in a directory labeled Backup, but you could change that to a network folder share or USB drive, etc.

Code: Select all

setlocal

set BackUpFilePath=C:\Backup\
set BackUpFileExt=.sql
set BackUpFileName=otrs%BackUpFileExt%

set MyBackUpFile=%date:~4%
set MyBackUpFile=%MyBackUpFile:~-4%-%MyBackUpFile:~,2%-%MyBackUpFile:~3,2%
set MyBackUpFile=%BackUpFilePath%%MyBackUpFile%_%BackUpFileName%

:startbatch
"c:\Program Files\OTRS\mysql\bin\mysqldump.exe" -u otrs -phot otrs > "%MyBackUpFile%" 
This is the batch file used to compress the OTRS directory tree. It uses 7-Zip as the compression utility. 7-Zip can be found here: http://www.7-zip.org/:

Code: Select all

setlocal

set BackUpFilePath=C:\Backup\
set BackUpFileExt=.zip
set BackUpFileName=Archive%BackUpFileExt%

set MyBackUpFile=%date:~4%
set MyBackUpFile=%MyBackUpFile:~-4%-%MyBackUpFile:~,2%-%MyBackUpFile:~3,2%
set MyBackUpFile=%BackUpFilePath%%MyBackUpFile%_%BackUpFileName%

:startbatch
"c:\Program Files\7-Zip\7z.exe" a -r "%MyBackUpFile%" "C:\program files\otrs\otrs\*"
Hopefully this can save someone else a little time in the future, or at least educate them on the correct command line call for mysqldump. Keep in mind this would probably work on a small deployment, but deployments with storage surpassing a few GB should probably use another method.
Last edited by DevinRob on 01 Jun 2012, 20:38, edited 1 time in total.
OTRS 3.3.10 on Windows 2008 R2

guillo
OTRS expert
Posts: 98
Joined: 16 May 2012, 20:05
OTRS Version?: 3.0.7

Re: Backing Up a Windows OTRS Deployment

Post by guillo » 31 May 2012, 19:19

Hi there, I gave it a shot using your bat file but get the error: The system cannot find the path specified at the very last line. I have the default folders. I've created a backup folder on C: and no dice.
OTRS V 3.0.7 Windows 2008 x64 going for 3.1.7
OTRS 3.1.12 on LINUX UBUNTU SERVER

guillo
OTRS expert
Posts: 98
Joined: 16 May 2012, 20:05
OTRS Version?: 3.0.7

Re: Backing Up a Windows OTRS Deployment

Post by guillo » 31 May 2012, 21:03

So I created the file and It gave an error on the last line The System Cannot find the path Specified.

The c:\backup folder is already created.
OTRS V 3.0.7 Windows 2008 x64 going for 3.1.7
OTRS 3.1.12 on LINUX UBUNTU SERVER

DevinRob
OTRS newbie
Posts: 11
Joined: 02 Apr 2012, 22:00
OTRS Version?: 3.3.10

Re: Backing Up a Windows OTRS Deployment

Post by DevinRob » 05 Jun 2012, 14:41

Which batch file were you attempting to create? I listed two in this post.

Is it unable to follow the path to the mysqldump.exe or the 7z.exe?
OTRS 3.3.10 on Windows 2008 R2

DevinRob
OTRS newbie
Posts: 11
Joined: 02 Apr 2012, 22:00
OTRS Version?: 3.3.10

Re: Backing Up a Windows OTRS Deployment

Post by DevinRob » 05 Jun 2012, 23:03

You'll need to verify the path of whatever utility is running, be it mysqldump.exe or 7z.exe
OTRS 3.3.10 on Windows 2008 R2

guillo
OTRS expert
Posts: 98
Joined: 16 May 2012, 20:05
OTRS Version?: 3.0.7

Re: Backing Up a Windows OTRS Deployment

Post by guillo » 19 Jun 2012, 20:07

DevinRob wrote:Which batch file were you attempting to create? I listed two in this post.

Is it unable to follow the path to the mysqldump.exe or the 7z.exe?

The first batch file.
OTRS V 3.0.7 Windows 2008 x64 going for 3.1.7
OTRS 3.1.12 on LINUX UBUNTU SERVER

arvas
OTRS newbie
Posts: 45
Joined: 15 Oct 2012, 09:08
OTRS Version?: 3.0.11

Re: Backing Up a Windows OTRS Deployment

Post by arvas » 31 Dec 2012, 13:04

im encountering errors running both scripts, heres a log of the 7zip script error:

Code: Select all

Backslash found where operator expected at F:\2012\OTRS\bin\backup.pl line 3, ne
ar "Backup\"
Operator or semicolon missing before %BackUpFileExt at F:\2012\OTRS\bin\backup.p
l line 5.
Ambiguous use of % resolved as operator % at F:\2012\OTRS\bin\backup.pl line 5.
Operator or semicolon missing before %_ at F:\2012\OTRS\bin\backup.pl line 9.
Ambiguous use of % resolved as operator % at F:\2012\OTRS\bin\backup.pl line 9.
Operator or semicolon missing before %BackUpFileName at F:\2012\OTRS\bin\backup.
pl line 9.
Ambiguous use of % resolved as operator % at F:\2012\OTRS\bin\backup.pl line 9.
String found where operator expected at F:\2012\OTRS\bin\backup.pl line 12, near
 "startbatch
    "E:\7-Zip\7z.exe""
        (Do you need to predeclare startbatch?)
String found where operator expected at F:\2012\OTRS\bin\backup.pl line 12, near
 ""%MyBackUpFile%" "C:\program files\otrs\otrs\*""
        (Missing operator before  "C:\program files\otrs\otrs\*"?)
Can't modify constant item in scalar assignment at F:\2012\OTRS\bin\backup.pl li
ne 3, near "C:"
syntax error at F:\2012\OTRS\bin\backup.pl line 3, near "C:"
Execution of F:\2012\OTRS\bin\backup.pl aborted due to compilation errors.
The code i used is:

Code: Select all

    setlocal

    set BackUpFilePath=C:\Backup\
    set BackUpFileExt=.zip
    set BackUpFileName=Archive%BackUpFileExt%

    set MyBackUpFile=%date:~4%
    set MyBackUpFile=%MyBackUpFile:~-4%-%MyBackUpFile:~,2%-%MyBackUpFile:~3,2%
    set MyBackUpFile=%BackUpFilePath%%MyBackUpFile%_%BackUpFileName%

    :startbatch
    "E:\7-Zip\7z.exe" a -r "%MyBackUpFile%" "F:\2012\OTRS\*"
any idea?

AVillar
OTRS newbie
Posts: 35
Joined: 10 Apr 2012, 15:47
OTRS Version?: 3.0.6

Re: Backing Up a Windows OTRS Deployment

Post by AVillar » 16 Jan 2013, 17:14

Hello Devin.

What is the restore procedure for a backup like this one?

Thanks in advance.-

User avatar
theodore
OTRS newbie
Posts: 26
Joined: 09 Jun 2010, 12:51
OTRS Version?: 3.3.11

Re: Backing Up a Windows OTRS Deployment

Post by theodore » 06 Feb 2015, 12:51

Hello,

To perform a restore to a NEW windows system you need to have the following:

1. The installation file of the OTRS version you are currently use.
2. The active pearl installation file that you are currently use.
3. A backup of the database (mysqldump -uroot OTRS > C:\OTRS_BCK.SQL)
4. A backup of the folder <installation folder>\OTRS\var\article (if you use FSDB)
5. A backup of the configuration (from "ADMIN" -> "SysConfig" -> "Export Settings")
6. A backup of the <installation folder>\OTRS\Kernel\config.pm
7. A documentation of all the changed that you have made in the otrs files (for example if you have edited the file kernel/system/ticket.pm)

The steps to restore the OTRS are:

1. Install active pearl that you where using and configure it properly (if you want to use active pearl)
2. Install OTRS on the same version and same installation directory path that you where ussing, run the web config
3. Check that the new installation is working
4. Drop the database:

From command line run the following
CD <install dir>\mysql\bin\
MySQL -uroot
drop schema otrs;
drop user otrs@localhost;
FLUSH PRIVILEGES;

5. Create the database

(to view the password that you where ussing have a look at the config.pm)
From command line run the following
CD <install dir>\mysql\bin\
MySQL -uroot
show databases;
CREATE DATABASE otrs CHARACTER SET utf8;
GRANT all ON otrs.* TO 'otrs'@'localhost' IDENTIFIED BY '<old password>';
FLUSH PRIVILEGES;
EXIT

6. Restore the database

From command prompt
CD <install dir>\mysql\bin\
mysql -uroot otrs < c:\otrs_bck.sql

7. restore the folder <installation folder>\OTRS\var\article
8. restore the <installation folder>\OTRS\Kernel\config.pm
9. Log in OTRS as admin and restore the configuration (from "ADMIN" -> "SysConfig" -> "Import Settings")
10. Manually edit the files that you have changed and make the changes again
OTRS 3.3.11 MariaDB CentOS 7

Post Reply