SlideShare a Scribd company logo
2
Most read
4
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

PPTX
Physical architecture of sql server
PDF
MS-SQL SERVER ARCHITECTURE
PPT
Sql server basics
PPT
Sql Server Basics
PPT
Ms sql server architecture
PDF
SQL - RDBMS Concepts
PPTX
DBMS and its Models
PPT
Oracle backup and recovery
Physical architecture of sql server
MS-SQL SERVER ARCHITECTURE
Sql server basics
Sql Server Basics
Ms sql server architecture
SQL - RDBMS Concepts
DBMS and its Models
Oracle backup and recovery

What's hot (20)

ODP
Ms sql-server
PPTX
Introduction to database
PPTX
Nosql databases
PPTX
SQL for interview
PPTX
Introduction to Oracle Database
PPTX
12. oracle database architecture
PPTX
MDF and LDF in SQL Server
PPT
Files Vs DataBase
PPTX
Microsoft SQL Server internals & architecture
PPTX
Microsoft SQL Server Database Administration.pptx
PPTX
SQL Server High Availability and Disaster Recovery
PPT
Dbms presentaion
PPTX
Basic sql Commands
PPTX
Presentation slides of Sequence Query Language (SQL)
PDF
SQL Complete Tutorial. All Topics Covered
PPS
Oracle Database Overview
PPTX
Structured Query Language
PPTX
An Introduction To Oracle Database
PDF
Introduction to SQL
PPTX
2. Introduction-to-MSSQL-Server.pptx
Ms sql-server
Introduction to database
Nosql databases
SQL for interview
Introduction to Oracle Database
12. oracle database architecture
MDF and LDF in SQL Server
Files Vs DataBase
Microsoft SQL Server internals & architecture
Microsoft SQL Server Database Administration.pptx
SQL Server High Availability and Disaster Recovery
Dbms presentaion
Basic sql Commands
Presentation slides of Sequence Query Language (SQL)
SQL Complete Tutorial. All Topics Covered
Oracle Database Overview
Structured Query Language
An Introduction To Oracle Database
Introduction to SQL
2. Introduction-to-MSSQL-Server.pptx
Ad

Similar to Sql server basics (20)

PPT
SQL Server Basics Hello world iam here.ppt
PPTX
Microsoft sql server database administration
PPTX
MSSQL SERVER
PPT
database.ppt
DOC
Sql server-dba
PPT
Presentation1
PDF
SQL-Server Database.pdf
PPT
New features of sql server 2005
PPTX
Ms sql server
PPT
MS SQL Server.ppt
PPTX
Sql Server tips from the field
PPTX
Ebook6
PPTX
Sql interview-question-part-6
PPTX
Sql interview-question-part-6
PPTX
Sql interview question part 6
PPTX
Ebook6
PPTX
Kaashiv SQL Server Interview Questions Presentation
PPT
Sql server introduction to sql server
PDF
PT- Oracle session01
SQL Server Basics Hello world iam here.ppt
Microsoft sql server database administration
MSSQL SERVER
database.ppt
Sql server-dba
Presentation1
SQL-Server Database.pdf
New features of sql server 2005
Ms sql server
MS SQL Server.ppt
Sql Server tips from the field
Ebook6
Sql interview-question-part-6
Sql interview-question-part-6
Sql interview question part 6
Ebook6
Kaashiv SQL Server Interview Questions Presentation
Sql server introduction to sql server
PT- Oracle session01
Ad

Recently uploaded (20)

DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
cuic standard and advanced reporting.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Electronic commerce courselecture one. Pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
Big Data Technologies - Introduction.pptx
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
A Presentation on Artificial Intelligence
PDF
Modernizing your data center with Dell and AMD
PPTX
Cloud computing and distributed systems.
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
The AUB Centre for AI in Media Proposal.docx
Per capita expenditure prediction using model stacking based on satellite ima...
cuic standard and advanced reporting.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Mobile App Security Testing_ A Comprehensive Guide.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Electronic commerce courselecture one. Pdf
Unlocking AI with Model Context Protocol (MCP)
NewMind AI Weekly Chronicles - August'25 Week I
“AI and Expert System Decision Support & Business Intelligence Systems”
Big Data Technologies - Introduction.pptx
MYSQL Presentation for SQL database connectivity
A Presentation on Artificial Intelligence
Modernizing your data center with Dell and AMD
Cloud computing and distributed systems.
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
20250228 LYD VKU AI Blended-Learning.pptx

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.