SlideShare a Scribd company logo
2
Most read
3
Most read
8
Most read
Basics of SQL Server
Vishal Jharwade
sqlcircuit.blogspot.com
Agenda
• SQL Server Architecture
• Database Architecture
• System Databases
• Recovery Models
• Backup and Restore
• Security
• T-SQL
• SQL Jobs
SQL Server BI Model
3
Reporting Services
Analysis Services
OLAP & Data Mining
Integration
Services
ETL
SQL Server
Relational Engine
DevelopmentTools
ManagementTools
System Databases with SQL Server
• Master
The Master database holds information for all databases located on the SQL Server instance. This
database includes information such as system logins, configuration settings, linked servers, and
general information regarding the other system and user databases for the instance. The master
database also holds extended stored procedures, which access external processes.
• Model
Model is essentially a template database used in the creation of any new user database created in
the instance.
• Tempdb
As its name implies, Tempdb holds temporary objects such as global and local temporary tables and
stored procedures. This database is recreated every time SQL Server starts, and the objects
contained in it will be based upon the objects defined in the model database.
• Msdb : The msdb database stores information regarding database backups, SQL Agent
information, DTS packages, SQL Server jobs, and some replication information such as for log
shipping.
Recovery Models
• Full Recovery :
The Full Recovery model uses database backups and transaction log backups to provide complete
protection against media failure. It provides the ability to recover the database to the point of failure
or to a specific point in time.
• Bulk logged Recovery :
The bulk-logged recovery model protects against failure and offers the best performance. In
order to get better performance. The operations which minimally logged and not fully
recoverable are SELECT INTO, BULK INSERT, CREATE INDEX and TEXT/IMAGE OPERATION.
• Simple Recovery :
The simple recovery model allows you to recover data only to the most recent full backup or
differential backup. Transaction log backups are not available because the contents of the
transaction log are truncated each time a checkpoint is issued for the database.
Backups and Restore
• Full Backup :
A full database backup backs up the whole database. This includes part of the transaction log so
that the full database backup can be recovered.
• Differential Backup :
A differential database backup records only the data that has changed since the last full database
backup.
• Transaction log Backup :
A transaction log backup makes a copy of only the log file. A log file backup by itself cannot be used
to restore a database. A log file is used after a database restore to recover the database to the point
of the original failure.
File group Backup : It backups only file groups available in the database.
T-SQL : System stored procedures commonly use for Database Administration.
• sp_databases: It lists databases that resides in the instance of SQL Server 2005. you can also get the
same information from sys.databases table.
• sp_spaceused: It shows disk space information occupied by database.
• sp_help: Reports information about a database object.
• sp_helpdb: Reports information about a specified database or all databases.
• sp_renamedb: syntax :sp_renamedb [ @dbname = ] 'oldname' , [ @newname = ] 'newname‘
• sp_who: Provides information about current users, sessions, and processes in an instance of the
Microsoft SQL Server Database Engine.
• sp_dboption: Displays or changes database options.
Global Variables:
• @@SERVERNAME: Returns the name of the local server that is running SQL Server.
• @@SERVICENAME: Returns name of the service on which SQL server is running.
• @@VERSION: Returns version, processor architecture, build date, and operating system for the
current installation of SQL Server.
• @@ERROR: Returns the error number for the last Transact-SQL statement executed.
• @@ROWCOUNT: Returns the number of rows affected by the last statement.
SQL Server commands
• KILL : KILL is commonly used to terminate a process. You can not kill your own process.
• BACKUP: It is used to take backup of a particular database.
• COUNT: Returns total no. of objects.
• DELETE : Remove rows from the table or view.
• DISTICT : Used to retrieve unique data.
• DROP : To remove the database object.
• GETDATE : Returns the current database system timestamp.
• TOP: Specifies that only the first set of rows will be returned from the query result.
• UPDATE: It is used to update the records into the table.
SQL Agent Job
• SQL Jobs are the collection of steps performed sequentially to perform specific task.
• It is run by SQL Server agent service.
• SQL Agent Jobs can be scheduled to run at specified times or at specified intervals.
• Jobs Can be enabled or disabled.
• For errors, You can see the job history or SQL Server agent log.

More Related Content

What's hot (20)

PPTX
Snowflake essentials
qureshihamid
 
PDF
Tutorial On Database Management System
psathishcs
 
PPT
Files Vs DataBase
Dr. C.V. Suresh Babu
 
ODP
Partitioning
Reema Gajjar
 
PDF
TFA Collector - what can one do with it
Sandesh Rao
 
PPTX
NoSQL databases - An introduction
Pooyan Mehrparvar
 
PPTX
Oracle
JIGAR MAKHIJA
 
PPTX
MDF and LDF in SQL Server
Masum Reza
 
PPTX
Oracle architecture ppt
Deepak Shetty
 
PPT
MySQL Atchitecture and Concepts
Tuyen Vuong
 
PDF
PostgreSQL Tutorial for Beginners | Edureka
Edureka!
 
PDF
Snowflake free trial_lab_guide
slidedown1
 
PPS
Oracle Database Overview
honglee71
 
PDF
Maximum Availability Architecture - Best Practices for Oracle Database 19c
Glen Hawkins
 
PDF
Sql server 2019 new features
George Walters
 
PPT
Database performance tuning and query optimization
Dhani Ahmad
 
PDF
MySQL Tutorial For Beginners | Relational Database Management System | MySQL ...
Edureka!
 
PPTX
Understand oracle real application cluster
Satishbabu Gunukula
 
PPTX
Data Warehouse Fundamentals
Rashmi Bhat
 
PPTX
MySQL Architecture and Engine
Abdul Manaf
 
Snowflake essentials
qureshihamid
 
Tutorial On Database Management System
psathishcs
 
Files Vs DataBase
Dr. C.V. Suresh Babu
 
Partitioning
Reema Gajjar
 
TFA Collector - what can one do with it
Sandesh Rao
 
NoSQL databases - An introduction
Pooyan Mehrparvar
 
MDF and LDF in SQL Server
Masum Reza
 
Oracle architecture ppt
Deepak Shetty
 
MySQL Atchitecture and Concepts
Tuyen Vuong
 
PostgreSQL Tutorial for Beginners | Edureka
Edureka!
 
Snowflake free trial_lab_guide
slidedown1
 
Oracle Database Overview
honglee71
 
Maximum Availability Architecture - Best Practices for Oracle Database 19c
Glen Hawkins
 
Sql server 2019 new features
George Walters
 
Database performance tuning and query optimization
Dhani Ahmad
 
MySQL Tutorial For Beginners | Relational Database Management System | MySQL ...
Edureka!
 
Understand oracle real application cluster
Satishbabu Gunukula
 
Data Warehouse Fundamentals
Rashmi Bhat
 
MySQL Architecture and Engine
Abdul Manaf
 

Similar to Sql server basics (20)

PDF
Aioug vizag oracle12c_new_features
AiougVizagChapter
 
PDF
ORACLE ARCHITECTURE
Manohar Tatwawadi
 
PPT
Lecture2 oracle ppt
Hitesh Kumar Markam
 
PPT
ora_sothea
thysothea
 
PPT
database-stucture-and-space-managment.ppt
Iftikhar70
 
PPT
database-stucture-and-space-managment.ppt
subbu998029
 
PPTX
Using Basic Structured Query Language lo1.pptx
TsedaleBayabil
 
PPT
Online Oracle Training For Beginners
vibrantuser
 
PDF
SQL Server 2014 Monitoring and Profiling
Abouzar Noori
 
PPTX
Oracle DBA
shivankuniversity
 
PPTX
SQL PPT.pptx
Kulbir4
 
PPT
Oracle 10g Introduction 1
Eryk Budi Pratama
 
PPTX
SQL SERVER Training in Pune Slides
enosislearningcom
 
PPT
1650607.ppt
KalsoomTahir2
 
PPTX
MySQL database
lalit choudhary
 
DOC
My sql technical reference manual
Mir Majid
 
PDF
Rolta’s application testing services for handling ever changing environment.
Rolta
 
PPTX
unit-ii.pptx
NilamHonmane
 
PPTX
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
WrushabhShirsat3
 
PPT
Java Developers, make the database work for you (NLJUG JFall 2010)
Lucas Jellema
 
Aioug vizag oracle12c_new_features
AiougVizagChapter
 
ORACLE ARCHITECTURE
Manohar Tatwawadi
 
Lecture2 oracle ppt
Hitesh Kumar Markam
 
ora_sothea
thysothea
 
database-stucture-and-space-managment.ppt
Iftikhar70
 
database-stucture-and-space-managment.ppt
subbu998029
 
Using Basic Structured Query Language lo1.pptx
TsedaleBayabil
 
Online Oracle Training For Beginners
vibrantuser
 
SQL Server 2014 Monitoring and Profiling
Abouzar Noori
 
Oracle DBA
shivankuniversity
 
SQL PPT.pptx
Kulbir4
 
Oracle 10g Introduction 1
Eryk Budi Pratama
 
SQL SERVER Training in Pune Slides
enosislearningcom
 
1650607.ppt
KalsoomTahir2
 
MySQL database
lalit choudhary
 
My sql technical reference manual
Mir Majid
 
Rolta’s application testing services for handling ever changing environment.
Rolta
 
unit-ii.pptx
NilamHonmane
 
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
WrushabhShirsat3
 
Java Developers, make the database work for you (NLJUG JFall 2010)
Lucas Jellema
 
Ad

Recently uploaded (20)

PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PDF
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PDF
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
PDF
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
PDF
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
PPTX
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
PPTX
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
PPTX
Digital Circuits, important subject in CS
contactparinay1
 
PDF
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
PDF
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
PPTX
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
Digital Circuits, important subject in CS
contactparinay1
 
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
Ad

Sql server basics

  • 1. Basics of SQL Server Vishal Jharwade sqlcircuit.blogspot.com
  • 2. Agenda • SQL Server Architecture • Database Architecture • System Databases • Recovery Models • Backup and Restore • Security • T-SQL • SQL Jobs
  • 3. SQL Server BI Model 3 Reporting Services Analysis Services OLAP & Data Mining Integration Services ETL SQL Server Relational Engine DevelopmentTools ManagementTools
  • 4. System Databases with SQL Server • Master The Master database holds information for all databases located on the SQL Server instance. This database includes information such as system logins, configuration settings, linked servers, and general information regarding the other system and user databases for the instance. The master database also holds extended stored procedures, which access external processes. • Model Model is essentially a template database used in the creation of any new user database created in the instance. • Tempdb As its name implies, Tempdb holds temporary objects such as global and local temporary tables and stored procedures. This database is recreated every time SQL Server starts, and the objects contained in it will be based upon the objects defined in the model database. • Msdb : The msdb database stores information regarding database backups, SQL Agent information, DTS packages, SQL Server jobs, and some replication information such as for log shipping.
  • 5. Recovery Models • Full Recovery : The Full Recovery model uses database backups and transaction log backups to provide complete protection against media failure. It provides the ability to recover the database to the point of failure or to a specific point in time. • Bulk logged Recovery : The bulk-logged recovery model protects against failure and offers the best performance. In order to get better performance. The operations which minimally logged and not fully recoverable are SELECT INTO, BULK INSERT, CREATE INDEX and TEXT/IMAGE OPERATION. • Simple Recovery : The simple recovery model allows you to recover data only to the most recent full backup or differential backup. Transaction log backups are not available because the contents of the transaction log are truncated each time a checkpoint is issued for the database.
  • 6. Backups and Restore • Full Backup : A full database backup backs up the whole database. This includes part of the transaction log so that the full database backup can be recovered. • Differential Backup : A differential database backup records only the data that has changed since the last full database backup. • Transaction log Backup : A transaction log backup makes a copy of only the log file. A log file backup by itself cannot be used to restore a database. A log file is used after a database restore to recover the database to the point of the original failure. File group Backup : It backups only file groups available in the database.
  • 7. T-SQL : System stored procedures commonly use for Database Administration. • sp_databases: It lists databases that resides in the instance of SQL Server 2005. you can also get the same information from sys.databases table. • sp_spaceused: It shows disk space information occupied by database. • sp_help: Reports information about a database object. • sp_helpdb: Reports information about a specified database or all databases. • sp_renamedb: syntax :sp_renamedb [ @dbname = ] 'oldname' , [ @newname = ] 'newname‘ • sp_who: Provides information about current users, sessions, and processes in an instance of the Microsoft SQL Server Database Engine. • sp_dboption: Displays or changes database options. Global Variables: • @@SERVERNAME: Returns the name of the local server that is running SQL Server. • @@SERVICENAME: Returns name of the service on which SQL server is running. • @@VERSION: Returns version, processor architecture, build date, and operating system for the current installation of SQL Server. • @@ERROR: Returns the error number for the last Transact-SQL statement executed. • @@ROWCOUNT: Returns the number of rows affected by the last statement.
  • 8. SQL Server commands • KILL : KILL is commonly used to terminate a process. You can not kill your own process. • BACKUP: It is used to take backup of a particular database. • COUNT: Returns total no. of objects. • DELETE : Remove rows from the table or view. • DISTICT : Used to retrieve unique data. • DROP : To remove the database object. • GETDATE : Returns the current database system timestamp. • TOP: Specifies that only the first set of rows will be returned from the query result. • UPDATE: It is used to update the records into the table.
  • 9. SQL Agent Job • SQL Jobs are the collection of steps performed sequentially to perform specific task. • It is run by SQL Server agent service. • SQL Agent Jobs can be scheduled to run at specified times or at specified intervals. • Jobs Can be enabled or disabled. • For errors, You can see the job history or SQL Server agent log.