SankalpIT – Plugins for Automate

How to Restore ConnectWise Automate Database

How to Restore ConnectWise Automate Database
How to Restore ConnectWise Automate Database
It is essential for your business to have backups of your IT environment. Lost data can cause a noteworthy emergency, lost income and extremely unhappy customers.

How ConnectWise Automate does backup of database?

You must be interested to know how ConnectWise Automate does the backup of database.

Steps to Restore ConnectWise Automate from Backup

Prerequisite

See screenshot.

Drop and Create ConnectWise Automate Database.bat

Note :

See screenshot.

MySQLexe

Stop ConnectWise Automate Critical services

1. Stop all the following services.

Use the following Powershell command to stop ConnectWise Automate critical services

Get-service LabMySQL,LTAgent,LTService,LTSvcMon,LTRedirSvc | ?{$_.status -eq 'running'}|stop-service

Unzip ConnectWise Automate databse “Structure” and “Data” to “Labtech.1” folder on your desktop!

Delete logs files and a folder

Open to C:\Program Files (x86)\LabTech\mysql\data folder and delete the following log files and a folder.

labtech (a folder).
ibdata1, ib_logfile0 and ib_logfile1 log files.

Re-create ConnectWise Automate database

Before proceeding further, Please make sure LabMySQL is running. If not, open the command prompt and run the following command.

Download File: Start LabMySQL Service.bat
net start LabMySQL

Now, you need to drop “ConnectWise Automate” database and create it again.Use the following batch script to recreate MySQL database called “LabTech”. Replace ProvideYourPasswordHereWithoutQuotes with root password in the following script.

Download File: Drop and Create LabTech Database.bat

@echo off

SET rootuser=root
SET rootPassword=ProvideYourPasswordHereWithoutQuotes
SET MySQLexe=”c:\program files (x86)\labtech\mysql\bin\mysql.exe”

%MySQLexe% –user=%rootuser% –password=%rootPassword% –execute=”drop database labtech;”
Echo ……………….Dropped ConnectWise Automate Database………………
Echo.
pause > nul
Echo ……………….Creating ConnectWise Automate Database……………….
Echo.

%MySQLexe% –user=%rootuser% –password=%rootPassword% –execute=”create database ConnectWise Automate;”

Echo ConnectWise Automate Database has been created successfully……………….
echo.
pause > nul

Import ConnectWise Automate database structure

After re-creating database, you need to import MySQL “Tables”, “Views”, “Triggers” and “Procedures” into database. Use the following batch script.

Download File:
Import Structure to Database.bat

@echo off

SET rootuser=root
SET rootPassword=ProvideYourPasswordHereWithoutQuotes
SET MySQLexe=”c:\program files (x86)\labtech\mysql\bin\mysql.exe”
SET sourceFolder=%USERPROFILE%\Desktop\Labtech.1

%MySQLexe% –user=%rootuser% –password=%rootPassword% -b labtech < “%sourceFolder%\DBaseTable.sql”
echo.
Echo ……………….Imported LabTech Tables structure………………
Echo.

%MySQLexe% –user=%rootuser% –password=%rootPassword% -b labtech < “%sourceFolder%\DBaseViews.sql”
echo.
Echo ……………….Imported LabTech Views………………
Echo.

%MySQLexe% –user=%rootuser% –password=%rootPassword% -b labtech < “%sourceFolder%\DBaseTrigger.sql”
echo.
Echo ……………….Imported LabTech Triggers………………
Echo.

%MySQLexe% –user=%rootuser% –password=%rootPassword% -b labtech < “%sourceFolder%\DBaseProc.sql” echo. Echo ……………….Imported LabTech Procedures……………… Echo. Echo ——————— Press any key to Exit———————- Pause > nul

Import ConnectWise Automate Database data

Now, we need to import data in LabTech database. Use the following batch script for that.

Download File: Import Data to Database.bat


@echo off

SET rootuser=root
SET rootPassword=ProvideYourPasswordHereWithoutQuotes
SET MySQLexe=”c:\program files (x86)\labtech\mysql\bin\mysql.exe”
SET sourceFolder=%USERPROFILE%\Desktop\Labtech.1

FOR /f %%a IN (‘dir /b %sourceFolder%\*.sql’) DO “%MySQLexe% –user=%rootuser% –password=%rootPassword% -b labtech < “%sourceFolder%\%%a” Echo. Echo ……………….Imported LabTech data in database……………… Echo ——————— Press any key to Exit———————- pause > nul

Log in to the Control Center

Log in to the
Control Center
and verify that all agents are there, and then wait approximately 10 minutes for
the agents to begin to check in