Beruflich Dokumente
Kultur Dokumente
Manasi Adsul-01
Nidhi Chauhan-07
Isha Chhawchharia-08
Introduction
• MS SQL Server is a database server and a product of Microsoft
• Enables user to write queries and other SQL statements and execute
them
• Consists of several features. A few are:
– Query Analyzer- Allows us to write queries and SQL statements, Checks syntax
of the SQL statement written, Executes the statements, Store and reload
statements, Save the results in file, View reports.
– Profiler- is a Monitoring tool, Used for performance tuning, Uses traces – an
event monitoring protocol, Event may be a query or a transaction like logins,
– Service Manager- Helps us to manage services, More than one instance of SQL
server can be installed in a machine, First Instance is called as default instance,
Rest of the instances (16 max) are called as named instances, Service manager
helps in starting or stopping the instances individually
– Bulk Copy Program (BCP)- A powerful command line utility that enables us to
transfer large number of records from a file to database. Time taken for copying
to and from database is very less, Helps in back up and restoration
System Databases
• By default SQL server has 5 databases
– Master : Records all the system level info for an instance of SQL Server.
– Model : It is used by SQL Server as Templates for all DB created
– Tempdb : It is a workspace for holding Temporary objects or intermediate
results set.
– Msdb : Has tables that have details with respect to alerts, jobs. Deals with SQL
Server Agent Service
⁻ Resourcedb :- It is used as a read only Database containing System Objects that
are included in SQL Server.
• We need to use Master database for creating a database
• By default the size of a database is 1 MB
• A database consists of
– Master Data File (.mdf)
– Primary Log File (.ldf)
SQL Database SQL Operators
Objects
– Tables
Arithmetic
– Views Assignment
– Triggers Bitwise
SQL Server Data types
• Integer : Stores whole number
• Float : Stores real numbers
• Text : Stores characters
• Decimal: Stores real numbers
• Money : Stores monetary data. Supports 4 places after
decimal
• Date : Stores date and time
• Binary : Stores images and other large objects
• Miscellaneous : Different types special to SQL Server.
(Refer to notes for more info)
Built-In Server / Database Roles
Server Roles Database Roles
• SysAdmin • db_accessadmin
• ServerAdmin • db_BackupOperation
• SetupAdmin • db_DataReader
• SecurityAdmin • db_DataWriter
• ProcessAdmin • db_DDLAdmin
• DiskAdmin • db_DenyDataReader
• DBCreator • db_DenyDataWriter
• BulkAdmin • db_Owner
• db_SecurityAdmin
• public
SERVER ROLES
• SysAdmin :- Can perform any activity in the server
• ServerAdmin :- Can change server-wide configuration and shut it down
• SetupAdmin :- Add or remove linked servers
• SecurityAdmin :- Manages login and their properties , resets password.
• ProcessAdmin:- Ends running processes
• DiskAdmin :- Manages Disk File
• DBCreator :- Create, Drop, Restore and Alter Database
• BulkAdmin :-Can Run BULK_INSERT statement. (Bulk_Insert is a
process/method provided by a dbms to load multiple rows of data into db
Table).
• Public:- Every server belongs to Public. Database user cannot be removed
from public role.
DATABASE ROLES
• db_accessadmin :- Add/Remove access to database for Logins
• db_BackupOperation:- Backing up the Database
• db_DataReader :- Read all data from User Table
• db_DataWriter :- Add, Delete or change data into user table
• db_DDLAdmin:- can run any Data Definition Language command in
database.
• db_DenyDataReader:- Members of this cannot read any data in user table.
• db_DenyDataWriter:-cannot Add, Delete or modify data into user table
• db_Owner:- Configuration & Maintainence activities on database (drop
table).
• db_SecurityAdmin:- Modify and manage permissions
• Public:- Every database belongs to Public. Database user cannot be
removed from public role.
• db_manager:- Create and Delete Databases.
Understanding Database Schemas
• Schemas
– Logical collection of related database objects
– Part of full object name:
• Server.Database.Schema.Object
– Default schema is “dbo”
• Managing Schemas
– CREATE, ALTER, DROP SCHEMA
– SQL Server Management Studio
– Can assign default schemes to database users:
• WITH DEFAULT_SCHEMA ‘SchemaName’
In-Memory OLTP - Motivation
$/1000 Mb
1800
1600
SQL 2000
1400
1200
1000
800 $/1000 Mb
2004
2000
2000
2001
2001
2001
2002
2002
2003
2003
2005
2006
2006
2007
2007
2008
2008
2009
2009
2010
2010
2010
2011
2012
2012
2013
2013
2014
2014
Database Maintenance & Data –
Protection-Methods for maintaining, backing up, and restoring databases
• Backup operations
Differential Backups:-Differential database backup includes only extents
(collections of eight physically contiguous pages) which were changed since the
last full database backup. SQL Server looks into the Differential Changed Map
(DCM) page to identify all the extents which were changed since the last full
database backup and captures only them; hence, often differential database
backup is very fast compared to taking a full database backup.
Transaction Log Backups:- Transaction log backup is supported only with either
Full recovery model or Bulk-logged recovery model and like differential database
backup, you must have taken a full database backup as its base. Transaction log
backup captures all the transaction log records that have been written after the
last full database backup or last transaction log backup.
Recovery Processes-
• Recovery process:
Latest full backup (Required), Latest differential backup (Optional), Unbroken sequence of
transaction log backups (Optional)
• All transaction logs should be restored with NO RECOVERY option (except for the last
one)
Prevents database from being accessed while restore process is taking place
Relational Database Server Goals
Data Integrity
Transaction
Performance and
Isolation
Protection
The release currently being implemented is designed to augment the product’s ease of
use, ease of application development, robustness, performance, and scalability
features.
THANK YOU!