Professional Documents
Culture Documents
SQL1
SQL1
lcd
CuH3Iy9<;F@zc2f
Windows operation system level Data protection API(DPAPI) protects the SMK
TDE uses,
Service master key(SMK)
Database master Key(DMK)
servie certitificate
Database encryption key
Archeitecture
Windows DPAPI
|SQL server setup
SQL server instance level- service master key
|create master key
Master Database leve-Database master key
|- create certificate
User database level- DB encryption key
Create Database encryption key
To view
Sys.databases
sys.certificates
sys.dm_database_encryption_key
--certicate encrypte
use database
ADV180002 spectre/meltdown
gQd[ul<naX9+'n'
.3l:nWl(4yz|0Ju
gQd[ul<naX9+'n'
Trigger Limitation
negative affect on performance
can be disabled by powers users
no support of select statemnts
80*4
Full
Complete Recovery
poin-in-time
Any time log backup
file restore
Page restore
piecemeal restore
\
Bulk-logged
some data-loss exposure
if bulk logged changes can't log backup
sometimes file restore can't
page restore can't
piecemeal restore can't
simple
-data lost upto full and diff
-Point-in-time not possible
-seconday read files only in file restore
-page restore NO
-secondary ready only files in peciemal restore
Restiration phases
*Data copy
Creates and copies data and log files
* Redo
Applies committed logged transactions
*Undo
Rolls back any uncommitted transactions
Page restores
--faster
--only in Full and bulk-logged
Piecemeal restores
- Allows a database containing many filegroups to be recovered in stages
- works in all recovery models
- reduce time for read-write filegroups
Each recovery starts with an initial restore sequence, called "partial restore
sequence"
Filegroup-restore
- any offline seconday file group can be recovered(only Enterprise edition)
- if ready-only file is consistent with the database, if desn't have restored
Backups
- Recovery
-compliance
-Legal requirements
CheckDB
-dumpfile(SQLDUMPnnn.txt is created in SQL log directory detects corruption error
Data collector
-different sources to collect the data and store in warehouse
-- Dynamic management objects(DMO's)
-- Performance counters
-- SQL Trace events
Query Store
-introduced in 2016
- Automatically captures data & performace over time
-simplifies performance troubleshooting
- disbabled by default, requires enable if requires
- lies Queies, Plans, Runtime statistics
To Enable this,
Right click on DB--> select Query store page in DB properties, select ON in
operation mode
T-SQL-- Alter database DB with set query_store=ON
Extended Events
* supports in SQL, Operation syste, Database applications, outside 3rd party
the index in place was useful in reducing the number of records that had to be read
DB MAIL:
callls SP sp_send_dbmail, the mesage for delivery to a service know as the service
broker queue, once SP executes, deliver it through SMTP
database mail-userR ole
--Supports in
Integrated configuration
logging
auditing
HTML
Public profiles can be view any users
private profiles strictly controlled
Operators:
dbo.sp_add_sysoperator
Three contact methods can be configure
1. E-mail- email address(SMTP) where notifications can be sent
2.Pager E-mail- Email add(SMTP) where notifications in schdule times
3. Net send address- windows messanger sevices, where it just pop-up a message on
screen of the computer specified
*Fail-safe operators
--SQL agent can't access the tables that contain settings for operators and
notifications
Poor indexing
Inaccurate statistics
Poor Query design
Poor execution plans, Usually caused by bad parametar sniffing
excessive blocking and deadlocks
Non-set-based operations, usaually t-sql
poor database design
execessive fragmentations
nonresuable
Table scan- scanning the entire the table- non exist index- it makes CPU, memory
Index scan- scanning the entire the index-
241813
Causes of Bottelnecks
* Incorrectly configured resources
*malfunctioning resources
*workload not evenly distributed b/w resources of the same type
* insufficient resources, requiring additional or upgrade components
Five Areas to monitor when tracking the server performance to identify bottlenecks
* Memory Usage-Insufficient memory allocation to SQL degardes pefromance, Data must
be read from the disk rather than directly from data cache.
* CPU utilization- High CPU utilaztion rate may indicate that Trasacte SQL queries
need to be tuned or that a CPU upgrade is needed
*Disk Input.Output(I/O)- T SQL can be tuned to reduce unnecessary I/O,
*User connections- too many users may be accessing the server causing performacne
degradation
* Blocking locks- incorrectly designed application can cause locks and hamper
concurrency, thus causing longer response times, and lower transaction throughput
rates
Possible problems
* Application development errors
* Hardware errors
* Excessive blocking due to an incorrectly desinged database
Indexes
Clustered Index
* Order Data rows
* Cluestered index key
* B-Tree Structure
* Rapid row retrieval
Non-Clustered
* Data rows not necessarily
* Non-clustered key value
* Row locator
* Heap
Unique
* Prevents value duplication
*unique rows and cloumns
Cloumnstore index
* cloumn-based data storage and query processing
* High query performance and data compression
LogShipping
Tuff file create each database one
manual failover
AG
1 primary, 8 secondary
Supports, Automatic,planned manual failover, Force failover
Key Support Functions
* AG Listner
* Flexible failover policy
* Automatic Page repair
* Encryption And Compression
Foreced Faiover
* Disaster recovery
* risk ofData loss
* Target replica role is in secondary or resolvingstate
* Secondary database are suspended
Quorum mode
* Heartbeat communication
* Periodic Quoram votes
* Configured at the WSFC Cluster level
* odd number of votes
Distributed Availablity
* two AG groups configuren Distributed.
TWO Windows clusters and two AG groups
Difference
*Efficient for geographic distribution
* Data sent one time to secondary WSFC and replicated
* Automatic failover not supported
Single
* Not efficient for georaphic distribution
* Data sent to each replic individually
* automatic failover supported
VNet,
Virtual Machines(VM)
Subnet,
NIC( Network Interface Card)
DNS
Inbound, OutBound
Resource Group
Network Group
Virtual Networks
SSL Certificate
SSD Disks
SDT Disks
Health Probes
https://www.youtube.com/watch?v=csXmYM8r8bo