• No results found

SQL Database Administration. Overview

N/A
N/A
Protected

Academic year: 2021

Share "SQL Database Administration. Overview"

Copied!
12
0
0

Loading.... (view fulltext now)

Full text

(1)

SQL Database Administration

SQL Database Administration ...1

Backing Up Your Data...2

Controlling Database Growth...7

Maintaining Optimum Performance...10

Automatic Updates for Windows...12

Overview

This document is designed to guide the person responsible for the administration of the Linko database. More specifically this document is concerned with areas such as backups, preventative maintenance settings and performance enhancements. The operations and procedures described in this document should only be done when no one is in Linko.

(2)

Backing Up Your Data

Linko recommends that you back up your database often: daily, if possible. SQL Express doesn’t have job scheduling capability so database backups are a manual operation.

For System Administrators familiar with MS Full Version of SQL Server, you are already familiar with database backups. You can use the same backup processes and procedures with SQL Express databases. See the following procedure.

SQL Express 2008 has new functionality in it that makes backing up the database

a lot simpler than in the past.

As long as no one is using the software, you can simply copy the database files to a secure location.

The location of the databases (based upon a Typical Installation) are the following folders on the Database Service Computer:

C:\LinkoCTS\SQLData You want to copy both of these files: CTS_Data_data.mdf CTS_Data_log.ldf

Set up a copy in a scheduled task for whenever everyone is out of Linko. Then your

databases will be backed up automatically everyday.

We include the following procedure as an alternative way to do backups. It requires manual use of the SQL Management Studio and can not be automated in SQL Express 2008 as it does not include SQL Agent.

1. Open SQL Management Studio and connect to the Linko database (CTS_Data).

(3)
(4)

3. The Database Back Up dialog. Backup type should be Full.

You may also want to change the default location of where the backup file will be located. In the Destination section click the Remove button. This will remove the default path line specified in the box. Click the Add button.

(5)

After clicking the Add button you will be presented with the dialog box below. Click the browse button to navigate to another location.

(6)

4. Backup Options screen.

Linko recommends that the Verify backup when finished option is checked.

Click OK when you’re ready to start the backup operation. When finished you’ll be presented with the message box below.

FOR USERS OF THE LINKO SQL EXPRESS EDITION:

Note that the above procedures is a backup of the Linko Database but it still resides on the Hard Drive where the Database Service is installed (Assuming a Typical Installation). The file needs to be moved to a network location for secure storage.

The entire folder C:\LinkoCTS on the computer where the Database Service resides needs to be backed up to a network location on a regular basis. The above backup process only addresses the database itself, and none of the support files in the Shared Folders.

(7)

Controlling Database Growth

Linko recommends the following settings for both the SQL Express and the Full SQL Versions.

These settings are defaulted to the values listed so there’s no need to change any of them unless they’re different.

Database Properties – Options page

Right-click on CTS_Data and then click Properties

Automatic

Auto-close False

Auto-create statistics True Auto-shrink False Auto-update statistics True

Statistics

Query statistics are managed automatically by SQL Server when auto-create statistics and auto-update statistics are set to Yes. This is recommended.

Recovery

Page Verify Torn page detection File Size/Growth:

• CTS_Data_Data:

o Initial Size: 50 MB o Automatically grow file o By 10%

o 1 gig max file growth

• CTS_Data_Log: (if Full recovery model implemented) o Initial Size: 10 MB

o Automatically grow file o By 20%

(8)

Recovery Model:

Simple (recommended, with nightly scheduled backups) Full (Optional)

Optional – Full Recovery Model

If you choose to implement the Full Recovery model, Linko recommends…

• Incremental transaction log backups should be performed at least twice daily (11:00am and 2:00pm)

• After performing your nightly Full database backup, perform a Full transaction log backup. (SQL will automatically truncate the transaction log after the log is backed up. It will not reduce the size of the physical log)

• After a complete database backup is performed, the transaction log backup series can be restarted. (It is not necessary to keep the transaction log backups created prior to the last full database backup.)

• Never manually truncate a log file until the log file has been backed up. • To reduce the physical size of the CTS_Data_log file, use DBCC SHRINKFILE

• DBCC SHRINKFILE (cts_data_log) • GO

(9)

Server Properties – Security page

Right-click on the top level of the Hierarchy which is the ServerName\SQL Instance and then click Properties.

(10)

Maintaining Optimum Performance

Rebuilding Indexes and Shrinking data files

Indexes should periodically be rebuilt to reorganize pages, remove physical

fragmentation and recalculate statistics. Shrinking the database improves performance. Linko recommends doing this monthly. Use the script below to rebuild indexes and shrink the data files. As with all the procedures outlined in this document this procedure should only be done while no one is in Linko.

USE CTS_Data

DECLARE @TableName varchar(255) DECLARE TableCursor CURSOR FOR

SELECT table_name FROM information_schema.tables WHERE table_type = 'base table'

OPEN TableCursor

FETCH NEXT FROM TableCursor INTO @TableName WHILE @@FETCH_STATUS = 0

BEGIN

DBCC DBREINDEX(@TableName,' ',0)

FETCH NEXT FROM TableCursor INTO @TableName END

CLOSE TableCursor

DEALLOCATE TableCursor GO

DBCC SHRINKDATABASE (CTS_Data, 10) GO

Notes on Indexes:

1. As a possible additional maintenance step, Linko suggests that Indexes should occasionally be rebuilt (monthly) using DROP_EXISTING and FILLFACTOR with

recommended fill factors to reorganize pages, remove physical fragmentation and recalculate statistics. Linko has a specially designed script to do this for each Linko Upgrade called the CTS_Data_Rebuild_Indexes.sql script.

2. FILLFACTOR will reduce page splitting and allocate additional space to tables that frequently have new data added to them.

3. Only run the CTS_Data_Rebuild_Indexes.sql script for the proper version of the CTS_Data database you have installed. Please contact Linko Support with any questions.

(11)

Click the New Query button in your Management Studio main view.

Paste the script above into the New Query window. Click the Execute button.

(12)

Automatic Updates for Windows

This setting will cause your Server to automatically download and install the latest updates from Microsoft. Linko recommends setting Automatic Updates as illustrated below.

From your desktop right-click on My Computer and click Properties.

Make sure that Automatic is checked and the time is set for an early morning hour.

References

Related documents

SVM classifiers were trained to discriminate bacterial protective antigens (BPAs) and non-BPAs in BPAD200+N+B+AF and receiver operator characteristic (ROC) curves generated from

In contrast, the wholesale market for fruits and vegetables is merely a gathering place for a number of (big) retailers and consigners. The transactions in the wholesale market

Regular copyright is available for literary works which meet the Dutch originality threshold, while the geschrift enbescherming protects non-original

Grade-appropriate elements of the science and engineering practice(s), disciplinary core idea(s), and crosscutting concept(s), work together to support students in

Madeleine’s “belief” that she is Carlotta Valdez, her death and rebirth as Judy (and then Madeleine again) and Scottie’s mental rebirth after his breakdown.. All of these

Top panel: samples from a MC simulation (gray lines), mean computed over these samples (solid blue line) and zero-order PCE coefficient from the SG (dashed red line) and ST

Recognizing spatio-temporal similarities between video sequences is a difficult task, since the objects undergo var- ious transformations or may be occulted through the se- quence.