Activant Prophet 21 - erpcustomer.epicor.com

66
Activant Prophet 21 SQL Server Management SQL Server Administration suite Class 3 of 4

Transcript of Activant Prophet 21 - erpcustomer.epicor.com

Page 1: Activant Prophet 21 - erpcustomer.epicor.com

Activant Prophet 21

SQL Server Management

SQL Server Administration suite Class 3 of 4

Page 2: Activant Prophet 21 - erpcustomer.epicor.com

This class is designed for…• Beginner SQL/Prophet 21 Users who

are responsible for SQL Administration as it relates to Prophet 21

• Completed the following classes in this suite– “Introduction to SQL Server 2000:

Installation and Implementation”– “SQL Server Data Storage”

Page 3: Activant Prophet 21 - erpcustomer.epicor.com

Objectives• Perform backups• Perform restores• Maintenance Plans• Create and maintain SQL and

Prophet 21 logins

Page 4: Activant Prophet 21 - erpcustomer.epicor.com

This course will NOT cover…

• Windows Navigation• Installation of SQL Server• SQL Server Data Storage• Data Manipulation

Page 5: Activant Prophet 21 - erpcustomer.epicor.com

Implementing an Maintenance Plan

• Benefits– Protection– Data Integrity– Guards against system failures

Page 6: Activant Prophet 21 - erpcustomer.epicor.com

Implementing an Maintenance Plan

• Typical Tasks– Regular and frequent backups of

database and transaction log– Data Consistency checking– Index Rebuilding

Page 7: Activant Prophet 21 - erpcustomer.epicor.com

Implementing an Maintenance Plan

• Accomplished through– SQL Enterprise Manager– Transact-SQL statements

Page 8: Activant Prophet 21 - erpcustomer.epicor.com

Regular and Frequent Backups• Databases are typically large• Backup entire database when all

users are off the system– Time consuming– Maintain data integrity

• Utilize the transaction log– Backup changes since last backup– Saves time

Page 9: Activant Prophet 21 - erpcustomer.epicor.com

Differential Backups• Database backup• Backs up changes since last full

database backup• Must already have a full database

backup

Page 10: Activant Prophet 21 - erpcustomer.epicor.com

Backup StrategySun Mon Tues Wed Thurs Fri SatFull

database

backup

Transaction Log backs up every hour.Transaction Log backs up every hour.

FAILURE - PM

Downtime = 9 hours

FAILURE - PM

Downtime = 9 hours

Production database = 50GB

Max performance 4 AM to 2 AM weekdays

Full database backup takes 5 hours

Page 11: Activant Prophet 21 - erpcustomer.epicor.com

Backup Strategy with DifferentialSun Mon Tues Wed Thurs Fri SatFull

database backup

Transaction Log backs up every hour.Transaction Log backs up every hour.

FAILURE - PM

Downtime = 6 ½ hours

FAILURE - PM

Downtime = 6 ½ hours

Differential backups every night.Differential backups every night.

Production database = 50GB

Max performance 4 AM to 2 AM weekdays

Full database backup takes 5 hours

Page 12: Activant Prophet 21 - erpcustomer.epicor.com

Performing Backups• Expand Database• Right-click• Choose All Tasks• Backup Database

Page 13: Activant Prophet 21 - erpcustomer.epicor.com

General

Page 14: Activant Prophet 21 - erpcustomer.epicor.com

Backup Destination

Page 15: Activant Prophet 21 - erpcustomer.epicor.com

Backup Device

Page 16: Activant Prophet 21 - erpcustomer.epicor.com

New Device

Page 17: Activant Prophet 21 - erpcustomer.epicor.com

Performing Backups - General

Page 18: Activant Prophet 21 - erpcustomer.epicor.com

Performing Backups - Options

Page 19: Activant Prophet 21 - erpcustomer.epicor.com

Backup Commands• Backing up a Database

– BACKUP DATABASE {database name}TO {backup device name}WITH {(DIFFERENTIAL) | (options)}

• Backing up a Transaction Log– BACKUP LOG {database name}

TO {backup device name}WITH {options}

Page 20: Activant Prophet 21 - erpcustomer.epicor.com

Restore

Page 21: Activant Prophet 21 - erpcustomer.epicor.com

Restore

Page 22: Activant Prophet 21 - erpcustomer.epicor.com

Restore Commands• Restoring a Full or Differential Database

Backup– RESTORE DATABASE {database name}

TO {backup device name}WITH {options}

• Restoring a Transaction Log Backup– RESTORE LOG {database name}

TO {backup device name}WITH {options}

Page 23: Activant Prophet 21 - erpcustomer.epicor.com

Backup Verification• RESTORE VERIFY ONLY FROM

<backup device>• Verifies that all files in the backup set

are complete and readable– Bad track– Bad tape– Bad sector on a disk

• Does NOT verify the structure of the data

Page 24: Activant Prophet 21 - erpcustomer.epicor.com

Database Maintenance Wizard

• Setup ALL administrative actions

• Creates scheduled jobs for you

Page 25: Activant Prophet 21 - erpcustomer.epicor.com

Data Consistency Checking (DBCC)• Corrupt data in database = Corrupt

data in backup• Must be run from Query Analyzer• Off Hours is best to run• 3 Commands

– DBCC CHECKDB– DBCC CHECKALLOC– DBCC CHECKCATALOG

Page 26: Activant Prophet 21 - erpcustomer.epicor.com

Data Consistency Checking (DBCC)• DBCC CHECKDB

[(database name [,NOINDEX])]• DBCC CHECKALLOC

[(database name [,NOINDEX])]• DBCC CHECKCATALOG

[(database name)]

Page 27: Activant Prophet 21 - erpcustomer.epicor.com

Index Rebuilding• Index pages fill up to their 8k limit• New extent is allocated to insert a

pointer• Page Splitting can occur

(Index fragment)

Page 28: Activant Prophet 21 - erpcustomer.epicor.com

Index Rebuilding• DBCC DBREINDEX

(<table_name>, <index_name>,FillFactor)

• Rebuilds indexes one at a time

Page 29: Activant Prophet 21 - erpcustomer.epicor.com

Index Statistics• Updated every time a query is run• Index fragmentations are recorded in

statistics• Query Optimizer determines the most

efficient way to run a query based upon statistics

• UPDATE STATISTICS <table_name>

Page 30: Activant Prophet 21 - erpcustomer.epicor.com

Operators• Setup to tell SQL Server who is

taking care of server• How and when to notify them

Page 31: Activant Prophet 21 - erpcustomer.epicor.com

Operators

Page 32: Activant Prophet 21 - erpcustomer.epicor.com

Operators

Page 33: Activant Prophet 21 - erpcustomer.epicor.com

Operators

Page 34: Activant Prophet 21 - erpcustomer.epicor.com

New Alert – General Tab

Page 35: Activant Prophet 21 - erpcustomer.epicor.com

New Alert – Response Tab

Page 36: Activant Prophet 21 - erpcustomer.epicor.com

Scheduled Jobs• Composed of steps• Run in specified order• Break down tasks• Log each separate part

Page 37: Activant Prophet 21 - erpcustomer.epicor.com

Scheduled Jobs• Send output of any task to a log file

– Simplifies debugging• How to proceed if a task fails

Page 38: Activant Prophet 21 - erpcustomer.epicor.com

Scheduled Jobs

Page 39: Activant Prophet 21 - erpcustomer.epicor.com

Scheduled Jobs – General Tab

Page 40: Activant Prophet 21 - erpcustomer.epicor.com

Scheduled Jobs – Steps Tab

Page 41: Activant Prophet 21 - erpcustomer.epicor.com

Scheduled JobsNew Step – General Tab

Page 42: Activant Prophet 21 - erpcustomer.epicor.com

Scheduled JobsNew Step – Advanced Tab

Page 43: Activant Prophet 21 - erpcustomer.epicor.com

Scheduled Jobs – Schedules Tab

Page 44: Activant Prophet 21 - erpcustomer.epicor.com

Scheduled Jobs - New Schedule

Page 45: Activant Prophet 21 - erpcustomer.epicor.com

Scheduled Jobs – Notifications Tab

Page 46: Activant Prophet 21 - erpcustomer.epicor.com

SQL Agent Mail• SQL Server has access to a MAPI

compliant mail server• SQL Server Agent Service must be

running under a domain user account

• Domain user account must have a mail profile set up on SQL Server

• Mail client must be configured on SQL Server

Page 47: Activant Prophet 21 - erpcustomer.epicor.com

Managing Database Loginsand Permissions

• User management• Database server logins• Database users• Database permissions• Managing logins for Prophet 21

Page 48: Activant Prophet 21 - erpcustomer.epicor.com

User Management• Two levels

– Database Server Logins• Allows users to login to the database server• Passwords are kept at server level

– Database Users• Must be user on specified database• No additional passwords are required

Page 49: Activant Prophet 21 - erpcustomer.epicor.com

User Management• Managed in two ways

– Creates server login for user– Maps this login to a database user

• Permissions are applied at the server level and database level– Statement permissions

• User performs database level operations– Proper permissions

• Access and/or modify tables

Page 50: Activant Prophet 21 - erpcustomer.epicor.com

Database Server Logins

Page 51: Activant Prophet 21 - erpcustomer.epicor.com

Add New Login

Page 52: Activant Prophet 21 - erpcustomer.epicor.com

New Login - General

Page 53: Activant Prophet 21 - erpcustomer.epicor.com

New Login – Server Roles

Page 54: Activant Prophet 21 - erpcustomer.epicor.com

New Login – Database Access

Page 55: Activant Prophet 21 - erpcustomer.epicor.com

Fixed Server RolesRole PermissionSysadmin Perform any activityDbcreator Create and alter databases

Diskadmin Manage Disk Files

Processadmin Manage SQL Server processes

Serveradmin Configure server-wide settings

Setupadmin Install replication

Securityadmin Manage and audit server logins

Page 56: Activant Prophet 21 - erpcustomer.epicor.com

Fixed Database RolesRole Permission

Public Maintain all default permissionsDb_owner Perform any database role activity Db_accessadmin Add or remove database users,

groups, and roles Db_ddladmin Add, modify, or drop database objects Db_securityadmin Assign statement and object

permissions

Page 57: Activant Prophet 21 - erpcustomer.epicor.com

Fixed Database Roles (cont’d)Role Permission

Db_backupoperator Backup and restore databases Db_datareader Read data from any table Db_datawriter Add, change, or delete from all tables Db_denydatareader Cannot read data from any table Db_denydatawriter Cannot change data in any table

Page 58: Activant Prophet 21 - erpcustomer.epicor.com

Database Permissions• Assigned using

– SQL Enterprise Manager– Transact-SQL GRANT statement

Page 59: Activant Prophet 21 - erpcustomer.epicor.com

Database PermissionsUsing SQL Statement

• Statement Permissions– GRANT {ALL | statement_list} TO

{PUBLIC | name_list}• Object Permissions

– GRANT {ALL | permission_list}ON {table_name [(column_list)] | view_name [(column_list)] |stored_procedure_name | extended_stored_procedure_name}TO {PUBLIC | name_list}

Page 60: Activant Prophet 21 - erpcustomer.epicor.com

Database PermissionsUsing SQL EnterpriseDatabase PermissionsUsing SQL Enterprise

• In the Server Manager window, right-click the database on which you want to grant permissions

• Select Properties• Click the

Permissions tab• Choose options

Page 61: Activant Prophet 21 - erpcustomer.epicor.com

Grant Object Level Permissions

• Drill down to the object on which you want to grant permissions

• Right-click the object, point to All Tasks, and then select Manage Permissions

• Grant permissions to the objects or database roles you want

Page 62: Activant Prophet 21 - erpcustomer.epicor.com

Managing Logins for Prophet 21 (CommerceCenter)

Users are created in System Setup

Page 63: Activant Prophet 21 - erpcustomer.epicor.com

Additional Administrationand Debugging Tools

SQL Server ProfilerSQL Query Analyzer

Page 64: Activant Prophet 21 - erpcustomer.epicor.com

Summary• Perform backups and restorations• Create Maintenance Plan• Create and maintain SQL and

Prophet 21 logins

Page 65: Activant Prophet 21 - erpcustomer.epicor.com

• Visit Activant on the web: distribution.activant.com–View Educational Services Training course offerings

• Microsoft SQL Server – 3 day Classroom training

–Browse Documentation

–Search the Solutions database

–Submit a Support case

• Email Professional Services Sales: [email protected]

Page 66: Activant Prophet 21 - erpcustomer.epicor.com

SQL Administration suite• Basic Data Manipulation

– Running stored procedures– Select statements