• No results found

Automated Database Backup. Procedure to create an automated database backup using SQL management tools

N/A
N/A
Protected

Academic year: 2021

Share "Automated Database Backup. Procedure to create an automated database backup using SQL management tools"

Copied!
12
0
0

Loading.... (view fulltext now)

Full text

(1)

                     

Automated Database Backup

Procedure to create an automated database backup using SQL  management tools 

Genetec Technical Support  6/29/2009 

             

(2)

          Notice

This manual, and the software that it describes, is provided under license and may only be used or reproduced in accordance with the terms of such license, and may not be reproduced, stored or transmitted, in any form or by any means, electronic, mechanical, recording, photocopying or otherwise, without the prior written permission of Genetec Inc. The content of this manual is provided for information purposes only, is subject to change without notice, and does not imply a commitment by Genetec Inc. Genetec Inc. assumes no responsibility or liability for errors or inaccuracies that may appear in this manual.

This document is protected by U.S., Canadian and International copyright law.

Existing artwork or images may be protected under copyright law. The unauthorized use of such material in works not produced by Genetec Inc. or its associates could be in violation of the rights of the copyright owner. Please obtain any required permission from the copyright owner.

All trademarks, trade names or company names referenced herein are used for identification only and are the property of their respective owners.

Disclaimer

To the maximum extent permitted by applicable law, Genetec Inc. and its suppliers disclaim any and all warranties and conditions, either express or implied, including, without limitation, implied warranties of merchantability, fitness for a particular purpose, title, and non- infringement, and those arising out of usage of trade or course of dealing, concerning these materials. These materials are provided “as is” at the licensee’s own risk and peril without warranty of any kind.

To the maximum extent permitted by applicable law, in no event shall Genetec Inc. or its suppliers (or their respective agents, directors, employees or representatives) be liable for any damages whatsoever (including, without limitation, direct, indirect, special, incidental, consequential, economic, punitive or similar damages, or damages for loss of business profits, loss of goodwill, business interruption, computer failure or malfunction, loss of business information or any and all other commercial or pecuniary damages or losses) arising out of the purchase or use of these materials, however caused and on any legal theory of liability (whether in tort, contract or otherwise) even if Genetec Inc. has been advised of the possibility of such damages, or for any claim by any other party.

US Government restricted rights

These materials are provided with RESTRICTED RIGHTS. Use, duplication or disclosure by the Government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of The Rights in Technical Data and Computer Software clause at DFARS 252.227-7013 or subparagraphs (c)(1) and (2) of the Commercial Computer Software-restricted Rights at 48 CFR 52.227-19, as applicable.

 

 

(3)

         

Table of Contents 

1.

 

General Information ... 4

 

1.1.

 

Document Revision ... 4

 

1.2.

 

Contacting Technical Assistance ... 4

 

2.

 

Backing up the Database ... 5

 

2.1.

 

Creating the Database Backup Script ... 5

 

2.2.

 

Automating the Database Backup ... 8

 

2.3.

 

Copy to a Network Share Location ... 9

 

3.

 

Restoring the database ... 10

   

                 

   

(4)

         

Automated Database Backup  

Procedure to create an automated database backup 

1. General Information 

The Omnicast Directory service relies on the Directory database to store the system settings. In order to  backup your system configuration (video parameters, video units, camera names, user privileges, alarm  entities, recording parameters, connection types, etc.) you only need to backup the Directory database  to a safe location. If ever a server failure or a database corruption should occur, restoring that database  will be necessary to retrieve the previous system configuration. 

This document explains how to create an automated database backup according to a schedule. The next  sections  describe  the  steps  for  the  Directory  database  but  they  could  also  be  applied  to  the  other  Omnicast databases (alarms, video archives, metadata). 

1.1. Document Revision 

Date  Description 

2007‐08‐01  Document creation 

2009‐06‐29  Updating document with the new format 

1.2. Contacting Technical Assistance 

Customers can reach Genetec’s Technical Assistance Center (GTAC) using any one of the  following methods: 

Log in to Genetec’s Technical Assistance Portal (GTAP)  http://www.genetec.com/english/support/login.aspx  Send questions, via e‐mail, to: 

[email protected] 

Telephone questions to the GTAC at: 

1‐514‐856‐7100 or 1‐866‐338‐2988 (Canada and US only)  FAX questions to the GTAC at: 1‐514‐332‐1692 

 

From Monday to Friday, 8:00 AM to 8:00 PM (Eastern time, GMT ‐5h) 

No matter which method is used to reach the GTAC, customers should be ready to provide all  relevant information describing the problem or question, including System ID and version  information.

 

(5)

         

2. Backing up the Database 

2.1.  Creating the Database Backup Script 

For further SQL Server Express management options, it is necessary to download and install SQL Server  Management Studio Express . The installation file can also be found at: 

http://msdn.microsoft.com/en‐ca/express/bb410792.aspx  

 

This is a free tool from Microsoft that will be used to create a script to backup the Omnicast database. 

 

1. Once the tool is installed, launch Microsoft SQL Server Management Studio Express and connect to the  OMNICAST instance. The server name is usually <server name>\<instance name>. In the screenshot  below, the server name is “ipicot” and the instance name is “Omnicast”. 

 

    

2. Once connected, expand Databases and you will see the Omnicast databases.  

 

   

(6)

         

3. Right click the database you want to backup and select “Tasks / Backup”.   

   

4. A  dialog  box  appears  allowing  you  to  define  different  options  such  as  what  type  of  backup  (full  or  differential) you want to do, backup destination, etc.  

Please note the difference between the Backup set name which is the name for the backup job  and the Backup file name which can be specified when clicking the “Add” button. That file will  be physically located on your hard drive. 

 

 

(7)

         

5. Configure  the  available  options  as  desired  then  click  the  “Options”  page  on  the  left‐hand  column. 

Continue configuring options accordingly. For example, you may want to select “overwrite all existing  backup sets”. 

 

6. At this point, if you only want to perform a manual backup (one time), just click the OK button. The  Progress panel will indicate the progression. 

 

 

7. If  you  want  to  schedule  an automated  backup  (scheduled),  once  all  desired  options  are  set,  select 

“Script  /  Actions  to  File”  and  enter  a  desired  file  name  for  the  script,  for  example, 

“DirectorySQLBackup,” and specify the location where to save the file. 

 

 

(8)

         

 

This creates a .SQL file which scripts the options you defined in the prior step. The contents of your .SQL  file may look like this: 

BACKUP DATABASE [DirectorySQL] TO  DISK = N'C:\Program Files\Microsoft SQL 

Server\MSSQL$OMNICAST\Backup\DirectorySQL.bak' WITH NOFORMAT, NOINIT,  NAME =  N'DirectorySQL‐Full Database Backup', SKIP, NOREWIND, NOUNLOAD,  STATS = 10 

GO 

To test your .SQL file, run the following from a command prompt: 

sqlcmd ‐S <enter server name>\OMNICAST ‐i "C:\<enter path to .sql file>\DirectorySQLBackup.sql" 

After running the SQL script, the DirectorySQL.bak file will be created with the correct data and time  stamp. By default the DirectorySQL.bak is located in C:\Program Files\Microsoft SQL 

Server\MSSQL$OMNICAST\Backup. (This folder might be “MSSQL.1” or “MSSQL.x” depending on what  else is on your server.) 

 

2.2.  Automating the Database Backup 

You can automate the backup process by creating a SQLCMD scheduled task as follows:  

1. First,  create  a  Scheduled  Task  to  automate  the  .SQL  script  created  above.  Use  the  Scheduled  Task  Wizard (Start / All Programs / Accessories / System Tools / Scheduled Tasks). 

2. When  asked  to  select  a  program,  browse  to  C:\Program  Files\Microsoft  SQL  Server\90\Tools\binn\SQLCMD.exe.  

3. Define the Schedule Task parameters accordingly and click “Finish”.  

4. Go the properties of the newly created Scheduled Task and edit the Run command as such: 

(9)

         

"C:\Program  Files\Microsoft  SQL  Server\90\Tools\Binn\SQLCMD.EXE"  ‐S  <enter  server  name>\OMNICAST ‐i "C:\<enter path to .sql file>\DirectorySQLBackup.sql" 

 

   

2.3.  Copy to a Network Share Location 

If  desired,  create  a  simple  batch  file  to  copy  the  DirectorySQL.bak  from  the  local  server  to  a  network  share  located  on  server  being  backed  up  regularly.   For  example,  create  a  text  file  named 

“CopyDirectorySQL.cmd” with the following contents:    

copy "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\DirectorySQL.bak" 

"\\<servername>\<sharename>\" 

Lastly, create a simple Command Prompt Scheduled Task and configure accordingly. Make sure to run  this Scheduled Task after the SQLCMD Scheduled Task.   

Go to  the properties of the newly created Scheduled Task and  edit  the Run  command to point to the  location of CopyDirectorySQL.cmd file (or your respective batch file name). 

 

(10)

         

3. Restoring the database 

Should  a  failure  to  occur,  you  might  need  to  restore  the  Directory  Database  from  the  backup  set  you  created. You can easily restore the database by using the following procedure: 

1. The first step for restoring the database is to stop the Omnicast Directory service. You can do it from  the Server Admin by clicking the “Stop” button. We also recommend stopping the Gateway and the  Directory Failover Coordinator services. If ever the services are restarted by the WatchDog, simply stop  them again. 

 

  2. Launch Microsoft SQL Server Management Studio Express and connect to the OMNICAST instance. 

 

3. Right click the database you want to restore and select “Tasks / Restore / Database”. 

 

 

(11)

         

4. Normally, the source for restoring can be left to “From database”. Make sure to have the right backup  set selected: 

 

  5. Alternately, you can also choose to restore “From device” and manually browse to a backup set file. In 

that case, you will have to specify the backup location by clicking the Add button: 

 

 

(12)

         

6. Once you click OK to select the file, the Backup set content will be displayed. Choose the backup date  you want to restore: 

 

   

7. Once the correct restore source has been chosen, click OK to start the restore operation. The Progress  panel will indicate the progression: 

 

   

The database has now been restored. Start the Omnicast services and verify your settings by logging to  the Config Tool. 

References

Related documents

When you back up a ‘Full Recovery Model’ database using the Traditional SQL Server backup, the result differs depending on the database backup policy configuration for the

societal  levels  with  which  to  analyze  people’s  economic  cost‐benefit  analysis  on  Turkey’s  potential  EU  accession.  Table  3,  taken  from 

One US population survey (n = 2001) found that, compared with former smokers, fewer current smokers were willing to be screened, believed early de- tection can increase survival,

(Copy/Restore Jobs) MONITOR SQL SERVER INSTANCE (OPTIONAL) SECONDARY SERVERS BACKUP SHARE Create Transaction Log Backup (Backup Job) Primary Server Commit Cop y to Bac kup

For each database that is to be backed up, OTTO Max will issue a database / transaction log backup command to Microsoft SQL Server to backup each database to a Microsoft SQL

5) If SQL Server database(s) backup schedule is suspended while local dump is in progress, then Vembu NetworkBackup will suspend the backup after completing the current MS SQL

MS SQL Server 2008 W orkgroup Edition - Please note: this edition currently lacks automated backup capability; manual database dumps will be required.. £21.00 MS SQL Server 2008 R2

Biochemical analysis of selfed individual plants within the sub-lines showed significant increase of average tryptophan con- tent and quality index, as well as significant decrease