Microsoft SQL Server Guide. Best Practices and Backup Procedures



Similar documents
1 of 10 1/31/2014 4:08 PM

Moving the TRITON Reporting Databases

Moving the Web Security Log Database

Implementing Microsoft SQL Server 2008 Exercise Guide. Database by Design

SQL Server 2005 Advanced settings

Restoring Sage Data Sage 200

Upgrading from MSDE to SQL Server 2005 Express Edition with Advanced Services SP2

Protecting SQL Server Databases Software Pursuits, Inc.

Migrating MSDE to Microsoft SQL 2008 R2 Express

Installing SQL Express. For CribMaster 9.2 and Later

FUSION Installation Guide

SQL Server Protection Whitepaper

Install SQL Server 2014 Express Edition

Table of Contents. CHAPTER 1 About This Guide CHAPTER 2 Introduction CHAPTER 3 Database Backup and Restoration... 15

STIDistrict Server Replacement

Portions of this product were created using LEADTOOLS LEAD Technologies, Inc. ALL RIGHTS RESERVED.

Lenovo Online Data Backup User Guide Version

How to Copy A SQL Database SQL Server Express (Making a History Company)

Support Document: Microsoft SQL Server - LiveVault 7.6X

Database Administration Guide

Application Server Installation

Database Maintenance Guide

Installing LearningBay Enterprise Part 2

TANDBERG MANAGEMENT SUITE 10.0

Backups and Maintenance

Outlook Profile Setup Guide Exchange 2010 Quick Start and Detailed Instructions

About This Manual. 2 About This Manual

4 Backing Up and Restoring System Software

How To Backup A Database In Navision

Cloud Services ADM. Agent Deployment Guide

BSDI Advanced Fitness & Wellness Software

GO!NotifyLink. Database Maintenance. GO!NotifyLink Database Maintenance 1

Stellar Phoenix. SQL Database Repair 6.0. Installation Guide

vcenter Configuration Manager Backup and Disaster Recovery Guide VCM 5.3

SQL Server 2008 R2 Express Installation for Windows 7 Professional, Vista Business Edition and XP Professional.

BDR for ShadowProtect Solution Guide and Best Practices

SOS SO S O n O lin n e lin e Bac Ba kup cku ck p u USER MANUAL

VMware vcenter Configuration Manager Backup and Disaster Recovery Guide vcenter Configuration Manager 5.4.1

ScriptLogic File System Auditor Agent Configuration Getting Started Guide

Backup Assistant. User Guide. NEC NEC Unified Solutions, Inc. March 2008 NDA-30282, Revision 6

NovaBACKUP. Storage Server. NovaStor / May 2011

Notes Transfer instructions INTRODUCTION More information

How to Install CS OrthoTrac on a New Server and Copy the Data from the Old Server to the New Version 12 and higher

3 Setting up Databases on a Microsoft SQL 7.0 Server

GUARD1 PLUS SE Administrator's Manual

Integrating Data Protection Manager with StorTrends itx

Juris Installation / Upgrade Guide

Application Note 116: Gauntlet System High Availability Using Replication

Planning the Installation and Installing SQL Server

Novell File Reporter 2.5 Who Has What?

Version: Page 1 of 5

Bosch ReadykeyPRO Unlimited Installation Guide, product version 6.5. This guide is item number DOC , revision 2.029, May 2012.

How To Backup An Rssql Database With A Backup And Maintenance Wizard

enicq 5 System Administrator s Guide

Time Stamp. Instruction Booklet

How To Create An Easybelle History Database On A Microsoft Powerbook (Windows)

Using MS-SQL Server with Visual DataFlex March, 2009

ProjectWise Explorer V8i User Manual for Subconsultants & Team Members

EVault Software. Course 361 Protecting Linux and UNIX with EVault

Preparing a SQL Server for EmpowerID installation

Microsoft SQL Server Staging

TimeValue Software Due Date Tracking and Task Management Software

Setting Up Monthly Reporter

Database Administration Guide

VMware/Hyper-V Backup Plug-in User Guide

Active Directory Management. Agent Deployment Guide

How To Upgrade Your Microsoft SQL Server for Accounting CS Version

TSM Studio Server User Guide

Team Foundation Server 2012 Installation Guide

Introduction to Hyper-V High- Availability with Failover Clustering

How To Use A Microsoft Microsoft Database Server 2012

Xopero Centrally managed backup solution. User Manual

MS SQL Server Backup - User Guide

SQL Server Protection. User guide

ImageNow for Microsoft SQL Server

Portions of this product were created using LEADTOOLS LEAD Technologies, Inc. ALL RIGHTS RESERVED.

How To Restore Your Data On A Backup By Mozy (Windows) On A Pc Or Macbook Or Macintosh (Windows 2) On Your Computer Or Mac) On An Pc Or Ipad (Windows 3) On Pc Or Pc Or Micro

NovaBACKUP. User Manual. NovaStor / November 2011

Technical Paper. Defining an ODBC Library in SAS 9.2 Management Console Using Microsoft Windows NT Authentication

Archive Attender Version 3.5

VERITAS Backup Exec 9.1 for Windows Servers Quick Installation Guide

NetBak Replicator 4.0 User Manual Version 1.0

PCVITA Express Migrator for SharePoint(Exchange Public Folder) Table of Contents

StarWind iscsi SAN Software: Implementation of Enhanced Data Protection Using StarWind Continuous Data Protection

SQL Server Protection

Team Foundation Server 2010, Visual Studio Ultimate 2010, Team Build 2010, & Lab Management Beta 2 Installation Guide

StarWind iscsi SAN Software: Using an existing SAN for configuring High Availability storage with Windows Server 2003 and 2008

InformationNOW SQL 2008 Database Backup and Restoration

QAD Enterprise Applications. Training Guide Demand Management 6.1 Technical Training

SQL Server Setup Guide for BusinessObjects Planning

efolder BDR for Veeam Cloud Connection Guide

BrightStor ARCserve Backup for Windows

Backup and Recovery. What Backup, Recovery, and Disaster Recovery Mean to Your SQL Anywhere Databases

Database Backup and Recovery Guide

Step-by-Step Guide to Setup Instant Messaging (IM) Workspace Datasheet

Automating Administration with SQL Agent

WhatsUp Gold v16.2 Installation and Configuration Guide

SQL Backup and Restore using CDP

Transcription:

Microsoft SQL Server Guide Best Practices and Backup Procedures

Constellation HomeBuilder Systems Inc. This document is copyrighted and all rights are reserved. This document may not, in whole or in part, be copied, photocopied, translated, or reduced to any electronic medium or machine- readable form without prior consent, in writing, from Constellation HomeBuilder Systems Inc. The information in this document is subject to change without notice and should not be construed as a commitment by Constellation HomeBuilder Systems Inc. Constellation HomeBuilder Systems Inc. assumes no responsibility for any errors that may appear in this document. Printed in Canada February 2011 Product names are trademarks or registered trademarks of their respective manufacturers. Copyright 1991-2011 Constellation HomeBuilder Systems Inc., All Rights Reserved.

Table of Contents Best Practices...2 Preparation for MS SQL Server Installation...2 Disks...2 CPU...2 Memory...2 MS SQL Server Installation options...2 Collation...2 Authentication...2 Services...2 Instance Options...3 Memory allocation...3 Authentication...3 Microsoft SQL Server Configuration Manager...3 Network Configuration...3 sa user...3 Database Options...3 Database files...3 Recovery Model...4 Auto_Shrink...4 Auto_Close...4 Page Verification...5 High Availability...5 Backup Procedure...5 MS SQL Server 2000...5 MS SQL Server 2005 and above... 13 Daily Routine... 19 Help Desk Information... 20

Best Practices This section of document has outlined the recommended best practices to use for SQL Server installation and configuration. The document is a compilation of most common asked questions. The content of this document will change without notice based on recommended changes from Microsoft, Progress and NEWSTAR technical staff. Preparation for MS SQL Server Installation This section is meant to help prepare for MS SQL Server installation and questions about hardware on the server. For detailed recommended specifications for the server to be used for NEWSTAR Applications please see the Technical Specification guide found here. Disks There are three MS SQL Server components that need to account for: System databases, NEWSTAR databases and backups. System databases such as TempDB are important because SQL Server uses these databases to perform internal operations. For example TempDB is used for sorting purposes. Depending on the size and number of NEWSTAR databases disk space needs to be considered for current, future growth and backup of the databases. It is important to place the system databases on a separate disks than the NEWSTAR databases for performance reasons. At this time it is recommended to use 10K or 15K SAS drives. CPU Microsoft SQL Server can take up large portions of CPU time depending on the number of uses and databases. Memory The default behavior of MS SQL Server is to load as much of the database as it is allowed to memory to speed up the queries. As result it is recommended to have adequate memory on the server to support both MS SQL Server and the operating system. MS SQL Server Installation options Collation It is essential to choose Latin1_General_CP1_CI_AS which is a case insensitive collation. Choosing a case sensitive collation will force MS SQL Server to look for upper or lower case for all columns and data which in turn could prevent the users from seeing certain information in the database. Authentication The type of Authentication must be set to Mixed Mode. Although NEWSTAR Sales is usually deployed using Windows Authentication but NEWSTAR Enterprise uses SQL Authentication to connect to the SQL database. Services If you are using MS SQL Server 2000 then you will have to manually change the user after the installation is completed. It is recommended that a user be created on the Active Directory with is part of Domain Users group. You must make sure the user that you are using for the service is part of the sysdba role on the MS SQL Server. Microsoft SQL Server Guide Best Practices and Backup Procedures 2

Instance Options Memory allocation As mentioned in the Preparation section the default behavior of MS SQL Server is to load as much of the database as it is allowed to memory to speed up the queries. However this could cause potential issues if you using the server for other purposes than hosting the MS SQL Server or if you do not have too much memory available. For example if you are hosting NEWSTAR Enterprise SQL application and databases on a server with 4GB RAM. The issues occurs when MS SQL Server acquires most of the memory available on the server and as result the other processes such as operating system processes will not have the memory they need to function normally. Authentication The type of Authentication must be set to Mixed Mode which allows for both Windows Authentication and SQL Authentication. Although NEWSTAR Sales is usually deployed using Windows Authentication but NEWSTAR Enterprise uses SQL Authentication to connect to the SQL database. Microsoft SQL Server Configuration Manager Microsoft introduced Configuration Manager with Microsoft SQL Server 2005 in order to help manage all services and SQL Server s access methods through one utility. All Start/Stop, changes to services and modification to access methods should be done through this utility to ensure all the proper procedures are followed in starting, stopping and modifications. Network Configuration Microsoft SQL Server has the ability to listen and process commands and queries from several methods such as Shared Memory, TCP/IP and net pipe. NEWSTAR requires TCP/IP as the method to access the MS SQL Server and it is recommended to turn off any other method if it is not needed. This would drastically limit the number of ways a harmful application such as virus to have access to the SQL Server instance. The options can be accessed and changed through Microsoft SQL Server Configuration Manager for MS SQL Server 2005 and above and Server and Client Network utility for MS SQL Server 2000. sa user The sa user is a special user that comes built in with MS SQL Server and it is part of the sysdba role which has access to all objects and resources within the MS SQL Server. Therefore this user is the target for most viruses and hackers and as result it is important to protect the access to this user by all means necessary. The very first step to protect this use is to set up a strong password for the user. The installation will ask for a password to be set for the user but using a strong password is not enforced until MS SQL Server 2008. The second step is to rename the user from sa to another name which is harder to guess. This task can be accomplished by running the following command against the MS SQL Server. Please note that only members of sysdba role are able to rename sa account. ALTER LOGIN sa WITH NAME = [newsaaccountname]; NEWSTAR does not recommend disabling the sa user. Database Options Database files There are two categories of database files in MS SQL Server: Data files and Transaction Logs. The data files are grouped in File Groups. Both of these files are important because: Microsoft SQL Server Guide Best Practices and Backup Procedures 3

1. All the database content are in these files 2. Database recovery can be maximized depending on the configuration of these files 3. The performance of the database is measured by the through put on the transaction logs The first data file in the database usually has the extension of mdf and rest of the files have extension of ndf. The transaction log has the extension of ldf. Note that the extension are not enforced by SQL Server and these are only the recommended extensions by Microsoft since it would help other technical staff recognize the types of files immediately. It is important to note that Microsoft SQL Server spawns a new thread for every data file which can help boost the performance for large databases. Creating more than one data file is not recommended for smaller databases as it causes more maintenance than it is truly worth. The allocation and the rate of growth of the database files is very important as it could cause performance issues. By default NEWSTAR technicians will set the rate of growth to 10% which means that the Microsoft SQL Server will acquire 10% of current size of the file whenever the file fills up. It s important to have plenty of available disk space on the server. If the database is not able to acquire more disk space then the transactions will rollback. Recovery Model Recovery Model options allows administrators to define the behavior of the transaction logs and as such it affects the backup strategy. There are three different types of Recovery Models: 1. Full This is the Microsoft recommended model since it maximizes the ability to recover data when proper steps are taken in events such as database crash or corruption on page. The downside of this method is that unless you have set up transaction log backups then the file grows exponentially (depending on number of transactions) since every transaction is writing to the log and it is not removed until a backup is taken. There have been cases where NEWSTAR technicians had to deal with transaction logs that had grown to 30 GB for a 4 GB database. NEWSTAR recommends this recovery model for clients with larger databases who have IT staff with SQL Server administration knowledge. 2. Bulk logged This recovery model is the same as Full recovery model with two exceptions: - The imports using bcp and other load utilities are not recorded to the transaction log - Administrator is not able to recover data to a point in time Please note that NEWSTAR does not recommend using this model. 3. Simple This recovery model will force SQL Server to clear the committed transactions from the transaction log and therefore the log file does not grow as big. This model requires much less maintenance and disk space. By default NEWSTAR database will use Simple recovery model and it is recommended to be kept as such for smaller databases that handle lower number of transactions. Auto_Shrink This option is self-explanatory. It attempts to release any free space in the database back to the operating system. The problem with this option is that it will cause unnecessary I/O and in most cases MS SQL Server has to acquire the same amount space that was freed up moments after it was released. This option can cause major performance degradation and should be turned off. Auto_Close This option will force SQL Server to close the database and flush the procedure cache after each connection and as result can cause major performance degradation on the SQL Server. This option must be turned off. Microsoft SQL Server Guide Best Practices and Backup Procedures 4

Page Verification The Page Verify option allows SQL Server to perform a verification test to make sure the pages read and written to disk are valid. SQL Server 2000 allows only Torn Page Detection and the check mark must be selected. As of SQL Server 2005 administrators are allowed to choose between Torn Page Detection and CheckSum verification process. Microsoft recommends using CheckSum for all databases on SQL Server 2005 or later. If a page is corrupted or missing an entry in the error log is created by the page verification process. Administrators can set up notifications to be sent to them if such errors are found. High Availability There are several points that administrators should take note of in event where they are asked to implement replication, log shipping or database mirroring for NEWSTAR databases: o o o As part of the standard schema NEWSTAR databases have primary key set up which you will need to set up the replication. For NEWSTAR Enterprise the primary key is on PROGRESS_RECID_IDENT_ NEWSTAR Sales and other products the location of primary key vary on each table. The replication or high availability option must completely be removed before using Constellation Updater to update the datasets. If it is not removed then it creates a lock on objects and Constellation Updater is not able to update the schema and as result the update will fail. It is important to plan the high availability solution before implementing and gather all requirements from the users. E.g. is the high availability solution is meant to provide redundancy for the database or only for reporting purposes? What is the acceptable loss of data in event of a database crash? Backup Procedure MS SQL Server 2000 1. Check that you have access to the Database server with administrative rights. 2. The MS SQL 2000 Server Agent must be running (the application, which is responsible for backup). There are 2 simple ways to check it: From the Start menu: i. Click Programs > Microsoft SQL Server > Service Manager The MS SQL icon should appear on the right bottom side of your screen, ii. Double click. The MS SQL Server Service Manager Console opens. Microsoft SQL Server Guide Best Practices and Backup Procedures 5

3. From Services drop-down list, select SQL Server Agent: 4. Select the Auto-start service when OS starts check box. 5. Click Start/Continue. The green arrow icon must be visible indicating that service is running. 6. Close the SQL Server Service Manager screen. 7. From the Start menu, click Programs > Microsoft SQL Server > Enterprise Manager. The SQL Server Enterprise Manager Console opens. 8. Select Console Root > Microsoft SQL Server > SQL Server Group > Local Windows NT (this may be different on your machine, access MS SQL server on your local server, opening local server). 9. Select Management and then click Database Management Plans. 10. Right click Database Maintenance and the select New Maintenance Plan from the dropdown list. The Database Maintenance Plan Wizard opens. Microsoft SQL Server Guide Best Practices and Backup Procedures 6

11. Click Next. The Database Maintenance Plan Wizard opens. 12. Click the These databases radio button. Use the following table as a guide to back up database(s) by select appropriate check box(es). DATABASE SPLive SPProto HBLive DESCRIPTION NEWSTAR Sales The live database NEWSTAR Sales The test environment database NEWSTAR Enterprise The live database Microsoft SQL Server Guide Best Practices and Backup Procedures 7

HBProto NEWSTAR Enterprise The test environment database 13. Click Next. Update Data Optimization Information screen opens. 14. Click Next (no boxes are selected). The Database Integrity Check screen opens. 15. Click Next (no boxes are selected). The Specify Database Backup Plan screen opens. 16. Select Back up the database as part of the maintenance plan and the Verify the integrity of the backup when complete check boxed. 17. Select the Disk radio button, and then click Change. The Edit Recurring Job Schedule screen opens. Microsoft SQL Server Guide Best Practices and Backup Procedures 8

18. From the Edit Recurring Job Schedule screen, select the following: i. Click the Enable Schedule check box. ii. Click the Daily radio button in the Occurs section. iii. Select Every 1 day(s) from the Daily dropdown list. iv. Select the Occurs once at radio button, and then select 8:00:00 PM from Daily frequency section (if you sure that most of work for the day is done by this time). v. Select today as a Start date. vi. Click the No end date radio button from the Duration section. 19. Click OK to save your work. The Specify Database Backup Plan screen re-appears. 20. Click Next. The Specify Backup Disk Directory opens. Microsoft SQL Server Guide Best Practices and Backup Procedures 9

21. Click the Use the directory: option, and then select the directory in which you want to store your backups Note: Backups consume a lot of disk space and can quickly leave your system without disk space. We strongly advise that you use a separate volume for your backup which doesn t have any critical applications or operating system installed. 22. De-select the Create a subdirectory for each database check box. 23. Select the Remove files older than check box, and then select 2 weeks from the dropdown lists (depending on the amount of disk space you have allocated for your backup and how redundant is your recovery plan), 24. Enter BAK in the Backup file extension field. 25. Click Next. The Specify the Transaction Log Backup Plan screen opens. 26. Click Next. The Reports to Generate screen opens. Microsoft SQL Server Guide Best Practices and Backup Procedures 10

27. Click the Write report to a text file in directory checkbox, and then specify either the same directory as your backup directory or create a subdirectory. 28. Click the Delete t ext report files older than checkbox, and then select 2 Week(s) from the dropdown lists. 29. Click Next. The Maintenance Plan History screen opens. 30. De-Select all check boxes and then click Next. The Completing the Database Maintenance Plan Wizard screen opens. Use the following table as a guide to assign names to the database backups. Microsoft SQL Server Guide Best Practices and Backup Procedures 11

DATABASE SPLive SPProto HBLive HBProto BACKUP PLAN NAME SPLive_Backup SPProto_Backup HPLive_Backup HPProto_Backup 31. Click Finish. A message box opens stating that you have Successfully created the maintenance plan. The new Backup Plan appears on the right side of your folder structure. 32. Close the SQL Server Enterprise Manager Console. Microsoft SQL Server Guide Best Practices and Backup Procedures 12

MS SQL Server 2005 and above 1. Check to make sure you have administrator rights on the Database server. 2. You will need to make sure SQL Server Agent is running and the service is set to start automatically. Note the green sign beside SQL Server Agent in SQL Server Management studio. If the Agent is not running then you should go to SQL Server Configuration Manager and try to start it. If it doesn t start then it could be that the user it is running as is not valid. 3. Expand Management subtree and right click on Maintenance Plans. Select Management Wizard. Microsoft SQL Server Guide Best Practices and Backup Procedures 13

4. Once the SQL Server Maintenance Plan wizard opens click next to continue. 5. In the next window enter a name for the database maintenance plan. From this window you will need to decide what back up strategy you are following. If you re going with a simple backup strategy such as taking a Full Backup of database every day then you probably want to choose a single schedule however if you are planning to do differential or transaction log backups then you want to choose separate schedules for each step. Microsoft SQL Server Guide Best Practices and Backup Procedures 14

6. If you choose to have single schedule for all steps then you must select Change and select the schedule you wish to proceed with. If you chose to have separate schedules then the Change button will be blanked out and you should go to step 8. 7. In the next screen you are able to select the steps you would like SQL Server Agent to perform. For taking a Full back select Backup Database (Full). It is recommended that you would do a database integrity check on a weekly basis. This document covers only the backup section however setting up other Maintenance plans to perform other database maintenance jobs is very similar. Take note that most of the jobs like database integrity check must be scheduled for after hours when none of the users are working on the database. Once you have selected the items you wish to include in the maintenance plan then click on Next. Microsoft SQL Server Guide Best Practices and Backup Procedures 15

8. In this page you will be able to tell SQL Server in which order you wish the tasks to run. If you ve select only to do a full back up then it will be the only task shown. Click Next to continue. Microsoft SQL Server Guide Best Practices and Backup Procedures 16

9. This step allows you to set up the Full Database back up for all or specific databases, the path you wish the databases to written at, extension of the file and the finally whether to check the backup integrity once finished. Be sure to select all the databases you wish to back up and make sure the path for the backup directory exists. Verify Backup Integrity must be checked as well to make sure your backups are valid. Click on Next to continue. Microsoft SQL Server Guide Best Practices and Backup Procedures 17

10. SQL Server Agent is able to generate a report for the maintenance plan and it is able to send it through email or write it to disk. To be able to send the reports through email you must configure Database Mail and operators. Click Next to continue. 11. Review all the options you have selected to make sure they re correct and then select Finish to continue. Microsoft SQL Server Guide Best Practices and Backup Procedures 18

12. SQL Server creates and configures the job through SQL Server Agent. You should see success for all steps. Daily Routine Monitor the daily backup activity for the first few days. If your backup period is 2 weeks, check your backup directory after 2 weeks to make sure that old backup files are being deleted. Check your disk space daily basis. If you are running out of space: Increase the disk space Delete old backup files Decrease backup cycle from 2 weeks to 1 week Monitor the backup and try to restore the database once in a while. Warning: Do not overwrite the NEWSTAR Live databases. Microsoft SQL Server Guide Best Practices and Backup Procedures 19

Help Desk Information If you have any issues, please contact the Constellation HomeBuilder Systems Help Desk. Hours: (Eastern Standard Time): Monday through Thursday 8:00 a.m. to 8:00 p.m. Friday 8:00 a.m. to 5:00 p.m. Telephone: 1-800-411-2020 (option 3) or locally 905-475-3485 Email: support@constellationhb.com Fax: 905-943-4338 Microsoft SQL Server Guide Best Practices and Backup Procedures 20