Download Ch02

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Oracle Database wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Microsoft Access wikipedia , lookup

SQL wikipedia , lookup

Concurrency control wikipedia , lookup

PL/SQL wikipedia , lookup

Btrieve wikipedia , lookup

Database wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Functional Database Model wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Relational model wikipedia , lookup

ContactPoint wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Versant Object Database wikipedia , lookup

Microsoft SQL Server wikipedia , lookup

Clusterpoint wikipedia , lookup

Database model wikipedia , lookup

Transcript
Chapter 2
Administrating DB Engine
Database Engine
 The Database Engine is the core service for storing,
processing, and securing data.
 It provides controlled access and rapid transaction
processing to meet the requirements of the most demanding
data consuming applications.
 Use the Database Engine to create relational DBs for online
transaction processing (OLTP) or online analytical
processing data (OLAP). This includes creating tables and
DB objects such as indexes, views, and stored procedures.
 You can use SQL Server Management Studio to manage the
database objects, and SQL Server Profiler for capturing
server events.
Server Management Studio
 SQL Server Management Studio is an
integrated environment for accessing,
configuring, managing, administering, and
developing all components of SQL Server.
 It combines a broad group of graphical tools
with a number of rich script editors to
provide access to SQL Server to developers
and administrators.
Server Management Studio (2)
 Show how to start Server Management
Studio
 Show how to create a DB
 Show how to create a table
Manage Server
 To start, in Server
Management Studio,
right click on Server,
select Properties
 There are eight
property pages
(shown on the right)
•
•
•
•
•
•
•
•
General
Memory
Processors
Security
Connections
DB Settings
Advanced
Permissions
General
Memory
Processors
Security
Connections
DB Setting
Advanced
Permissions – More on Chapter 9
Getting All Settings
Select * from sys.configurations
DB Engine Folders





Databases
Security
Server Objects
Replications (Chapter 15)
Management
The Database Folder
 System Databases
•
•
•
•
master – all sys info, guard this
model – specifies what a newly created db
msdb – used by SQL Server Agent
tempdb – store temp info cleared when start
 Database Snapshots
• Read-only databases – more in Chapter 7
 User DBs
Security Folder






Logins
Server Roles
Credentials (More next)
Cryptographic Providers (Chapter 11)
Audits (Chapter 17)
Server Audit Specifications (Chapter 17)
Security Folder—Credentials
 A credential is a record that contains the authentication
information, mostly Windows user name and password,
required to connect to a resource outside of SQL Server.
 When the external resource is Windows, the user is
authenticated as the Windows user specified in the
credential. A single credential can be mapped to multiple
SQL Server logins. However, a SQL Server login can be
mapped to only one credential.
Server Objects
 Backup Devices
 Endpoints (Chapter 13)
• Is used to manage security
• Example of endpoints are DB mirroring, service broker,
SOAP, etc
 Linked Servers
• Used to access databases on a different server or
instance
 Triggers
• A list of all triggers – a table or view level object
Replications
 Replication is a set of technologies for
copying and distributing data and database
objects from one database to another and
then synchronizing between databases to
maintain consistency.
 Using replication, you can distribute data to
different locations and to remote or mobile
users as long as they are connected.
 More later
Management Folder





Policy Management (Chapter 10)
Data Collections (Chapter 17)
Resource Governor (Chapter 16)
Maintenance Plans (Chapter 6)
SQL Server Logs
• Can have up to 99 archived logs
 Database Mail
 Distributed Transaction Coordinator
 Legacy
Administrating DB Properties
 Selections are
•
•
•
•
•
•
•
General
Files
Filegroups
Options
Change Tracking
Permissions
Extended
Properties
• Mirroring
• Transaction Log
Shipping
Files
 You will always have at least two files:
• One for data – can have many
 The first one has the extension .mdf, then .ndf
• One for log – can have many
 All have the extension .ldf
Files
 Use Filegroups to manage data storage (more
later)
 Should use RAID 10 for both according to book
 Should use RAID 1 for log, RAID 5 or 10 for data
(Jie)
 Autogrowth – easy to manage, may cause
performance issues
 FILESTREAM data – files can be access by both
DBMS and the file system (more later)
DISK
 See DISK PPS
Filegroups
More on Filegroups
 A filegroup is a logical structure that lets DBAs group data
files and manage them as a logical unit
 The Advantages of filegroups
• A filegroup is a logical grouping of data files
• Let’s you place database objects into a specific group of data files
• Allows you to backup only one filegroup at a time
 Useful for backing up VLDBs
• Can be marked as read-only or write only
 Speeds up access to archive data
 The Disadvantages of filegroups
• More work
• May not improve performance if you already using RAID 5
Even More On Filegroup
 There are two types of filegroups: primary and
user-defined.
 Each database can have a maximum of 32766
filegroups. SQL Server 2008 always contains at
least one filegroup, the primary file group.
 Only one filegroups is the default.
 A filegroup can consist of multiple data files
spread across multiple drives.
 Transaction log files cannot be part of a filegroup.
One More
 The primary filegroup contains the primary data
file including system tables. When you create
secondary data files within a database, they are
placed in the default filegroup, unless told
differently.
 When you create database objects (such as tables
and indexes) and add data to these objects, SQL
Server 2008 uses the space within each of the
data files within the filegroup proportionally, rather
than allocating space from and writing data to one
data file until it is full before writing to the next data
file.
File Groups
 This proportional fill method allows a
database to be created that spans across
multiple disks, with associated performance
benefits.
 For example, if your SQL Server 2005
system has four disks, you could use one
disk for the transaction log and the
remaining three disks for the data files (one
per disk).
File Groups
 Rather than placing all secondary data files in a single filegroup, you
can create user-defined filegroups to host secondary data files.
 On a system with multiple filegroups, you can specify the filegroup into
which a newly created database object will be placed. This can have
performance benefits, but also requires more administrative overhead
and performance tuning expertise.
 At creation, a database object is placed in the default filegroup if no
filegroup is specified. The default filegroup is the primary filegroup until
the default is changed using the ALTER DATABASE Transact-SQL
statement.
Filegroup Considerations
 The first (or primary) data file must reside on the primary
filegroup.
 All system files must be placed on the primary filegroup.
 A file cannot be a member of more than one filegroup at
a time.
 Filegroups can be allocated indexes, tables, text, ntext,
and image data.
 New data pages are not automatically allocated to userdefined filegroups if the primary filegroup runs out of
space.
 If you place tables in one filegroup and their
corresponding indexes in a different filegroup, the two file
groups must be backed up as a single unit—they cannot
be backed up separately.
© Wiley Inc. 2006. All Rights Reserved.
DB-Options
 There are a large
number of them, we
will just pick a few
• Collation
• Recovery model
 Full
 Simple
 Bulk-Logged
• Compatibility level
• Many options
Recovery Model
Recover
y model
Description
Work loss
exposure
Recover to point in
time?
Simple
•No log backups
Since the last
•Automatically reclaims log space backup
•eliminating the need to manage
the transaction log space.
Last backup
Full
•Requires log backups.
•No work is lost due to a lost or
damaged data file.
•Can recover to an arbitrary point
in time (for example, prior to
application or user error).
Normally none.
If the tail of the
log is damaged,
changes since
the most recent
log backup must
be redone.
Can recover to a
specific point in time,
assuming that your
backups are complete
up to that point in time
Bulk
logged
•Requires log backups.
•permits high-performance bulk
copy operations.
•Reduces log space usage by
bulk logging most bulk
operations.
Any backup
Can recover to the
end of any backup.
Point-in-time recovery
is not supported.
Change Tracking
 New feature
Permissions
 Second look
Properties Extended Permissions
 User defined properties and values for
database objects. – Skip
Mirroring
 Create a
duplicate copy
• Support fault
tolerance and
auto failover
 More on
Chapter 13
Transaction Log Shipping
 A way of
replication and
fault tolerence
 Does not
support auto
failover
More and more
 A few more items
•
•
•
•
•
•
•
•
•
•
•
Reports
Detaching and attaching databases
Scripting a DB or a DB object
Backing up and restore
Import/Export database
Taking a DB offline
Shrinking a DB
Compress data – do not do it unless is it absolutely necessary
Horizontally partitioning of tables and indexes
Enable FILESTREAM data
Yes, you can rename a database
Standard reports - Instance
Standard reports -- database
Detach
 For the purpose of parking the database
Attach a DB
 Database 
Attach
• Then select the
mdf file of the
database
 Another way of
moving/copying
a database
SQL Agent
 Make sure it is start – it does not auto start
when needed
• Jobs – an job for a scheduled run
• Alerts – sending alert messages more in
chapter 17
• Proxies – manage of credentials
• Error Logs
Operator
 A person