Backing Up and Restring Assured Cmplete Step 1 Befre yur Begin 1. T perfrm a Manual Backup, wrk frm yur Server machine where Assured Cmplete is installed alng with Micrsft SQL Server Management Studi Express 2008. Nte: This prgram wuld have been installed during yur installatin, hwever if yu find it is nt, t www.micrsft.cm/dwnlads site and dwnlad the fllwing file: a. SQLManagementStudi_x86_ENU.exe r b. SQLManagementStudi_x64_ENU.exe if using Windws 64bit O/S. 2. Lg int the server with Administratin rights. 3. **Please nte: The backup will nt cpy attachments and phts that are in yur Assured Cmplete database. T backup attachments and phts, save a cpy f the Attachments flder. The lcatin f the Attachments flder can be viewed in the External Server Attachment Path listed under Glbal Settings in System Settings. 4. **Als nte: Management Studi Express des nt prvide an easy autmated backup slutin within the prgram, hwever this dcument des utline a manual backup prcedure and als a custm autmated backup prcedure that can be used. Step 2 Manual Backup: 1. At the server machine, t Start > Prgrams > Micrsft SQL Server 2008 and select SQL Server Management Studi. Lg in. 2. G t Databases and click the plus [+] t pen all databases. 3. Right click n yur database. The default database name is AssuredCmplete. A pp-up menu shuld appear. 4. Click n Tasks > Back Up The Back Up Database dialg shuld appear. 5. Enter any changes yu wish t make (such as destinatin lcatin r backup file name). Then click OK. The prgress panel will indicate the backup is executing. Please nte that if yu have mre than ne destinatin lcatin listed, the backup file will split between these lcatins. 6. When the backup is cmplete, yu will get a message advising f the backup results. 7. Click OK t finish. Page 1 f 5
Assured Sftware Limited Backing Up And Restring Assured Cmplete Step 3 Autmated Backup - Creating the Scripts 1. Yu will need t create tw flders at yur desired backup lcatin. The first will be AssuredCmpleteBackups, the secnd will be AssuredCmpleteBackupsDel. The default lcatin in this dcument is the C:\ drive 2. Open SQL Server Management Studi then cpy the script belw and paste it int a new query in Management Studi. Please nte that this is a simple backup script where mre parameters can be added if desired. When this script is run it will create a backup f the database specified and append the current date t the saved file name. The backups will be stred in the flder set up in Step 1. AssuredCmplete needs t be the database name and the flder where the backup is t be stred needs t be specified. DECLARE @Path NVARCHAR(1000), @FileName NVARCHAR(255), @FullPath NVARCHAR(1255) SET @Path = 'C:\AssuredCmpleteBackups\' SET @FileName = 'AssuredCmplete_' + REPLACE(CONVERT(VARCHAR(10), GETDATE(), 101), '/', '') + '.bak' SET @FullPath = @Path + @FileName BACKUP DATABASE AssuredCmplete TO DISK = @FullPath WITH INIT 3. Nw save this script and call it smething meaningful like BackupDB.sql. Make sure the file has a.sql file extensin. Place the file in a flder called scripts under the backup directry specified abve. 4. As the abve script will create a new file each time it is run yu will encunter hard drive space issues and begin t have unneccesasary ld backup files. T limit the amunt f backup files a rbcpy cmmand can be run t delete the files after a certain amunt f time. This cmmand can be placed in a batch file alng with a cmmand t call the SQL Script. Rbcpy shuld already be installed n the server, hwever if it is nt it can be dwnladed frm the Micrsft webiste. 5. The final step is t create this batch file which will run these tw scripts at the desired time. Save the file as BackupScripts.cmd and place it in the scripts flder. **Please Nte: <INSTANCENAME> needs t be changed t the server/sql instance name, fr example Server05/AssuredSftware. REM Run SQL Script t backup database sqlcmd -S <INSTANCENAME> -E -i "C:\AssuredCmpleteBackups\scripts\backupDB.sql" Rem Remve files lder than 7 days rbcpy "C:\AssuredCmpleteBackups" "C:\AssuredCmpleteBackupsDel" /MOV /MINAGE:7 /R:10 del "C:\AssuredCmpleteBackupsDel" /q /s Step 3 Autmated Backup - Running the Scripts Page 2 f 5
Assured Sftware Limited Backing Up And Restring Assured Cmplete 1. Once the scripts and batch file are created they need t be executed n a regular basis s that the required database is backed up autmatically. T d this pen Task Scheduler, which can be fund in Start --> All Prgrams --> Accessries --> System Tls. **Nte: The steps may be a little different depending n what perating System yu are runing. 2. Nw frm the right hand Actin menu bar select Create Basic Task... The scheduling Wizard shuld nw be displayed where yu can set up the task. Give the task a meaningful name like BackupAssuredCmplete then click Next... (These steps may be a little different n a Windws XP r Windws Server 2003 machine) 3. Nw specify hw ften yu want t run the task, whether it be daily, weekly r mnthly, then click Next... 4. Nw make sure Start a Prgram is selected then press Next...The prgram we need t run is the batch file we just created, therefre in the prgram field enter the path t this prgram which will be smething like: "C:\AssuredCmpleteBackups\scripts\BackupScripts.cmd" Leave the argument field blank as these were setup in the batch file. The meaning f the cmmand is utlined belw: sqlcmd (prgram that runs the script) -S (this specifies the server\instance name fr SQL Server) Server05\Assuredsftware (this is the server\instance name fr SQL Server) -E (this allws yu t make a trusted cnnectin) -i (this specifies the input cmmand file) 5. If yu want t test the task which has been created then yu can back t the Scheduled Tasks r Task Scheduler, right click n the task and select Run. When the task is run yu shuld see the backup file created in the specified lcatin. If there are files lder than 7 days they shuld be remved. An easy way t test deleting ld files is t change the date f yur cmputer. Page 3 f 5
Assured Sftware Limited Backing Up And Restring Assured Cmplete Restring an Assured Cmplete Database If, fr any reasn, yu needed t rllback t a previus backup f Assured Cmplete yu have the ptin f restring frm a backup. 1. At the server machine, t Start > Prgrams > Micrsft SQL Server 2008 and select SQL Server Management Studi. Lg in. 2. G t Databases and click the plus [+] t pen all databases. 3. Right click n yur database. The default database name is AssuredCmplete. A pp-up menu shuld appear. 4. Click n Tasks > Restre > Database The Restre Database dialg shuld appear. 5. Select the Frm Device radi buttn, then click n the brwse buttn (...) t select the backup file that yu wish t restre frm 6. In the Specify Backup screen click the Add buttn, then navigate t the backup file, then click OK, and OK again n the Specify Backup screen. 7. Nw check ff the backup specified and select Optins in the left hand menu bar. 8. In the ptins screen check ff the first ptin - Overwrite the existing database (WITH REPLACE). Yu will als need t check the lcatin where yu wish t restre the database. By default this is set t the SQL Server install directry, therefre yu will prbably want t change it back t where yur AssuredCmplete database is lcated. On a Windws XP machine the default path is C:\Dcuments and Settings\All Users\Applicatin Data\Assured Sftware\AssuredCmplete. On a Windws Vista/7 machine the default path is C:\PrgramData\Assured Sftware\AssuredCmplete T change the lcatin clck n the brwse buttn (...) fr the database file and als fr the lg file. When yu have made sure these settings are crrect click OK and the database shuld restre. Please nte that yu cannt restre a database while it is in use. 9. When the restre is cmplete, yu will get a message advising f the restre results. 10. Click OK t finish. 11. Once the database is restred a script needs t be run n it t make it ready t use. The script can be fund belw n the next page. 12. T run this script right click n the required database in SQL Management Studi and select New Query. Yu can then paste the script in this windw, hwever befre it is executed yu will need t find all instances f AssuredCmplete in the script (which is the database name) and replace it with the required database name. An easy way t d this is t press CTRL F, then replace all instances f AssuredCmplete with the required database name. (Please nte if yur database is already called AssuredCmplete yu will nt need t perfrm this actin.) 13. Once this step is cmpleted the script can be executed by pressing F5. Please nte that this script smetimes may errr n the first executin, therefre simply execute it a secnd time. 14. The restred Assured Cmplete database is nw ready fr use. If yu require further assistance, be sure t cntact us at clientservices@assuredsftware.cm r 1.877.277.9933. Page 4 f 5
Assured Sftware Limited Backing Up And Restring Assured Cmplete Fix Restre Script alter database AssuredCmplete set single_user with rllback immediate alter database AssuredCmplete set NEW_BROKER alter database AssuredCmplete set trustwrthy n alter database AssuredCmplete set allw_snapsht_islatin n alter database AssuredCmplete set enable_brker alter database AssuredCmplete set read_cmmitted_snapsht n use master grant view server state t AssuredSftware exec sp_cnfigure 'shw advanced ptins', '1' recnfigure exec sp_cnfigure 'clr enabled', '1' exec sp_cnfigure 'shw advanced ptins', '0' recnfigure use AssuredCmplete delete frm Attachment where OriginalFileExtensin like '%.msi%' delete frm systemregistratin if exists (select name frm sys.sysusers where name = 'AssuredSftware') drp user AssuredSftware if nt exists(select name frm sys.syslgins where name = 'AssuredSftware') create lgin AssuredSftware with Passwrd = 'picass', check_expiratin = ff, check_plicy = ff, default_database = AssuredCmplete alter lgin AssuredSftware enable sp_addsrvrlemember 'AssuredSftware', 'bulkadmin' sp_addsrvrlemember 'AssuredSftware', 'sysadmin' if nt exists(select name frm sys.syslgins where name = 'AssuredSftwareSync') create lgin AssuredSftwareSync with Passwrd = 'picass', check_expiratin = ff, check_plicy = ff, default_database = AssuredCmplete if nt exists (select name frm sys.sysusers where name = 'AssuredSftwareSync') create user AssuredSftwareSync exec spsetattachmentrepsitrytdefault alter database AssuredCmplete set multi_user ALTER AUTHORIZATION n Database :: AssuredCmplete t AssuredSftware Page 5 f 5