Download as pdf or txt
Download as pdf or txt
You are on page 1of 66

Activant Prophet 21

SQL Server Management

SQL Server Administration suite Class 3 of 4


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”
Objectives
• Perform backups
• Perform restores
• Maintenance Plans
• Create and maintain SQL and
Prophet 21 logins
This course will NOT cover…

• Windows Navigation
• Installation of SQL Server
• SQL Server Data Storage
• Data Manipulation
Implementing an Maintenance Plan
• Benefits
– Protection
– Data Integrity
– Guards against system failures
Implementing an Maintenance Plan
• Typical Tasks
– Regular and frequent backups of
database and transaction log
– Data Consistency checking
– Index Rebuilding
Implementing an Maintenance Plan
• Accomplished through
– SQL Enterprise Manager
– Transact-SQL statements
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
Differential Backups
• Database backup
• Backs up changes since last full
database backup
• Must already have a full database
backup
Backup Strategy
Sun Mon Tues Wed Thurs Fri Sat
Full
databas Transaction
TransactionLog
Logbacks
backsup
upevery
everyhour.
hour.
e
FAILURE
FAILURE--PM
PM
backup
Downtime
Downtime==99
hours
hours

Production database = 50GB


Max performance 4 AM to 2 AM weekdays
Full database backup takes 5 hours
Backup Strategy with Differential
Sun Mon Tues Wed Thurs Fri Sat
Full
database Transaction
TransactionLog
Logbacks
backsup
upevery
everyhour.
hour.
backup
FAILURE
FAILURE--PM
PM
Downtime
Downtime==66
½
½hours
hours
Differential
Differentialbackups
backupsevery
everynight.
night.
Production database = 50GB
Max performance 4 AM to 2 AM weekdays
Full database backup takes 5 hours
Performing Backups
• Expand Database
• Right-click
• Choose All Tasks
• Backup Database
General
Backup Destination
Backup Device
New Device
Performing Backups - General
Performing Backups - Options
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}
Restore
Restore
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}
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
Database Maintenance Wizard

• Setup ALL
administrative
actions
• Creates
scheduled jobs
for you
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
Data Consistency Checking (DBCC)
• DBCC CHECKDB
[(database name [,NOINDEX])]
• DBCC CHECKALLOC
[(database name [,NOINDEX])]
• DBCC CHECKCATALOG
[(database name)]
Index Rebuilding
• Index pages fill up to their 8k limit
• New extent is allocated to insert a
pointer
• Page Splitting can occur
(Index fragment)
Index Rebuilding
• DBCC DBREINDEX
(<table_name>, <index_name>,
FillFactor)
• Rebuilds indexes one at a time
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>
Operators
• Setup to tell SQL Server who is
taking care of server
• How and when to notify them
Operators
Operators
Operators
New Alert – General Tab
New Alert – Response Tab
Scheduled Jobs
• Composed of steps
• Run in specified order
• Break down tasks
• Log each separate part
Scheduled Jobs
• Send output of any task to a log file
– Simplifies debugging
• How to proceed if a task fails
Scheduled Jobs
Scheduled Jobs – General Tab
Scheduled Jobs – Steps Tab
Scheduled Jobs
New Step – General Tab
Scheduled Jobs
New Step – Advanced Tab
Scheduled Jobs – Schedules Tab
Scheduled Jobs - New Schedule
Scheduled Jobs – Notifications Tab
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
Managing Database Logins
and Permissions
• User management
• Database server logins
• Database users
• Database permissions
• Managing logins for Prophet 21
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
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
Database Server Logins
Add New Login
New Login - General
New Login – Server Roles
New Login – Database Access
Fixed Server Roles
Role Permission
Sysadmin Perform any activity
Dbcreator 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
Fixed Database Roles
Role Permission
Public Maintain all default permissions
Db_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
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
Database Permissions
• Assigned using
– SQL Enterprise Manager
– Transact-SQL GRANT statement
Database Permissions
Using 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}
Database Permissions
Using 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
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
Managing Logins for Prophet
21 (CommerceCenter)
Users are created in System Setup
Additional Administration
and Debugging Tools
SQL Server Profiler
SQL Query Analyzer
Summary
• Perform backups and restorations
• Create Maintenance Plan
• Create and maintain SQL and
Prophet 21 logins
• 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: pss@p21.com
SQL Administration suite
• Basic Data Manipulation
– Running stored procedures
– Select statements

You might also like