SlideShare a Scribd company logo
R2
Configuring Files And Filegroups.
Transaction Logs.
Filestream data
Files and Filegroups
 Data within a database is stored on disk in one or more data files.
 SQL Server uses two different types of files:
 Data file responsible for the long-term storage of all the
data within a database
 Transaction log files storing all the transactions that are
executed against a database.
Every transaction is written to a transaction log file.
 Filegroups are a logical structure, defined within a database, that
map a database and the objects contained within a database, to
the data files on disk.
 Filegroups can contain more than one data file.
Files and Filegroups
New
Data
Memory
Buffer
Transaction
Log Data Filecheck pointing
background process
Data Manipulation within SQL Server:
(Continue…)
Files and Filegroups
 At the time that a file is added to a database, you specify the initial size of
the file.
 You can also specify a maximum size for the file.
 SQL Server automatically increases the size of the file when it is full of data.
 SQL Server uses a proportional fill algorithm.
 The proportional fill algorithm is designed to ensure that all files within a
filegroup reach the maximum defined capacity at the same time.
 The proportional fill algorithm is designed to allow a resize operation to occur
at a filegroup level.
(Continue…)
Files and Filegroups (Continue…)
File Groups
Files and Filegroups
 SQL Server uses three file extensions: .mdf, .ndf, and .ldf.
 The file extensions are nothing more than naming conventions,NO effect
on SQL server itself.
 A file with an .mdf extension generally is :
o The primary data file that is created within a database
o Associated with the primary filegroup.
o Contains all the system objects necessary to a database.
 The .ndf extension generally is:
o Secondary data files used for all other primary data files
o Some databases may not have any secondary data files, while
others have several secondary data files
 The .ldf extension generally is used for transaction logs.
o The transaction log records every change that occurs within a
database to persist all transactions to disk.
(Continue…)
Files and Filegroups (Continue…)
SQL Server files have two names :
 LOGICAL_FILE_NAME
 The logical_file_name is the name used to refer to the physical file
in all Transact-SQL statements.
 The logical file name must comply with the rules for SQL Server
identifiers
 Must be unique among logical file names in the database.
 OS_FILE_NAME
 The os_file_name is the name of the physical file including the
directory path.
 It must follow the rules for the operating system file names
Files and Filegroups (Continue…)
 Designing the data layer of a database begins with the database
creation.
 When you create a database, it should have three files and two
filegroups, You should have :
 A file with an .mdf extension within a filegroup named PRIMARY.
 A file with an .ndf extension in a filegroup with any name that you
choose.
 The transaction log with an .ldf extension.
 Notes :
SQL Server data and log files can be put on either FAT or NTFS file
systems. We recommend using the NTFS file system because the
security aspects of NTFS.
Files and Filegroups (Continue…)
 When the database is created, the primary filegroup is marked as the
default filegroup.
 After you create the database, you should mark the second filegroup as
default filegroup.
 Any created object placed on the second filegroup.
 Only the system objects for the database reside on the primary
filegroup.
ALTER DATABASE <database name> MODIFY FILEGROUP
<filegroup name> DEFAULT
 You can change the default filegroup by the following command:
Create Database & Filegroup
FILESTREAM
 The FILESTREAM feature allows you to associate files with a
database.
 The files are stored in a folder on the operating system, but are
linked directly into a database
 To store FILESTREAM data within a database, you need to specify
where the data will be stored
 You define the location for FILESTREAM data in a database by
designating a filegroup within the database to be used for storage
with the contains filestream property.
 The Filename property defined for a FILESTREAM filegroup
specifies the path to a folder.
(Continue…)
 A filestream.hdr file is created in the folder, which is a system file
used to manage the files subsequently written to the folder.
Tempdb Database
 SQL Server uses tempdb for worktables used in grouping/sorting
operations, worktables to support cursors, the version store supporting
snapshot isolation level, and overflow for table variables.
 Temporary tables are created in tempdb.
 Unlike user databases, there's no recovery process in tempdb.
 One reason to use a temporary table is to take the load off of a user
database when you need to persist temporary data.
 Temporary table names are prefixed with a number symbol (#) for local
temporary tables (which are visible only to the connection that created
them) OR (##) for global temporary tables (which are visible to all
connections).
Review
1- You have a reference database named OrderHistory, which should
not allow any data to be modified. How can you ensure, with the
least amount of effort, that users can only read data from the
database?
A. Add all database users to the db_datareader role.
B. Create views for all the tables and grant select permission only on the
views to database users.
C. Set the database to READ_ONLY.
D. Grant select permission on the database to all users and revoke insert,
update, and delete permissions from all users on the database.
1. Correct Answer: C
A) Incorrect: Members of the db_owner role are still able to change data
in the database.
B) Incorrect: Members of the db_owner role are still able to change data
in the database.
C) Correct: Unless the database is in READ_ONLY mode, members of
the db_owner role can still change data in the database.
D) Incorrect: Members of the db_owner role are still able to change data
in the database.
Answers
Sql server lesson3

More Related Content

What's hot

Files
FilesFiles
File organization
File organizationFile organization
File organization
RituBhargava7
 
File Systems
File SystemsFile Systems
File Systems
Shipra Swati
 
File system implementation
File system implementationFile system implementation
File system implementation
Rotract CLUB of BSAU
 
Chapter13
Chapter13Chapter13
Chapter13
gourab87
 
File organisation
File organisationFile organisation
File organisation
Suneel Dogra
 
File management
File managementFile management
File management
sangrampatil81
 
Unit ivos - file systems
Unit ivos - file systemsUnit ivos - file systems
Unit ivos - file systems
donny101
 
File Management in Operating System
File Management in Operating SystemFile Management in Operating System
File Management in Operating System
Janki Shah
 
File system Os
File system OsFile system Os
File system Os
Nehal Naik
 
Degonto file management
Degonto file managementDegonto file management
Degonto file management
Degonto Islam
 
File Management
File ManagementFile Management
File Management
Ramasubbu .P
 
File management
File managementFile management
File management
sumathiv9
 
ITFT_File system interface in Operating System
ITFT_File system interface in Operating SystemITFT_File system interface in Operating System
ITFT_File system interface in Operating System
Sneh Prabha
 
directory structure and file system mounting
directory structure and file system mountingdirectory structure and file system mounting
directory structure and file system mounting
rajshreemuthiah
 
File System in Operating System
File System in Operating SystemFile System in Operating System
File System in Operating System
Meghaj Mallick
 
File System Implementation
File System ImplementationFile System Implementation
File System Implementation
Abhishek Pachisia
 
File Management
File ManagementFile Management
File Management
ramya marichamy
 
File system structure
File system structureFile system structure
File system structure
sangrampatil81
 
10 File System
10 File System10 File System
10 File System
Dr. Loganathan R
 

What's hot (20)

Files
FilesFiles
Files
 
File organization
File organizationFile organization
File organization
 
File Systems
File SystemsFile Systems
File Systems
 
File system implementation
File system implementationFile system implementation
File system implementation
 
Chapter13
Chapter13Chapter13
Chapter13
 
File organisation
File organisationFile organisation
File organisation
 
File management
File managementFile management
File management
 
Unit ivos - file systems
Unit ivos - file systemsUnit ivos - file systems
Unit ivos - file systems
 
File Management in Operating System
File Management in Operating SystemFile Management in Operating System
File Management in Operating System
 
File system Os
File system OsFile system Os
File system Os
 
Degonto file management
Degonto file managementDegonto file management
Degonto file management
 
File Management
File ManagementFile Management
File Management
 
File management
File managementFile management
File management
 
ITFT_File system interface in Operating System
ITFT_File system interface in Operating SystemITFT_File system interface in Operating System
ITFT_File system interface in Operating System
 
directory structure and file system mounting
directory structure and file system mountingdirectory structure and file system mounting
directory structure and file system mounting
 
File System in Operating System
File System in Operating SystemFile System in Operating System
File System in Operating System
 
File System Implementation
File System ImplementationFile System Implementation
File System Implementation
 
File Management
File ManagementFile Management
File Management
 
File system structure
File system structureFile system structure
File system structure
 
10 File System
10 File System10 File System
10 File System
 

Similar to Sql server lesson3

Microsoft SQL Server - Files and Filegroups
Microsoft SQL Server - Files and FilegroupsMicrosoft SQL Server - Files and Filegroups
Microsoft SQL Server - Files and Filegroups
Naji El Kotob
 
6952234.ppt
6952234.ppt6952234.ppt
SQL Server 2012 - FileTables
SQL Server 2012 - FileTables SQL Server 2012 - FileTables
SQL Server 2012 - FileTables
Sperasoft
 
Hadoop
HadoopHadoop
Oracle tutorial
Oracle tutorialOracle tutorial
Oracle tutorial
Lalit Shaktawat
 
Hadoop distributed file system
Hadoop distributed file systemHadoop distributed file system
Hadoop distributed file system
srikanthhadoop
 
Sql introduction
Sql introductionSql introduction
Sql introduction
vimal_guru
 
Big data interview questions and answers
Big data interview questions and answersBig data interview questions and answers
Big data interview questions and answers
Kalyan Hadoop
 
OS_Ch12
OS_Ch12OS_Ch12
Ch12 OS
Ch12 OSCh12 OS
Ch12 OS
C.U
 
Chapter 12.pptx
Chapter 12.pptxChapter 12.pptx
Chapter 12.pptx
AsmaaFaried1
 
Network data storage
Network data storageNetwork data storage
Network data storage
Hadi Fadlallah
 
Bt0066 database management system1
Bt0066 database management system1Bt0066 database management system1
Bt0066 database management system1
Techglyphs
 
File and fat
File and fatFile and fat
File and fat
Vimal Madhale
 
File system
File systemFile system
File system
harleen_johal
 
File system
File systemFile system
File system
Harleen Johal
 
Intake 37 11
Intake 37 11Intake 37 11
Intake 37 11
Mahmoud Ouf
 
Comp practical
Comp practicalComp practical
Comp practical
Kritika Sharma
 
Hadoop Distributed File System for Big Data Analytics
Hadoop Distributed File System for Big Data AnalyticsHadoop Distributed File System for Big Data Analytics
Hadoop Distributed File System for Big Data Analytics
DrPDShebaKeziaMalarc
 
linux-file-system01.ppt
linux-file-system01.pptlinux-file-system01.ppt
linux-file-system01.ppt
MeesanRaza
 

Similar to Sql server lesson3 (20)

Microsoft SQL Server - Files and Filegroups
Microsoft SQL Server - Files and FilegroupsMicrosoft SQL Server - Files and Filegroups
Microsoft SQL Server - Files and Filegroups
 
6952234.ppt
6952234.ppt6952234.ppt
6952234.ppt
 
SQL Server 2012 - FileTables
SQL Server 2012 - FileTables SQL Server 2012 - FileTables
SQL Server 2012 - FileTables
 
Hadoop
HadoopHadoop
Hadoop
 
Oracle tutorial
Oracle tutorialOracle tutorial
Oracle tutorial
 
Hadoop distributed file system
Hadoop distributed file systemHadoop distributed file system
Hadoop distributed file system
 
Sql introduction
Sql introductionSql introduction
Sql introduction
 
Big data interview questions and answers
Big data interview questions and answersBig data interview questions and answers
Big data interview questions and answers
 
OS_Ch12
OS_Ch12OS_Ch12
OS_Ch12
 
Ch12 OS
Ch12 OSCh12 OS
Ch12 OS
 
Chapter 12.pptx
Chapter 12.pptxChapter 12.pptx
Chapter 12.pptx
 
Network data storage
Network data storageNetwork data storage
Network data storage
 
Bt0066 database management system1
Bt0066 database management system1Bt0066 database management system1
Bt0066 database management system1
 
File and fat
File and fatFile and fat
File and fat
 
File system
File systemFile system
File system
 
File system
File systemFile system
File system
 
Intake 37 11
Intake 37 11Intake 37 11
Intake 37 11
 
Comp practical
Comp practicalComp practical
Comp practical
 
Hadoop Distributed File System for Big Data Analytics
Hadoop Distributed File System for Big Data AnalyticsHadoop Distributed File System for Big Data Analytics
Hadoop Distributed File System for Big Data Analytics
 
linux-file-system01.ppt
linux-file-system01.pptlinux-file-system01.ppt
linux-file-system01.ppt
 

More from Ala Qunaibi

Sql server lesson13
Sql server lesson13Sql server lesson13
Sql server lesson13
Ala Qunaibi
 
Sql server lesson12
Sql server lesson12Sql server lesson12
Sql server lesson12
Ala Qunaibi
 
Sql server lesson12
Sql server lesson12Sql server lesson12
Sql server lesson12
Ala Qunaibi
 
Sql server lesson11
Sql server lesson11Sql server lesson11
Sql server lesson11
Ala Qunaibi
 
Sql server lesson10
Sql server lesson10Sql server lesson10
Sql server lesson10
Ala Qunaibi
 
Sql server lesson9
Sql server lesson9Sql server lesson9
Sql server lesson9
Ala Qunaibi
 
Sql server lesson8
Sql server lesson8Sql server lesson8
Sql server lesson8
Ala Qunaibi
 
Sql server lesson7
Sql server lesson7Sql server lesson7
Sql server lesson7
Ala Qunaibi
 
Sql server lesson6
Sql server lesson6Sql server lesson6
Sql server lesson6
Ala Qunaibi
 
Sql server lesson5
Sql server lesson5Sql server lesson5
Sql server lesson5
Ala Qunaibi
 
Sql server lesson4_v2
Sql server lesson4_v2Sql server lesson4_v2
Sql server lesson4_v2
Ala Qunaibi
 
Sql server lesson4
Sql server lesson4Sql server lesson4
Sql server lesson4
Ala Qunaibi
 
Sql server lesson2
Sql server lesson2Sql server lesson2
Sql server lesson2
Ala Qunaibi
 
الفروقات الفردية بين الطلاب كيف نفهمها
الفروقات الفردية بين الطلاب  كيف نفهمهاالفروقات الفردية بين الطلاب  كيف نفهمها
الفروقات الفردية بين الطلاب كيف نفهمها
Ala Qunaibi
 
صور
صورصور
صور
Ala Qunaibi
 
حوادث السير
حوادث السير حوادث السير
حوادث السير
Ala Qunaibi
 
المجموعة الشمسية
المجموعة الشمسيةالمجموعة الشمسية
المجموعة الشمسية
Ala Qunaibi
 

More from Ala Qunaibi (17)

Sql server lesson13
Sql server lesson13Sql server lesson13
Sql server lesson13
 
Sql server lesson12
Sql server lesson12Sql server lesson12
Sql server lesson12
 
Sql server lesson12
Sql server lesson12Sql server lesson12
Sql server lesson12
 
Sql server lesson11
Sql server lesson11Sql server lesson11
Sql server lesson11
 
Sql server lesson10
Sql server lesson10Sql server lesson10
Sql server lesson10
 
Sql server lesson9
Sql server lesson9Sql server lesson9
Sql server lesson9
 
Sql server lesson8
Sql server lesson8Sql server lesson8
Sql server lesson8
 
Sql server lesson7
Sql server lesson7Sql server lesson7
Sql server lesson7
 
Sql server lesson6
Sql server lesson6Sql server lesson6
Sql server lesson6
 
Sql server lesson5
Sql server lesson5Sql server lesson5
Sql server lesson5
 
Sql server lesson4_v2
Sql server lesson4_v2Sql server lesson4_v2
Sql server lesson4_v2
 
Sql server lesson4
Sql server lesson4Sql server lesson4
Sql server lesson4
 
Sql server lesson2
Sql server lesson2Sql server lesson2
Sql server lesson2
 
الفروقات الفردية بين الطلاب كيف نفهمها
الفروقات الفردية بين الطلاب  كيف نفهمهاالفروقات الفردية بين الطلاب  كيف نفهمها
الفروقات الفردية بين الطلاب كيف نفهمها
 
صور
صورصور
صور
 
حوادث السير
حوادث السير حوادث السير
حوادث السير
 
المجموعة الشمسية
المجموعة الشمسيةالمجموعة الشمسية
المجموعة الشمسية
 

Recently uploaded

Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
Dr. Mulla Adam Ali
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
B. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdfB. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdf
BoudhayanBhattachari
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
EduSkills OECD
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
Nguyen Thanh Tu Collection
 
Constructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective CommunicationConstructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective Communication
Chevonnese Chevers Whyte, MBA, B.Sc.
 
IGCSE Biology Chapter 14- Reproduction in Plants.pdf
IGCSE Biology Chapter 14- Reproduction in Plants.pdfIGCSE Biology Chapter 14- Reproduction in Plants.pdf
IGCSE Biology Chapter 14- Reproduction in Plants.pdf
Amin Marwan
 
Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
Krassimira Luka
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
Jyoti Chand
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
imrankhan141184
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
Himanshu Rai
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
MysoreMuleSoftMeetup
 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
HajraNaeem15
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 

Recently uploaded (20)

Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
B. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdfB. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdf
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
 
Constructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective CommunicationConstructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective Communication
 
IGCSE Biology Chapter 14- Reproduction in Plants.pdf
IGCSE Biology Chapter 14- Reproduction in Plants.pdfIGCSE Biology Chapter 14- Reproduction in Plants.pdf
IGCSE Biology Chapter 14- Reproduction in Plants.pdf
 
Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 

Sql server lesson3

  • 1. R2
  • 2. Configuring Files And Filegroups. Transaction Logs. Filestream data
  • 3. Files and Filegroups  Data within a database is stored on disk in one or more data files.  SQL Server uses two different types of files:  Data file responsible for the long-term storage of all the data within a database  Transaction log files storing all the transactions that are executed against a database. Every transaction is written to a transaction log file.  Filegroups are a logical structure, defined within a database, that map a database and the objects contained within a database, to the data files on disk.  Filegroups can contain more than one data file.
  • 4. Files and Filegroups New Data Memory Buffer Transaction Log Data Filecheck pointing background process Data Manipulation within SQL Server: (Continue…)
  • 5. Files and Filegroups  At the time that a file is added to a database, you specify the initial size of the file.  You can also specify a maximum size for the file.  SQL Server automatically increases the size of the file when it is full of data.  SQL Server uses a proportional fill algorithm.  The proportional fill algorithm is designed to ensure that all files within a filegroup reach the maximum defined capacity at the same time.  The proportional fill algorithm is designed to allow a resize operation to occur at a filegroup level. (Continue…)
  • 6. Files and Filegroups (Continue…) File Groups
  • 7. Files and Filegroups  SQL Server uses three file extensions: .mdf, .ndf, and .ldf.  The file extensions are nothing more than naming conventions,NO effect on SQL server itself.  A file with an .mdf extension generally is : o The primary data file that is created within a database o Associated with the primary filegroup. o Contains all the system objects necessary to a database.  The .ndf extension generally is: o Secondary data files used for all other primary data files o Some databases may not have any secondary data files, while others have several secondary data files  The .ldf extension generally is used for transaction logs. o The transaction log records every change that occurs within a database to persist all transactions to disk. (Continue…)
  • 8. Files and Filegroups (Continue…) SQL Server files have two names :  LOGICAL_FILE_NAME  The logical_file_name is the name used to refer to the physical file in all Transact-SQL statements.  The logical file name must comply with the rules for SQL Server identifiers  Must be unique among logical file names in the database.  OS_FILE_NAME  The os_file_name is the name of the physical file including the directory path.  It must follow the rules for the operating system file names
  • 9. Files and Filegroups (Continue…)  Designing the data layer of a database begins with the database creation.  When you create a database, it should have three files and two filegroups, You should have :  A file with an .mdf extension within a filegroup named PRIMARY.  A file with an .ndf extension in a filegroup with any name that you choose.  The transaction log with an .ldf extension.  Notes : SQL Server data and log files can be put on either FAT or NTFS file systems. We recommend using the NTFS file system because the security aspects of NTFS.
  • 10. Files and Filegroups (Continue…)  When the database is created, the primary filegroup is marked as the default filegroup.  After you create the database, you should mark the second filegroup as default filegroup.  Any created object placed on the second filegroup.  Only the system objects for the database reside on the primary filegroup. ALTER DATABASE <database name> MODIFY FILEGROUP <filegroup name> DEFAULT  You can change the default filegroup by the following command:
  • 11. Create Database & Filegroup
  • 12. FILESTREAM  The FILESTREAM feature allows you to associate files with a database.  The files are stored in a folder on the operating system, but are linked directly into a database  To store FILESTREAM data within a database, you need to specify where the data will be stored  You define the location for FILESTREAM data in a database by designating a filegroup within the database to be used for storage with the contains filestream property.  The Filename property defined for a FILESTREAM filegroup specifies the path to a folder. (Continue…)  A filestream.hdr file is created in the folder, which is a system file used to manage the files subsequently written to the folder.
  • 13. Tempdb Database  SQL Server uses tempdb for worktables used in grouping/sorting operations, worktables to support cursors, the version store supporting snapshot isolation level, and overflow for table variables.  Temporary tables are created in tempdb.  Unlike user databases, there's no recovery process in tempdb.  One reason to use a temporary table is to take the load off of a user database when you need to persist temporary data.  Temporary table names are prefixed with a number symbol (#) for local temporary tables (which are visible only to the connection that created them) OR (##) for global temporary tables (which are visible to all connections).
  • 14. Review 1- You have a reference database named OrderHistory, which should not allow any data to be modified. How can you ensure, with the least amount of effort, that users can only read data from the database? A. Add all database users to the db_datareader role. B. Create views for all the tables and grant select permission only on the views to database users. C. Set the database to READ_ONLY. D. Grant select permission on the database to all users and revoke insert, update, and delete permissions from all users on the database.
  • 15. 1. Correct Answer: C A) Incorrect: Members of the db_owner role are still able to change data in the database. B) Incorrect: Members of the db_owner role are still able to change data in the database. C) Correct: Unless the database is in READ_ONLY mode, members of the db_owner role can still change data in the database. D) Incorrect: Members of the db_owner role are still able to change data in the database. Answers