SQL Server 2008 Advanced Admin

download SQL Server 2008 Advanced Admin

of 176

Transcript of SQL Server 2008 Advanced Admin

  • 8/13/2019 SQL Server 2008 Advanced Admin

    1/176

    please contact [email protected]

    Design by [email protected] 176

  • 8/13/2019 SQL Server 2008 Advanced Admin

    2/176

    please contact [email protected]

    Design by [email protected] 176

    Requirement and installation

  • 8/13/2019 SQL Server 2008 Advanced Admin

    3/176

    please contact [email protected]

    Design by [email protected] 176

    Requirement and license

    SQL server 2008 Editions:

    Edition DescriptionEnterprise (x86,x64,IA64) Enterprise-class scalability

    High availabilityFull Bussiness Intelligence (BI)capabilities

    Standard (x86,x64) Built-in BI capabilities for departmentalapplications.

    Small Business (x86,x64) SQL server Standard licensed for 75 orfewer computers.

    SQL server 2008 Developer(x86,x64,IA64)

    SQL server 2008 Enterpirse licensedfor development and test only .Upgradable for production use

    Workgroup (x86,x64) For running local branch locationdatabase reporting remotesynchronization

    Web (x86,x64) Low total-cost-of-ownership option forweb hosts and Web sitesExpress (SSE)(x86,x64)

    SSE with tools (x86,x64)SSE with Adv Services (x86,x64)

    SQL server Express is free and can beredistributed by ISVs (subject toagreement )

    Compact 3.5 SP1 (x86)Compact 3.1 (x86)

    SQL compact 3.5 is free , embeddeddatabase ideal for building stand-aloneand occasionally connected applications

  • 8/13/2019 SQL Server 2008 Advanced Admin

    4/176

    please contact [email protected]

    Design by [email protected] 176

    Installation SQL server Enterprise

    First your setup requirement after DVD running

    Install start

    First screen setup center

  • 8/13/2019 SQL Server 2008 Advanced Admin

    5/176

    please contact [email protected]

    Design by [email protected] 176

    Pass through setup center

    Above picture introduce planning installation

    Installation page

    Maintenance page

    Tools page

  • 8/13/2019 SQL Server 2008 Advanced Admin

    6/176

    please contact [email protected]

    Design by [email protected] 176

    Resource page

    Advanced page

    Option page

  • 8/13/2019 SQL Server 2008 Advanced Admin

    7/176

    please contact [email protected]

    Design by [email protected] 176

    Now we start install SQL server 2008 enterprise edition

    Click Installation page and then choose New SQL server stand-

    alone installation or

    Rule checking progress

    Enter product key and Next

  • 8/13/2019 SQL Server 2008 Advanced Admin

    8/176

    please contact [email protected]

    Design by [email protected] 176

    Accept license term and Next

  • 8/13/2019 SQL Server 2008 Advanced Admin

    9/176

    please contact [email protected]

    Design by [email protected] 176

    Setup support Files , Install

  • 8/13/2019 SQL Server 2008 Advanced Admin

    10/176

    please contact [email protected]

    Design by [email protected] 176

    Next step to setup Install SQL server 2008

  • 8/13/2019 SQL Server 2008 Advanced Admin

    11/176

    please contact [email protected]

    Design by [email protected] 176

    It will check your requirement of your server and your result is

    reported for completely checking, if everything is alright ,Next

  • 8/13/2019 SQL Server 2008 Advanced Admin

    12/176

    please contact [email protected]

    Design by [email protected] 176

    Select feature for stand-alone ,Next

  • 8/13/2019 SQL Server 2008 Advanced Admin

    13/176

    please contact [email protected]

    Design by [email protected] 176

    Instant configuration

  • 8/13/2019 SQL Server 2008 Advanced Admin

    14/176

    please contact [email protected]

    Design by [email protected] 176

    Disk space requirement , Next

  • 8/13/2019 SQL Server 2008 Advanced Admin

    15/176

    please contact [email protected]

    Design by [email protected] 176

    Server configuration

  • 8/13/2019 SQL Server 2008 Advanced Admin

    16/176

    please contact [email protected]

    Design by [email protected] 176

    Note : Microsoft recommended that if you are in a domain you

    should use user account in domain for service management (Your

    service : SQL server agent , SQL server Database Engine , SQL

    server Browser ). These services operating with fully option if it is in

    domain

    Tab collation in Server configuration page choose your support

    language engine

  • 8/13/2019 SQL Server 2008 Advanced Admin

    17/176

    please contact [email protected]

    Design by [email protected] 176

    Choose user account to use SQL server

    Error and Usage Reporting

  • 8/13/2019 SQL Server 2008 Advanced Admin

    18/176

    please contact [email protected]

    Design by [email protected] 176

    Installation Rules

  • 8/13/2019 SQL Server 2008 Advanced Admin

    19/176

    please contact [email protected]

    Design by [email protected] 176

    Ready to install

  • 8/13/2019 SQL Server 2008 Advanced Admin

    20/176

    please contact [email protected]

    Design by [email protected] 176

    Installation progress

  • 8/13/2019 SQL Server 2008 Advanced Admin

    21/176

    please contact [email protected]

    Design by [email protected] 176

    Complete install

  • 8/13/2019 SQL Server 2008 Advanced Admin

    22/176

    please contact [email protected]

    Design by [email protected] 176

    Start SQL server management

  • 8/13/2019 SQL Server 2008 Advanced Admin

    23/176

    please contact [email protected]

    Design by [email protected] 176

    Login screen

    You complete your installation SQL server 2008 enterprise edition

  • 8/13/2019 SQL Server 2008 Advanced Admin

    24/176

    please contact [email protected]

    Design by [email protected] 176

    Optimizing SQL searches withIndexes

  • 8/13/2019 SQL Server 2008 Advanced Admin

    25/176

    please contact [email protected]

    Design by [email protected] 176

    Indexes in SQL server 2008

    Clustered and Non Clustered Indexes

    Filtered

    XML

    Spatial

    Full-TextClustered and non Clustered Indexes

    Clustered Indexes

    Only one per table

  • 8/13/2019 SQL Server 2008 Advanced Admin

    26/176

    please contact [email protected]

    Design by [email protected] 176

    Data is ordered based on the key fields

    Provides excellent searching ability

    Required by some other indexes

    High maintenance cost when updates are frequent

    Non clustered Indexes

  • 8/13/2019 SQL Server 2008 Advanced Admin

    27/176

    please contact [email protected]

    Design by [email protected] 176

    Up to 249 per table

    Uses pointer to link to data

    Affected by changes to clustered indexes

    XML indexs

    Primary XML Index

    Secondary XML Indexes

    A shredded and persisted representation of the XML BLOBs

    Spatial indexes

    Can be created only on a column of type geometry or geography

    Table must have a Primary key

    You can create up to 249 spatial indexes on a table

    Spatial indexes cannot be specified on indexed views

    Create indexes :

  • 8/13/2019 SQL Server 2008 Advanced Admin

    28/176

    please contact [email protected]

    Design by [email protected] 176

    On database table right click on Indexes choose New indexes

    Next screen choose indexes type you want to create and add

    column of table then click OK

    Using T-SQL to create indexes

    [Create] / [Drop] / [alter] index [index name] on [table name](column

    name,);

    Filtered Indexes

    Create nonclustered index [index name] on [Tablename]( [field] ) where

    [condition];

    Indexes for VIEW

    Requirement :

  • 8/13/2019 SQL Server 2008 Advanced Admin

    29/176

    please contact [email protected]

    Design by [email protected] 176

    The ANSI_NULLS and QUOTED_IDENTIFIER option set to ON for

    CREATE VIEW

    The ANSI_NULL option set to ON for CREATE TABLE statements

    that create tables referenced by the view

    The view must not reference any other views

    All base tables referenced must be in the same database

    View must be created with SCHEMABINDING

    User-defined functions use SCHEMABINDING option.

    Style of Create command is like creating index for table

    Index performance

    Disabling Query Statistic Collection

    Right click on index of table choose properties and then choose

    option .Check or uncheck Automatically recompute statistic to

    enable or disable Query Statistic Collection .

    Addressing fragmentation and fill factor consideration.

    Right click on index of table choose properties and then choose

    fragmentation for addressing fragmentation or choose option to set

    fill factor

  • 8/13/2019 SQL Server 2008 Advanced Admin

    30/176

    please contact [email protected]

    Design by [email protected] 176

    Note: to understanding fill factor or Query statistic please contact

    [email protected] for full version .

    Database engine Tuning Advisor

  • 8/13/2019 SQL Server 2008 Advanced Admin

    31/176

    please contact [email protected]

    Design by [email protected] 176

    Choose your database machine , database , table to checked

  • 8/13/2019 SQL Server 2008 Advanced Admin

    32/176

    please contact [email protected]

    Design by [email protected] 176

    Choose tunning option

  • 8/13/2019 SQL Server 2008 Advanced Admin

    33/176

    please contact [email protected]

    Design by [email protected] 176

    Execute your SQL command and Click and then view

    recommended tab

    SQL server tuning advisor will show you what should do for performance of

    query.

  • 8/13/2019 SQL Server 2008 Advanced Admin

    34/176

    please contact [email protected]

    Design by [email protected] 176

    Full-Text Search

  • 8/13/2019 SQL Server 2008 Advanced Admin

    35/176

    please contact [email protected]

    Design by [email protected] 176

    Full-Text search terminology

    Full-text index

    Stores information about significant words and their location

    within a given column

    This information is used to quickly compute full-text queries

    that search for rows with particular words or combinations of

    words

    Full-text catalog

    A full-text catalog contain zero or more full-text indexes

    Each catalog can serve the indexing needs of one or more

    tables within a database

    Word breaker

    For a given language a word breaker tokenizes text based onthe lexical rules of the language

    Token

    A word or a character string identified by the word breaker .

    Stemmer

    For a given language , a stemmer generates inflectional forms

    of a particular word based on the rules of that language

    Filter

    Given a specified file type , for example .doc , filter extract text

    form a file stored in a varbinary(max) or image column

    Population or Crawl

    Is the process of creating and maintaining a full-text index

  • 8/13/2019 SQL Server 2008 Advanced Admin

    36/176

    please contact [email protected]

    Design by [email protected] 176

    Noise list

    A list of stopwords that are filtered from the queries on that

    full-text index . they are frequently occurring words that do not

    help the search .

    Installing Full-Text search

    Click SQL server installation Center

    Install new feature on Installation center

    Choose source to install

  • 8/13/2019 SQL Server 2008 Advanced Admin

    37/176

    please contact [email protected]

    Design by [email protected] 176

    Setup support Rules

    Installation type

  • 8/13/2019 SQL Server 2008 Advanced Admin

    38/176

    please contact [email protected]

    Design by [email protected] 176

    Select Full-Text search

    Disk space requirement

  • 8/13/2019 SQL Server 2008 Advanced Admin

    39/176

    please contact [email protected]

    Design by [email protected] 176

    Server configuration

    Error and reporting

  • 8/13/2019 SQL Server 2008 Advanced Admin

    40/176

    please contact [email protected]

    Design by [email protected] 176

    Installation rules

    Ready to install

  • 8/13/2019 SQL Server 2008 Advanced Admin

    41/176

    please contact [email protected]

    Design by [email protected] 176

    Installation progress

    Complete

  • 8/13/2019 SQL Server 2008 Advanced Admin

    42/176

    please contact [email protected]

    Design by [email protected] 176

    Creating a Full-Text Catalog and Full-Text Index

    Connect to SQL database server ,choose your tables , right click on

    tables

  • 8/13/2019 SQL Server 2008 Advanced Admin

    43/176

    please contact [email protected]

    Design by [email protected] 176

    Welcome screen click next

    Select an index

    Select table column

  • 8/13/2019 SQL Server 2008 Advanced Admin

    44/176

    please contact [email protected]

    Design by [email protected] 176

    Select change tracking

    Select Catalog , Index FileGroup , and Stoplist

  • 8/13/2019 SQL Server 2008 Advanced Admin

    45/176

    please contact [email protected]

    Design by [email protected] 176

    Note : to understanding option which you choose, feel free to contact

    [email protected]

    Define Population Schedules (Optional)

  • 8/13/2019 SQL Server 2008 Advanced Admin

    46/176

    please contact [email protected]

    Design by [email protected] 176

    Ready to create

  • 8/13/2019 SQL Server 2008 Advanced Admin

    47/176

    please contact [email protected]

    Design by [email protected] 176

    Progress

    You can modify your creating through Full-Text properties

    Configuring Full-Text searches

    Creating Full-Text Catalogs

    An object that contains the full-text indexes

    CREATE FULLTEXT CATALOG {NAME} as DEFAULT

    Creating Full-Text Indexes

  • 8/13/2019 SQL Server 2008 Advanced Admin

    48/176

    please contact [email protected]

    Design by [email protected] 176

    Contains all the significant terms and their location

    CREATE FULLTEXT INDEX ON [TABLE_NAME]([Column name],) KEY

    INDEX [PRIMARY_KEY]

    Using the INFLECTIONAL Statement

    After configuring FULL-TEXT search you use inflectional for

    advanced language searching

    Troubleshooting Full-Text search

    Dynamic Management Views

    Full-Text error log

    Dynamic management Views

    Sys.dm_fts_index_keywords

    Sys.dm_fts_index_keyworks_by_document

    Sys.dm_fts_parser

    Full-Text search error log

  • 8/13/2019 SQL Server 2008 Advanced Admin

    49/176

    please contact [email protected]

    Design by [email protected] 176

  • 8/13/2019 SQL Server 2008 Advanced Admin

    50/176

    please contact [email protected]

    Design by [email protected] 176

    SQL server 2008 Security

  • 8/13/2019 SQL Server 2008 Advanced Admin

    51/176

    please contact [email protected]

    Design by [email protected] 176

    Authentication mode:

    Windows authentication vs SQL authentication

    Right click on database engine or database server :

    Choose :

    Need to restart sqlserver

    Choose SQL server services , right click on SQL serverrestart

    Done for set authentication mode.

  • 8/13/2019 SQL Server 2008 Advanced Admin

    52/176

    please contact [email protected]

    Design by [email protected] 176

    Database-Level role

    Server-role

    Securable scope :

    Server databaseSchema

  • 8/13/2019 SQL Server 2008 Advanced Admin

    53/176

    please contact [email protected]

    Design by [email protected] 176

  • 8/13/2019 SQL Server 2008 Advanced Admin

    54/176

    please contact [email protected]

    Design by [email protected] 176

    SQL server 2008 Data encryption

    SQL server 2008 Encryption Hierarchy

    Window level

    SQL server level

    Database level

    Encryption Hierarchy Components

    Asymmetric keys

    An asymmetric keys is made up of a private key and the

    corresponding public key. Each key can decrypt data

    encrypted by the other

    Asymmetric encryption and decryption are relatively resource-

    intensive , but they provide a higher level of security than

    symmetric encryption

    An asymmetric key can be used to encrypt a symmetric key

    for storage in a database

    Symmetric keys

    A symmetric key is one key that is used for both encryption

    and decryption

    Encryption and decryption by using a symmetric key is fast ,

    and suitable for routine use with sensitive data in the database

    Certificates

    A public key certificate , usually just called a certificates , is a

    digitally-signed statement that binds the value of public key to

    the identity of the person , device or service that holds the

    corresponding private key

    Extensible Key Management (EKM)

  • 8/13/2019 SQL Server 2008 Advanced Admin

    55/176

    please contact [email protected]

    Design by [email protected] 176

    EKM is a new feature in SQL server 2008

    It enables parts of the cryptographic key hierarchy to be

    managed by an external source such as Hardware Security

    Module (HSM)

    Column encryption Application are impacted , No encryption delays

    for less sensitive data

    Transparent data encryption Encryption is hidden from users and

    applications , entire database is encrypted.

    SQL server 2008 column encryption Cell level

    Column encryption is implemented as a services of built-ins and a

    key management hierarchy

    Using this encryption is a manual process that requires a re-

    architecture of the application to call the encryption and decryption

    functions.

    Encrypted data must be stored as varbinary and then re-cast back to

    the appropriate data type when read

    Column encryption is available in all SQL server editions

    Practice encryption :

    Create column encrypted data

  • 8/13/2019 SQL Server 2008 Advanced Admin

    56/176

    please contact [email protected]

    Design by [email protected] 176

    Your result

    Column / CELL Encryption Steps

    Create database master key for each database

    (Note : Service master key was created when the instance was created )

    Create a certificates to protect the key

    Use certificate to create and protect the symmetric key

    Alter database to hold the encrypted data

    Open the key

    Encrypt the data

    Close the key

    When decrypt the data

  • 8/13/2019 SQL Server 2008 Advanced Admin

    57/176

    please contact [email protected]

    Design by [email protected] 176

    Your result

    Transparent data encryption

    Transparent data encryption(TDE) is a special case of encryption

    using a symmetric key

    TDE encrypt an entire database using that symmetric key called

    database encryption key

    The database encryption key is protected by other keys or

    certificates which are protected either by the database master key or

    by an asymmetric key stored in a EKM module

    TDE is available only in SQL server 2008 enterprise edition and sql

    server 2008 Developer edition

    Provide automatic query optimization techniques

    MSDN

    Practice

  • 8/13/2019 SQL Server 2008 Advanced Admin

    58/176

    please contact [email protected]

    Design by [email protected] 176

    Transparent Data encryption Steps

    Create the master key encryption password

    Create certificates

    Backup the certificate

    Create database encryption symmetric key

    Alter database to set encryption on

    Monitor encryption process

    Backup and restore with TDE enabled

    Take a backup database with TDE enabled

  • 8/13/2019 SQL Server 2008 Advanced Admin

    59/176

    please contact [email protected]

    Design by [email protected] 176

    Full backup

    Take backup transaction

  • 8/13/2019 SQL Server 2008 Advanced Admin

    60/176

    please contact [email protected]

    Design by [email protected] 176

    Delete the database object and certificate for TDE

    Restore database

    You get an error

    Fix it by

  • 8/13/2019 SQL Server 2008 Advanced Admin

    61/176

    please contact [email protected]

    Design by [email protected] 176

    And then restore database normally

    Using snapshot in SQL server 2008

    Use command

    View snapshots

  • 8/13/2019 SQL Server 2008 Advanced Admin

    62/176

    please contact [email protected]

    Design by [email protected] 176

    SQL server 2008 High availability options

    Failover clustering

    Database mirroring

    Log shipping

    Replication

    Failover clustering

    Provides high availability for an entire instances of SQL server

    A combination of one or more servers (called nodes)

    Two or more shared disks

    The application service had a virtual name that is independent of the

    node names , and is referred to as the failover cluster instance name

    The application does not have to know which node hosts the failover

    cluster instance

    A sql server failover cluster instances appears on the networks as a

    single computer

    A failover cluster does not protect against disk failure

    Yu can use failover clustering to reduces system downtime and

    provide higher application availability

    Failover clustering is supported in SQL Server enterprise and SQLserver Developer and SQL server standard

    Database mirroring

    Mirroring involves a principal database and a mirror database

    The mirror database is in accessible to clients

    A read-only snapshots of the mirror database can be made available

  • 8/13/2019 SQL Server 2008 Advanced Admin

    63/176

    please contact [email protected]

    Design by [email protected] 176

    Runs with either synchronous operation (high-safety mode ), or

    asynchronous operation (high-performance mode)

    High-safety mode with automatic failover involves a third witness

    server instance , which enables automatic failover

    Database mirroring partners and witnesses are supported on SQL

    server standard and sql server enterprise

    Partners must use the same edition

    High performance / asynchronous database mirroring in only

    supported only by SQL server enterprise edition

    Witnesses are also supported by SQL server workgroup and SQL

    server express

    Log shipping

    Similar to mirroring

    Operates at the database level

    Can use the secondary database for limited reporting

    Can have one or more secondary databases

    For failover the secondary database must be brought fully up-to-date

    by manually applying any unrestored log backups

    Support in SQL server enterprise , standard and workgroup editions

    Replication

    Can distribute data to one or more secondary servers (subscribers)

    Enables real-time availability across multiple servers

    Support filtering and partitioning of data sent to subscribers

    Subscribers are online and available for reporting or other function ,

    without query recovery

    Supported in all edition of SQL server

  • 8/13/2019 SQL Server 2008 Advanced Admin

    64/176

    please contact [email protected]

    Design by [email protected] 176

    Publishing is not available with SQL server Express or SQL server

    compact 3.5 SP1

    Allow filtering in the database to provide a subset of data at the

    secondary database because it operates at the database scope

    Allow more than one redundant copy of the database

    Allows real-time availability and scalability across multiple databases

    , supporting partitioned updates

    Allow complete availability of the secondary databases for reporting

    or other function , without query recoveryReplication and database mirroring

    Database mirroring can be used in conjunction with replication to

    provide availability for the publication database

    Replication failover to a mirror is support for publication database

    only

    It is not supported for the distribution database or subscription

    database

    Database mirroring is recommended over log shipping for additional

    fault tolerance in a replication environment

    Selecting a high availability Solution

  • 8/13/2019 SQL Server 2008 Advanced Admin

    65/176

    please contact [email protected]

    Design by [email protected] 176

  • 8/13/2019 SQL Server 2008 Advanced Admin

    66/176

    please contact [email protected]

    Design by [email protected] 176

    How to install high availability

  • 8/13/2019 SQL Server 2008 Advanced Admin

    67/176

    please contact [email protected]

    Design by [email protected] 176

    Before install failover cluster

    Object Description

    SQL server virtual server The group of clustered servers

    Heartbeat A UDP packet sent every 500 milliseconds

    Failover The process of a new node coming online

    Failback Reverse of the Failover

    Quorum resource Shared disk that holds cluster configuration

    Resource group Defines the items that failover

    Cluster resource An application and services

    Dependency A resource that must be online

    Majority node cluster Each node contributes disk to the quorum

    Failover cluster management Used to administer Window cluster

    Cluster witness disk or file share Helps determine cluster state

    Logical unit number Identifies a disk presented to a host

    - Prerequisites

    Two or more identical servers

    Window server 2008 enterprise or data center edition

    Two network interface per server

    Shared disk storage

    Distributed transaction Coordinator

    Identical drive letter mapping for shared disk

    Allow access through window 2008 firewall

    Window server 2008 Failover clustering in place

  • 8/13/2019 SQL Server 2008 Advanced Admin

    68/176

    please contact [email protected]

    Design by [email protected] 176

    Separate service accounts for Microsoft Failover cluster server and SQL server

    services

    All node must be identical including all software and service pack hotfixes.

    NETBIOS must be disabled

    All hardware and software certified by microsoft and be on its window catalog

    and Hardware Compatibility List

    Network adapters must be listed in the order they are accessed network services

    Separate network names and Ipv4 address for each services and application group

    All server must use DNS for name resolution

    All server must be the same domain

    All servers should have the same domain role

    - Practice

    Start SQL server Installation center

    Choose

  • 8/13/2019 SQL Server 2008 Advanced Admin

    69/176

    please contact [email protected]

    Design by [email protected] 176

    Choose image data

  • 8/13/2019 SQL Server 2008 Advanced Admin

    70/176

    please contact [email protected]

    Design by [email protected] 176

    Database Mirroring

  • 8/13/2019 SQL Server 2008 Advanced Admin

    71/176

    please contact [email protected]

    Design by [email protected] 176

    Mirroring overview

    - Increase data protection

    Database mirroring provides complete or almost complete redundancy of the data ,

    depending on whether the operating mode is high-safety or high-performance

    Increase availability of the database :

    In the event of a disaster , in high-safety mode with automatic failover , failover

    quickly brings the standby copy of the database online (without data loss ).

    Improves the availability during upgrades :

    You can sequentially upgrade the instance of SQL Server that are participating in

    the database mirroring session . This is known as a rolling upgrade .

    You cannot mirror system database :

    Master , msdb, tempdb , model , or distribution

  • 8/13/2019 SQL Server 2008 Advanced Admin

    72/176

    please contact [email protected]

    Design by [email protected] 176

    Operating mode :

    High-safety mode or synchronous operation

    Under high-safety mode changes are committed on both servers with or

    without automatic failover

    High-performance or asynchronous operation

    The principal server does not wait for acknowledgement from the mirror .

    The mirror may or may not keep up with the log records sent by the

    principal server

    Mirroring role:

    Principal server

    Server instance that server the database to client

    Mirror database

    Second instance that acts as a hot or warm standby server

    Witness server

    High-safety mode with automatic failover requires a third server instance ,

    known as a witness

  • 8/13/2019 SQL Server 2008 Advanced Admin

    73/176

    please contact [email protected]

    Design by [email protected] 176

    The mirror server initiates automatic failover only if the mirror and the

    witness remain connected to each other after both have been disconnected

    from the principal server

    Mirroring service account :

    When connecting the two instances what get authenticated is the service

    account

    For two server instances to communicate in the database mirroring session

    The login account of each instances requires access to the other instances

    Each login account requires connect permission to the database mirroring

    endpoint of the other instance

    A domain account (DOMAIN\UserName) is recommended

    PRACTICE:

    Setting up server engine service account .

    - Join your server SQL server to domain AD .

    - Now your server SQL server with SQL server engine is a user in domain

  • 8/13/2019 SQL Server 2008 Advanced Admin

    74/176

    please contact [email protected]

    Design by [email protected] 176

    - Edit your SQL server services:

    - Choose your SQL server service

  • 8/13/2019 SQL Server 2008 Advanced Admin

    75/176

    please contact [email protected]

    Design by [email protected] 176

    - Choose your sql server serivce User : SQL server engine in your domain

    - restart services sql server and you complete step1

    - Some topic you must be cover before continue configure

    - Database mirroring session

    - Mirroring occurs within a session

  • 8/13/2019 SQL Server 2008 Advanced Admin

    76/176

    please contact [email protected]

    Design by [email protected] 176

    Database mirroring endpoint

    - an endpoint is a SQL server object that enables SQL server to communicate

    over the network

    - For database mirroring , a server instances requires its own , dedicated

    database mirroring endpoint

    - All mirroring connections on a server instances use a single database

    mirroring endpoint

    - This endpoint is a special-purpose endpoint used exclusively to receive

    database mirroring connection from other server instances . Client

    connection to the principal server do not use the database mirroring

    endpoint

    - Each database mirroring endpoint listen on a unique TCP port number . The

    database mirroring endpoint of a server instances controls the port on which

    that listens for database mirroring message from other server instances.

    Creating endpoint :

    Principal server instances:

    Mirror server instance:

  • 8/13/2019 SQL Server 2008 Advanced Admin

    77/176

    please contact [email protected]

    Design by [email protected] 176

    Witness server instance:

    Role switching :

    Automatic failover :

    - in the presence of a witness , high-safety mode supports automatic failover

    - Automatic failover occurs only on the loss of the principal server when the

    witness and mirror server are still connected to each other and the database

    is already synchronized

    Manual failover :

    - High-safety mode support manual failover

    - Whenever the database is synchronized , the database owner can initiate a

    manual failover

    - Manual failover is provider for administrative purpose

    For service (with possible data loss)

    - Forcing service is supported in high-safety mode no witness is set and in

    high-performance mode . On the loss of the principal server , the database

    server owner can make the database available by forcing service to themirror server

    CONFIGURE ENDPOINTs AND STARTING MIRRORING

    - Take a backup full and transaction log on principal server and restore it to

    mirroring server . sure with this.

    - On principal server take mirroring

  • 8/13/2019 SQL Server 2008 Advanced Admin

    78/176

    please contact [email protected]

    Design by [email protected] 176

    Configuring security

  • 8/13/2019 SQL Server 2008 Advanced Admin

    79/176

    please contact [email protected]

    Design by [email protected] 176

    - Welcome next (@_@)

    - For higher performance choose witness server

  • 8/13/2019 SQL Server 2008 Advanced Admin

    80/176

    please contact [email protected]

    Design by [email protected] 176

    Choose default

  • 8/13/2019 SQL Server 2008 Advanced Admin

    81/176

    please contact [email protected]

    Design by [email protected] 176

  • 8/13/2019 SQL Server 2008 Advanced Admin

    82/176

    please contact [email protected]

    Design by [email protected] 176

    Next step connect to mirroring server and witness server ; you need login by user

    and pass for these server , or by the way use computer account for SQL server

    same on these machine (nicely for window ;easy to install )

    - leave blank

  • 8/13/2019 SQL Server 2008 Advanced Admin

    83/176

    please contact [email protected]

    Design by [email protected] 176

    Complete

  • 8/13/2019 SQL Server 2008 Advanced Admin

    84/176

    please contact [email protected]

    Design by [email protected] 176

    - Do you want to start ?

    - that s all

  • 8/13/2019 SQL Server 2008 Advanced Admin

    85/176

    please contact [email protected]

    Design by [email protected] 176

    And this is recommend when you configure :

    - The partner should run on comparable system that can handle identical

    workloads

    - The path (including the drive letter ) of the mirror database should be

    identical to the path of the principal database

    - All of the server instances in a mirroring session should use the samecollation . Differences will cause mirroring setup to fail

    - Database mirroring can support a maximum of 10 database per server

    instances

    - Works only with database that use the full recovery model

    - Database mirroring does not support FILESTREAM

  • 8/13/2019 SQL Server 2008 Advanced Admin

    86/176

    please contact [email protected]

    Design by [email protected] 176

    - Can not mirror system database .

  • 8/13/2019 SQL Server 2008 Advanced Admin

    87/176

    please contact [email protected]

    Design by [email protected] 176

    Log Shipping

  • 8/13/2019 SQL Server 2008 Advanced Admin

    88/176

    please contact [email protected]

    Design by [email protected] 176

    Log shipping overview :

    Automatically send transaction log backups from a primary database on a

    primary server instance to one or more secondary database .

    Support an optional third server instance known as the monitor server

    Log shipping consists of three operations:

    Backup the transaction log at the primary server instance

    Copy the transaction log file to the secondary server instance

    Restore the log backup on the secondary server instance

    The log can be shipped to multiple secondary server instances

    Does not automatically fail over from the primary server to the secondary

    server

    You can use the secondary database for reporting purposes

    Can configure alerts for your log shipping configuration.

  • 8/13/2019 SQL Server 2008 Advanced Admin

    89/176

    please contact [email protected]

    Design by [email protected] 176

    Edition support :

    Enterprise

    Standard

    Workgroup

    Web

    Log shipping servers:

    Primary server and database :

    Your production server

    Hosts the primary database

    All administration of the log shipping configuration

    Must use the full or bulk-logged recovery model

    Secondary server and database:

    Warm standby copy of your primary database .

    Can contain backup copies of database from several different primary

    servers .

    The secondary database must be initialized by restoring a full backup of

    primary database .

    Monitor server (optional)

    Tacks all of the details of log shipping such as :

    When the transaction log on the primary database was last backed up

    When the secondary servers last copies and restored the backup files

    Information about any backup failure alerts

    Should be on a server separate from the primary or secondary servers

    A single monitor server can monitor multiple log shipping configurations

  • 8/13/2019 SQL Server 2008 Advanced Admin

    90/176

    please contact [email protected]

    Design by [email protected] 176

    Log shipping setup ;

    Choose server for your primary server , secondary server , and optional

    monitor server

    Create a file share for the transaction logs backup

    Choose a backup schedule for the primary database

    Create a folder for each secondary server into which the transaction log

    backup files will be copied

    Configure one or more secondary database

    Optionally configure a monitor server

    Share folder permission:

    Full control or if you know permission window (-_-) secret by

  • 8/13/2019 SQL Server 2008 Advanced Admin

    91/176

    please contact [email protected]

    Design by [email protected] 176

    On server of primary database :

    Configure backup setting:

  • 8/13/2019 SQL Server 2008 Advanced Admin

    92/176

    please contact [email protected]

    Design by [email protected] 176

    Choose your share folder :

  • 8/13/2019 SQL Server 2008 Advanced Admin

    93/176

    please contact [email protected]

    Design by [email protected] 176

    You can edit schedule by click on Schedule:

  • 8/13/2019 SQL Server 2008 Advanced Admin

    94/176

    please contact [email protected]

    Design by [email protected] 176

    Add server instances:

  • 8/13/2019 SQL Server 2008 Advanced Admin

    95/176

    please contact [email protected]

    Design by [email protected] 176

    Choose secondary database :

  • 8/13/2019 SQL Server 2008 Advanced Admin

    96/176

    please contact [email protected]

    Design by [email protected] 176

    Choose share folder :

  • 8/13/2019 SQL Server 2008 Advanced Admin

    97/176

    please contact [email protected]

    Design by [email protected] 176

    Choose restore mode:

  • 8/13/2019 SQL Server 2008 Advanced Admin

    98/176

    please contact [email protected]

    Design by [email protected] 176

    Hit ok and success:

    Status of primary database log shipping:

  • 8/13/2019 SQL Server 2008 Advanced Admin

    99/176

    please contact [email protected]

    Design by [email protected] 176

    Status of log shipping:

    Primary server tables :

  • 8/13/2019 SQL Server 2008 Advanced Admin

    100/176

    please contact [email protected]

    Design by [email protected] 176

    Secondary server tables:

    Monitor server tables :

  • 8/13/2019 SQL Server 2008 Advanced Admin

    101/176

    please contact [email protected]

    Design by [email protected] 176

  • 8/13/2019 SQL Server 2008 Advanced Admin

    102/176

    please contact [email protected]

    Design by [email protected] 176

    SQL server 2008 replication

  • 8/13/2019 SQL Server 2008 Advanced Admin

    103/176

    please contact [email protected]

    Design by [email protected] 176

    Distributing data and database objects

    Data redundancy

    Faster access

    Server to server replication:

    Server to client replication

    The SQL server 2008 replication roles :

    Publisher

    The data source publisher

  • 8/13/2019 SQL Server 2008 Advanced Admin

    104/176

    please contact [email protected]

    Design by [email protected] 176

    Distributor

    Store replication data

    Local Distributor VS Remote Distributor

    Subcriber

    Database instance that receives data

  • 8/13/2019 SQL Server 2008 Advanced Admin

    105/176

    please contact [email protected]

    Design by [email protected] 176

    The players:

    SQL server agent

    - the boss

    Snapshot agent

    - it is used in all form of replication

    Log reader Agent

    - Used in transactional replication

    - Extracts and sends transactions from publishers log

    Distribution Agent

    - Dispatcher

    Merge agent

    - Use merge Replication

    Configure Replication :

  • 8/13/2019 SQL Server 2008 Advanced Admin

    106/176

    please contact [email protected]

    Design by [email protected] 176

    - add computer to domain

    - Create domain account

    - Configure the firewall

    - Install SQL Server and replication

    - Configure Distribution

    - Create the publication

    - Configure the subscriber

    - Create the subscribtion

    - Verify data was replicated at the subsscriber

    1- Your computer need to add to domain (your database need to replicate)

    2- Create domain account

    Create an user account for manage mdm in your domain add this login to SQL

    server (main + replicate server ) add server roles sysadmin

    And this is replication User account

  • 8/13/2019 SQL Server 2008 Advanced Admin

    107/176

    please contact [email protected]

    Design by [email protected] 176

    Your user account:

    Configure the firewall:

    Add program SQL server management studio to exception firewall and add port

    exclude 1433 with name sql server .

    Remember all machine to need configure this

    Install sql server and replication for all machine in your replication

  • 8/13/2019 SQL Server 2008 Advanced Admin

    108/176

    please contact [email protected]

    Design by [email protected] 176

    This is next step:

  • 8/13/2019 SQL Server 2008 Advanced Admin

    109/176

    please contact [email protected]

    Design by [email protected] 176

    Next choosing

    Next choosing

    next choosing:

  • 8/13/2019 SQL Server 2008 Advanced Admin

    110/176

    please contact [email protected]

    Design by [email protected] 176

    Next choosing:

  • 8/13/2019 SQL Server 2008 Advanced Admin

    111/176

    please contact [email protected]

    Design by [email protected] 176

    Default for many require and message: and install this

  • 8/13/2019 SQL Server 2008 Advanced Admin

    112/176

    please contact [email protected]

    Design by [email protected] 176

    Complete install

  • 8/13/2019 SQL Server 2008 Advanced Admin

    113/176

    please contact [email protected]

    Design by [email protected] 176

    Configuring Distribution:

    On main server database source :

    Choose this :

  • 8/13/2019 SQL Server 2008 Advanced Admin

    114/176

    please contact [email protected]

    Design by [email protected] 176

    Welcome next

  • 8/13/2019 SQL Server 2008 Advanced Admin

    115/176

    please contact [email protected]

    Design by [email protected] 176

    Choose this or you dont like:

  • 8/13/2019 SQL Server 2008 Advanced Admin

    116/176

    please contact [email protected]

    Design by [email protected] 176

    You need start automatically for SQl server agent

  • 8/13/2019 SQL Server 2008 Advanced Admin

    117/176

    please contact [email protected]

    Design by [email protected] 176

    Choose snapshot folder :

  • 8/13/2019 SQL Server 2008 Advanced Admin

    118/176

    please contact [email protected]

    Design by [email protected] 176

    Choose distribution database :

  • 8/13/2019 SQL Server 2008 Advanced Admin

    119/176

    please contact [email protected]

    Design by [email protected] 176

    Publisher:

  • 8/13/2019 SQL Server 2008 Advanced Admin

    120/176

    please contact [email protected]

    Design by [email protected] 176

    End configure :

  • 8/13/2019 SQL Server 2008 Advanced Admin

    121/176

    please contact [email protected]

    Design by [email protected] 176

    Finish to complete:

  • 8/13/2019 SQL Server 2008 Advanced Admin

    122/176

    please contact [email protected]

    Design by [email protected] 176

    Configure complete:

  • 8/13/2019 SQL Server 2008 Advanced Admin

    123/176

    please contact [email protected]

    Design by [email protected] 176

    Your system database have a database for distributor:

  • 8/13/2019 SQL Server 2008 Advanced Admin

    124/176

    please contact [email protected]

    Design by [email protected] 176

    Configure distribution:

    Remember many user we created in domain , now you need to add this to SQL

    server role :

    Repl_logreader

    Repl_snapshot

    Repl_distribution

    Repl_merge

    and add user mapping to database :

  • 8/13/2019 SQL Server 2008 Advanced Admin

    125/176

    please contact [email protected]

    Design by [email protected] 176

    And your database need to replication

  • 8/13/2019 SQL Server 2008 Advanced Admin

    126/176

    please contact [email protected]

    Design by [email protected] 176

    Remember path for replication you install on first step :

    Find this:

    Share this to network :

    Add users and for full control on this folder:

  • 8/13/2019 SQL Server 2008 Advanced Admin

    127/176

    please contact [email protected]

    Design by [email protected] 176

    And add users to security of folder with full control permission:

    End of configure for Distribution:

    Create publication:

  • 8/13/2019 SQL Server 2008 Advanced Admin

    128/176

    please contact [email protected]

    Design by [email protected] 176

    Choose this :

    Welcome next

  • 8/13/2019 SQL Server 2008 Advanced Admin

    129/176

    please contact [email protected]

    Design by [email protected] 176

    Choose database for publication:

  • 8/13/2019 SQL Server 2008 Advanced Admin

    130/176

    please contact [email protected]

    Design by [email protected] 176

    Next on next screen:

  • 8/13/2019 SQL Server 2008 Advanced Admin

    131/176

    please contact [email protected]

    Design by [email protected] 176

    Choose table for replication (need primary key)

  • 8/13/2019 SQL Server 2008 Advanced Admin

    132/176

    please contact [email protected]

    Design by [email protected] 176

    Filter tables row if you need:

  • 8/13/2019 SQL Server 2008 Advanced Admin

    133/176

    please contact [email protected]

    Design by [email protected] 176

    Create snapshot:

  • 8/13/2019 SQL Server 2008 Advanced Admin

    134/176

    please contact [email protected]

    Design by [email protected] 176

    User for agent :

  • 8/13/2019 SQL Server 2008 Advanced Admin

    135/176

    please contact [email protected]

    Design by [email protected] 176

    Creating

  • 8/13/2019 SQL Server 2008 Advanced Admin

    136/176

    please contact [email protected]

    Design by [email protected] 176

    Finish:

  • 8/13/2019 SQL Server 2008 Advanced Admin

    137/176

    please contact [email protected]

    Design by [email protected] 176

    Complete:

  • 8/13/2019 SQL Server 2008 Advanced Admin

    138/176

    please contact [email protected]

    Design by [email protected] 176

    Check configure :

  • 8/13/2019 SQL Server 2008 Advanced Admin

    139/176

    please contact [email protected]

    Design by [email protected] 176

    Configure the subscriber:

    Welcome next:

  • 8/13/2019 SQL Server 2008 Advanced Admin

    140/176

    please contact [email protected]

    Design by [email protected] 176

    Choose publication:

  • 8/13/2019 SQL Server 2008 Advanced Admin

    141/176

    please contact [email protected]

    Design by [email protected] 176

    Default on next screen:

  • 8/13/2019 SQL Server 2008 Advanced Admin

    142/176

    please contact [email protected]

    Design by [email protected] 176

    Add subscribers:

  • 8/13/2019 SQL Server 2008 Advanced Admin

    143/176

    please contact [email protected]

    Design by [email protected] 176

    Configure security:

  • 8/13/2019 SQL Server 2008 Advanced Admin

    144/176

    please contact [email protected]

    Design by [email protected] 176

    Add user repl_distribution

  • 8/13/2019 SQL Server 2008 Advanced Admin

    145/176

    please contact [email protected]

    Design by [email protected] 176

    Next

  • 8/13/2019 SQL Server 2008 Advanced Admin

    146/176

    please contact [email protected]

    Design by [email protected] 176

    Schedule:

  • 8/13/2019 SQL Server 2008 Advanced Admin

    147/176

    please contact [email protected]

    Design by [email protected] 176

    Start

  • 8/13/2019 SQL Server 2008 Advanced Admin

    148/176

    please contact [email protected]

    Design by [email protected] 176

    Create and finish

  • 8/13/2019 SQL Server 2008 Advanced Admin

    149/176

    please contact [email protected]

    Design by [email protected] 176

    On secondary database (replication )

    You will see your database with name Eastern

  • 8/13/2019 SQL Server 2008 Advanced Admin

    150/176

    please contact [email protected]

    Design by [email protected] 176

    Now some word you need understand :

    Publisher:

    Source of the replicated data

    Distributor:

    Handles distribution of the data

    Can be on a separate computer

    Subscriber:

    The recipient of the replicated data

    Article:

    Data and objects that will be shared or replicated

  • 8/13/2019 SQL Server 2008 Advanced Admin

    151/176

    please contact [email protected]

    Design by [email protected] 176

    Publication :

    A group of articles just like a newspaper or magazine

    Subscription:

    The plan for who gets what publication and when

  • 8/13/2019 SQL Server 2008 Advanced Admin

    152/176

    please contact [email protected]

    Design by [email protected] 176

    Resource governor

  • 8/13/2019 SQL Server 2008 Advanced Admin

    153/176

    please contact [email protected]

    Design by [email protected] 176

    Manage resource utilization

    Demand for database services will continue to increase.

    You are always on a path towards disaster

    The best DBA may go completely unnoticed

    Can managed

    Run away process

    Login priority

    Classification :

  • 8/13/2019 SQL Server 2008 Advanced Admin

    154/176

    please contact [email protected]

    Design by [email protected] 176

    A classifier function :

    Can classify incoming request based on various criteria :

    - Login

    - Database name

    - Host name

    - Application name

    - Connection properties such as IP address or protocol

    Create a classifier function:

  • 8/13/2019 SQL Server 2008 Advanced Admin

    155/176

    please contact [email protected]

    Design by [email protected] 176

    Example :

    Security for resource governor

    To change the resource governor configuration , a user requires CONTROL

    SERVER permission (sysadmin role)

    To view active configuration , a user requires VIEW SERVER STATEpermission (serveradmin role)

    Enable :

    ALTER RESOURCE GOVERNOR RECONFIGURE

    Disable:

    ALTER RESOURCE GOVERNOR DISABLE

    Resource pool

    Pools of system resource are defined and the percentage of those resources

    is located to the pool

    Used to minimize the effect of runaway process

    Groups system resources and access levels

    Presently only CPU time and memory can be managed

  • 8/13/2019 SQL Server 2008 Advanced Admin

    156/176

    please contact [email protected]

    Design by [email protected] 176

    Create resource pool

    Workloads group

    Workload group server as container for processes running against the database .

    these container or group are mapped to specified resource pool

  • 8/13/2019 SQL Server 2008 Advanced Admin

    157/176

    please contact [email protected]

    Design by [email protected] 176

    Create resource pool and workloads group

  • 8/13/2019 SQL Server 2008 Advanced Admin

    158/176

    please contact [email protected]

    Design by [email protected] 176

    Performance tuning

  • 8/13/2019 SQL Server 2008 Advanced Admin

    159/176

    please contact [email protected]

    Design by [email protected] 176

    SQl server profiler

    Can step through queries for troubleshooting

    Identify slow queries

    Capture traces for analysis and relay

    Provide input for the Database Engine tuning Advisor

    Find problems related to locks and deadlock situations

    Pre-built configuration template

    Database engine tuning Advisor

    Helps automates SQL server optimization

    Can suggest

    - Adding / deleting indexes

    - Adding new partition

    - Adding Statistics

    Comes with pre-define configuration templates

    Customizable

    Generates T-SQL code for recommended changes

    Can use SQL server Profiler trace as input

    Can evaluate queries for optimization

    How to use this ,(@_@) it is a secret

  • 8/13/2019 SQL Server 2008 Advanced Admin

    160/176

    please contact [email protected]

    Design by [email protected] 176

    SQL server 2008 Integration services

  • 8/13/2019 SQL Server 2008 Advanced Admin

    161/176

    please contact [email protected]

    Design by [email protected] 176

    Integration service

    Business Intelligence (BI )

    The practice of taking raw data and making it useful for supporting

    business goal and decision

    Integration Service (SSIS )

    Integration of information from various systems

    Analysis Services (SSAS )

    Data analysis tools supporting business decisions

    Reporting services (SSRS)

    Reporting tools creating , running and maintaining custom reports

    Cover in integration services

    Integration services is a platform for building high performance data

    integration and workflow solution , including extraction , transformation ,

    and loading (ETL) operations

    Merging Data from Heterogeneous Data Stores

    Cleaning and Standardizing Data

    How to use :

  • 8/13/2019 SQL Server 2008 Advanced Admin

    162/176

    please contact [email protected]

    Design by [email protected] 176

    Set service account;

    Set account

  • 8/13/2019 SQL Server 2008 Advanced Admin

    163/176

    please contact [email protected]

    Design by [email protected] 176

    Configure firwall

  • 8/13/2019 SQL Server 2008 Advanced Admin

    164/176

    please contact [email protected]

    Design by [email protected] 176

    Add port :

  • 8/13/2019 SQL Server 2008 Advanced Admin

    165/176

    please contact [email protected]

    Design by [email protected] 176

    Edit file MsDtsSrvr.ini.xml

    Edit this file , for more information need an help in microsoft:

  • 8/13/2019 SQL Server 2008 Advanced Admin

    166/176

    please contact [email protected]

    Design by [email protected] 176

    In some case you must edit registry window

    Import wizard :

    Welcome next

  • 8/13/2019 SQL Server 2008 Advanced Admin

    167/176

    please contact [email protected]

    Design by [email protected] 176

    Choose source data:

  • 8/13/2019 SQL Server 2008 Advanced Admin

    168/176

    please contact [email protected]

    Design by [email protected] 176

    Choose data source

  • 8/13/2019 SQL Server 2008 Advanced Admin

    169/176

    please contact [email protected]

    Design by [email protected] 176

  • 8/13/2019 SQL Server 2008 Advanced Admin

    170/176

    please contact [email protected]

    Design by [email protected] 176

    Complete data source:

    View data

  • 8/13/2019 SQL Server 2008 Advanced Admin

    171/176

    please contact [email protected]

    Design by [email protected] 176

    Choose destination:

    Choose table destination:

  • 8/13/2019 SQL Server 2008 Advanced Admin

    172/176

    please contact [email protected]

    Design by [email protected] 176

    You can edit mapping table:

    Choose SSIS package:

  • 8/13/2019 SQL Server 2008 Advanced Admin

    173/176

    please contact [email protected]

    Design by [email protected] 176

    Choose save package:

    Summary and finish

  • 8/13/2019 SQL Server 2008 Advanced Admin

    174/176

    please contact [email protected]

    Design by [email protected] 176

    Connect integration server:

  • 8/13/2019 SQL Server 2008 Advanced Admin

    175/176

    please contact [email protected]

    Design by [email protected] 176

    Choose run package:

    This is complete for ETL (extract , transform and load)

  • 8/13/2019 SQL Server 2008 Advanced Admin

    176/176

    please contact [email protected]