Download 데이터베이스 관리자를 위한 Microsoft SQL Server

Document related concepts

Entity–attribute–value model wikipedia , lookup

Tandem Computers wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Concurrency control wikipedia , lookup

Oracle Database wikipedia , lookup

Database wikipedia , lookup

Microsoft Access wikipedia , lookup

Ingres (database) wikipedia , lookup

Btrieve wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Team Foundation Server wikipedia , lookup

Database model wikipedia , lookup

Relational model wikipedia , lookup

Clusterpoint wikipedia , lookup

Open Database Connectivity wikipedia , lookup

SQL wikipedia , lookup

PL/SQL wikipedia , lookup

Microsoft SQL Server wikipedia , lookup

Transcript
데이터베이스 관리자를 위한
Microsoft SQL Server 2005 관리
및 유지보수 도구
이 상 옥 차장([email protected])
IT Evangelist
Developer & Platform Evangelism
(주)한국마이크로소프트
목차








설치: SQL Server 2005
SQL Server 2005 관리자 도구
모니터링: SQL Server 2005
데이터베이스 유지보수
SQL Server 2005 보안
재난복구
데이터 가용성
복제
설치: SQL Server 2005




새로운 기능
Windows Installer
SNAC 사용 (MDAC 9.0 대체)
Feature Tree
 트리 구조의 컴포넌트 설치 화면
System Configuration Checker (SCC)
 설치 준비작업 진단
 (WMI) Windows Management
Instrumentation 사용
Contd…
하드웨어 요구사항: 최소
Hardware
32 Bit SQL Server 2005
Computer
Intel or compatible Pentium 600 MHz or higher processor
minimum; 1 GHz or higher recommended
Memory (RAM)
256 MB minimum; 512 MB or more recommended
Hard disk space
SQL Server database components: 95 to 300 MB, 250 MB
typical
Analysis Services: 50 MB minimum, 130 MB typical
Reporting Services: 50 MB minimum for Report Server, 30
MB for Report Designer
Hardware
64 Bit SQL Server 2005
Computer
Intel Itanium 2, AMD's Opteron, Intel Xeon EM64T
Memory (RAM)
1 GB minimum
SQL Server Editions (32 Bit)





Standard Edition
 클러스터링 지원 안됨, indexed views, etc.
 16 인스턴스 (라이센스 필요)
Enterprise Edition
 모든 기능 지원, 대용량 데이터베이스 용
 50 인스턴스 (추가 라이센스 없음)
Developer Edition
 개발자용으로 모든 기능제공하며 테스트 및 개발용도로 사용
Express Edition
 무상 배포용으로 클라이언트, 간단한 작업용으로 사용
Mobile Edition
 Smart Devices에 설치
 메인 데이터베이스와 복제 및 동기화 지원
SQL Server Editions (64 Bit)

SQL Server 2005 Enterprise Edition (64-bit)
 모든 기능 지원, 대용량 및 고성능 데이터센터에
사용

SQL Server 2005 Developer Edition (64-bit)
 모든 기능 지원, 개발자 용으로 테스트 및 개발에
사용
SQL Server 2005 관리자 도구




SQL Server Management Studio
SQL Computer Manager
sqlcmd 도구
SQL Management Objects
What Is SQL Server Management Studio?
Integrated management and
development environment
Based on Visual Studio .NET
Incorporates functionality of
Enterprise Manager, Query
Analyzer, and Analysis
Manager in previous
releases
Used to manage relational
databases, Analysis
Services, Reporting Services,
and
SQL Server CE databases
Includes tools for creating
Transact-SQL, XMLA, MDX,
and XQuery scripts
How to Register a Server
1
Open Registered Servers window
2
Provide SQL Server instance details
3
Test the registered server
4
Verify that the server appears under Registered
Servers
What Is Object Explorer?
Window for browsing
and managing objects
Object Explorer folders
Object Explorer button
s
How to Execute Transact-SQL Queries
1
Click New SQL Server Query
2
Type a Transact-SQL statement
3
Click Execute and connect to SQL Server
4
Browse the results
What Is a SQL Server Management Studio
Solution?
Collection of connections and queries
Project templates
How to Create a SQL Server
Management Studio Solution
1
Click File, New, Project
2
Select the SQL Server Scripts template
3
Add a connection
4
Set the connection properties
5
Create a new query
6
Set the query properties
7
Type the Transact-SQL statements
8
Save the project
What Is SQL Computer Manager?
Console snap-in for managing SQL Server ser
vices and connectivity
Icons:
 Services
 Server Network
Configuration
 Client Network
Configuration
What Is the sqlcmd Utility?
Command-line tool for executing Transact-SQL
statements and scripts
 Uses OLE DB to run Transact-SQL batches
 Replaces osql
Enhancements over osql
 Variables
 Query server information
 Passes error information to calling environm
ent
 Dedicated Administrator Connection
 Commands
How to Use the sqlcmd Utility
Interactively
1
Open a command prompt window
2
Execute sqlcmd
3
Type Transact-SQL statements and sqlcmd commands
4
Type GO
5
Type QUIT to close sqlcmd
How to Use the sqlcmd Utility
Interactively
1
Open a command prompt window
2
Execute sqlcmd
3
Type Transact-SQL statements and sqlcmd commands
4
Type GO
5
Type QUIT to close sqlcmd
How to Use the sqlcmd Utility
Interactively
1
Open a command prompt window
2
Execute sqlcmd
3
Type Transact-SQL statements and sqlcmd commands
4
Type GO
5
Type QUIT to close sqlcmd
모니터링: SQL Server 2005




SQL Profiler
DDL Triggers
Event Notifications
Metadata Views
SQL Profiler Enhancements in SQL
Server 2005
Profiling Analysis Services
Tracing Showplan and deadlock events
Saving results as XML
Aggregating data
How to Save a Trace as XML
Create and execute a trace
File menu, Save As, Trace XML File
Specify name and location for file
Lesson: Using DDL Triggers
What Are DDL Triggers?
How to Create DDL Triggers
How to Manage DDL Triggers
Demonstration: Creating a DDL Trigger
What Are DDL Triggers?
Triggers to trap DDL statement execution
Database or server scope
Process:
1 DDL statement executed
UPDATE STATISTICS someTable
2 DDL action performed
3 Trigger fires
EventData
What Are Event Notifications?
Trap SQL Server events, including
 DDL events
 DML events
 Trace events
Use Service Broker architecture to transmit eve
nts to
a service
 A message type and contract are predefine
d
 Create a queue, a service, and a route
Querying Static Metadata
Provide information about database objects, for
example:
 Database files
 Tables
 Indexes
In <Database name>\Views\System Views fol
der
Directly
query the system metadata
USE AdventureWorks
SELECT * FROM sys.tables
Querying Dynamic Metadata
Provide information about the current state of a
server, for example:
 Locks held
 Threads
 Memory usage
In <Database name>\Views\System Views fol
der
Directly query the system metadata
SELECT * FROM sys.db_tran_locks
데이터베이스 유지보수


Managing Indexes
Database Tuning Advisor
New Index Features in SQL Server 2005
ALTER INDEX statement
Online index operations
ALTER
INDEX
…
Parallel
index
operations
REBUILD …
SELECT * FROM MyTable
Locking options
Indexes with included columns
Partitioned indexes
SELECT column::query(…)
FROM …
XML indexes
CREATE INDEX …
CREATE INDEX
…
ALLOW_PAGE_LOCKS
=
ON
ON MyTable(…) WITH (MAXDOP=3)
WITH (ONLINE = ON)
ALLOW_ROW_LOCKS
= ON
XML
Index
XML Column
What Is the Database Tuning Advisor?
Workload
.trc file
.sql script
Table
DTA
Databases
Results
How to Use the Database Tuning Advisor
1
Create a new session
2
Specify the workload
3
Set tuning options
4
Perform the analysis
5
Examine the results
6
Implement the recommendations
SQL Server 2005 보안




SQL Server 2005 Security Overview
Managing SQL Server 2005 Security
Managing Permissions
Managing Certificates
Security Enhancements in SQL Server
2005
Password policy for SQL Server logins
Hierarchical security scopes
Separation of user and schema
Limited metadata visibility
Declarative execution context
What Are Principals?
Securables
Permissions
Principals
Windows
Windows Group
Domain User Account
Local User Account
SQL Server Login
Server Role
SQL Server
Database
User
Database Role
Application Role
Group
What Are Securables?
Securables
Permissions
Principals
Windows
Windows Group
Domain User Account
Local User Account
SQL Server Login
Server Role
SQL Server
Database
Files
Registry Keys
Server
Database
User
Database Role
Application Role
Group
Schema
What Are Permissions?
Securables
Permissions
Principals
Windows
Windows Group
Domain User Account
Local User Account
ACL
Files
Registry Keys
GRANT/REVOKE/DENY
SQL Server Login
Server Role
SQL Server
Database
User
Database Role
Application Role
Group
CREATE
ALTER
DROP
CONTROL
CONNECT
SELECT
EXECUTE
UPDATE
DELETE
INSERT
TAKE OWNERSHIP
VIEW DEFINITION
BACKUP
Server
Database
Schema
What Are Schemas?
Namespaces for database objects
dbo
Products
(Server1.AdventureWorks.dbo.Products)
SalesData
Orders
(Server1.AdventureWorks.SalesData.Orders)
Understanding Permissions
Assign permissions using:
 Object Explorer in SQL Server Management
Studio
 Transact-SQL
GRANT
REVOKE
DENY
Can perform action if:
 Permission granted to the principal or a coll
ection containing principal
- AND -
 Permission not denied to the principal or a c
ollection containing principal
How to Manage Server Permissions
In Object Explorer
1
Connect to server
2
Right-click login and click Properties
3
Permissions page, click Add Objects
4
Add the server <servername>
5
Assign permissions
USE master
GRANT ALTER ANY DATABASE TO [SERVERX\Bill]
What Are Certificates?
Digitally signed document containing a public/p
rivate key pair
Obtained from:
 Certificate authority
 Certificate server
Used for:
 Authentication – a message signed by the pr
ivate key is guaranteed to be sent by the ow
ner of the certificate
 Encryption – a message encrypted with a pu
blic key can only be decrypted with the matc
hing private key, and vice versa
How to Manage Certificates
Creating certificates
CREATE CERTIFICATE AWCert
WITH SUBJECT = 'CertificateForAdventureWorks'
, ENCRYPTION_PASSWORD = 'P@ssw0rd'
Exporting certificates
DUMP CERTIFICATE AWCert TO FILE = 'C:\MyCert.cer'
Deleting certificates
DROP CERTIFICATE AWCert
재난복구



Disaster Recovery in SQL Server 2005
Using Database Snapshots
Backup and Restore Operations
Disaster Recovery in SQL Server 2005
Database snapshots
Online restore operations
Backup media mirroring
Improved verification
Checksum
12345678
Checksum
12345678
12:00 Snapshot
Checksum
12345678
What Are Database Snapshots?
Read-only, consistent vie
w of a database
Page
 Specified point-in-tim
e
Modifying data
 Copy-on-write of affe
cted pages
Reading data
Page
 Accesses snapshot if
data has changed
 Redirected to original
database otherwise
12:00 Snapshot
How to Use a Database Snapshot to
Recover Data
Scenari
o
Example Code / Steps
Undeletin
g
rows
INSERT INTO Production.WorkOrderRouting
SELECT * FROM
AdventureWorks_dbsnapshot_1800.Prod.WorkOrderRouting
Undoing
an
update
UPDATE HR.Department
SET Name = ( SELECT Name FROM
AdventureWorks_dbsnapshot_1800.HR.Department
WHERE DepartmentID = 1)
WHERE DepartmentID = 1
Recoveri
ng
a
dropped
object
1 Script the object in the database snapshot
2 Execute the script in the source database
3 Repopulate the object (if appropriate)
Caution: Not a substitute for a comprehensive backup and restore strategy
How to Perform an Online Restore
Only in Enterprise Editions
Only for full or bulk-logged recovery models
By default, restoring a file or a page is automati
cally an online restore
 Filegroup offline when any file within it is be
ing restored
 Database offline during restore of any files i
n the primary filegroup
How to Recover the master Database
If SQL Server instance is accessible
1 Start SQL Server in single-user mode
2 Restore your latest backup of the master d
3 atabase
Restart the server
If1 SQL Server instance is not accessible
2 Rebuild master database using Setup.exe
3 Restore master database
Restore msdb and model databases
데이터베이스 가용성


Introduction to Data Availability
Introduction to Database Mirroring
Introduction to Data Availability
Attribute
Clustering
Database
mirroring
Log shipping
Failure
detection
Yes
No
No
Automatic
failover
Yes
No
Yes
Perceived d
owntime
30 seconds + rec
overy
N/A
3 seconds
Potential da
ta loss
Yes – one copy o
f data
Yes – latest tran Yes – in some con
saction log
figurations
Masking of
storage failu No – shared disk
re
Yes
Yes
Special hard Certified storage
ware
and servers
No
No
Distance
100 miles
Unlimited
Unlimited
Scope
System and user
databases
User databases
User databases
What Is Database Mirroring?
Update
Update
Principal Database
Client
Mirror Database
Server Roles in Database Mirroring
Principal
server
Mirror
server
Witness
server
Server holding the principal database
Users connect to this server
Server holding the mirror database
Users connect to this server only after failover
Monitors connectivity between partners and
initiates automatic failover
Mirror Sessions
Mirror server requests transaction log
On initiation records—synchronization
During the Principal server transmits log records as
transactions occur
session
Termination
Communications or server failure
Database administrator
Database Mirroring Configurations
Scenarios
Synchronous with witness server
Asynchronous with witness server
Synchronous without witness server
Principal failure
Automaticunavailable
Database
failover – mirror
– force
becomes
service principal
to mirror
Original principal recovered
recovered,–becomes
resume session
new mirror
Mirror failure
Principal continues
Database
unavailable
Session mirror
Original
in suspended
recovered
state
– automatically available
복제



Overview of Replication Enhancements
New Types of Replication
Configuring Replication
User Interface Enhancements
Replication wizards
 40% fewer pages
 Improved default values and auto-detection
 Less branching
New Subscription Wizard
 Replaces the Push Subscription Wizard and
Pull Subscription Wizard
 Allows you to define multiple subscriptions
with different properties at the same time
Replication Management
Initializing a subscriber
 Backup and restore
 Copying a database
 Dynamic snapshots
Resuming snapshot transfers
Replicating DDL statements
Allowing anonymous subscriptions for all
publications
Performance and Scalability
Precomputed partitions
Updates to unique keys
Transactional parallelism — independent agent
option used by default
Download only articles — to reduce change trac
king metadata
Reduced contention on reporting subscribers
 Use snapshot isolation level
 Use snapshots
Replication Monitor
Independent from SQL Server Workbench — pa
ssive monitoring
Define acceptable performance figures
Minimize monitoring impact
Merge replication
 Article level statistics
 Upload and download statistics
Transactional replication — real-time monitorin
g with tracer tokens
Other Enhancements
Merge replication concurrency enhancements —
guaranteed delivery of logical records
Programming changes — release of RMO
Replication of more types of objects
 .NET UDTs
 Assemblies
Heterogeneous Replication
Use Oracle v8 and later databases as the publisher
in a replication system
Snapshot replication — no impact on Oracle
database
Transactional replication
 Triggers and tracking tables added to Oracle
database
 Log Reader Agent transfers changes to SQL
Server Distributor and Distribution Agent
transfers changes to subscribers
Potential issues because of:
 Differences between SQL Server and Oracle
 Use of Oracle tools
Peer-to-Peer Transactional Replication
London
Distribution
Agent
Sydney
Log Reader
Agent
Distribution
Agent
New York
Distribution
Agent
Log Reader
Agent
Log Reader
Agent
HTTP Replication
XML over HTTP/HTTPS
Subscriber
Firewall
Binary over TCP/IP
IIS
https://Repl.AdventureWorks.com
Publisher
How to Configure Replication Using RMO
1 Reference the SMO and RMO libraries
Microsoft.SqlServer.ConnectionInfo
Microsoft.SqlServer.Replication
2 Import the SMO and RMO namespaces
3 Connect to the replications server(s)
4 Perform replication tasks
Create publications
Create subscriptions
Dim subCon
Imports
Microsoft.SqlServer.Management.Common
As ServerConnection
Imports=Microsoft.SqlServer.Replication
subCon
New ServerConnection("MySubscriber")
subCon.Connect()
세션 요약


설치
 32비트, 64비트
SQL Server 2005 관리자 도구








통합 관리도구
VS.NET 연동
모니터링: Profiler, DDL,이벤트
데이터베이스 유지보수 – 인덱스, 튜닝
보안 - 데이터, 서비스
재난복구 - 스냅샷
데이터 가용성 - 미러링
복제 – P2P, HTTP 방식
참고 자료

웹 문서:
 An Overview of SQL Server 2005 Beta 2 for the Database
Administrator
http://www.microsoft.com/technet/prodtechnol/sql/2005/maintain/sqlyd
ba.mspx

Improving Performance with SQL Server 2005 Indexed
Views
http://www.microsoft.com/technet/prodtechnol/sql/2005/ipsql05iv.mspx

Beta 2 Demo:
http://www.microsoft.com/sql/2005/productinfo/demos/default.asp
추천서적: Microsoft Press
IT 전문가를 위한 고급 정보
최신 기술서적에 대한 정보는 여기서 참조하세요.
www.microsoft.com/learning/books/
추천서적:
IT 전문가를 위한 참고서적
이 서적은 국내 대형서점 또는 온라인 서점에서 판매됩니다.
Microsoft 교육센터
IT 전문가를 위한 교육정보
코스
제목
기간
2733
Updating Your Database Administration
Skills to Microsoft SQL Server 2005
3일
2734
Updating Your Database Development
Skill to Microsoft SQL Server 2005
3일
자세한 교육정보는 Microsoft 공식 교육기관 또는 인터넷에서 통해서
얻을 수 있습니다.
www.microsoft.com/learning