
Install, configure, monitor, and secure SQL Server 2022, create databases, and implement auditing, auto backups, and restore, while exploring core features for relational databases.
1. Pull the SQL Server 2022 (16.x) Linux container image from the Microsoft Container Registry.
docker pull mcr.microsoft.com/mssql/server:2022-latest
2. To run the Linux container image with Docker, you can use the following command from a bash shell or elevated PowerShell command prompt.
docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=abcdqwertf1124" -p 1432:1433 --name sql1 --hostname sql1 mcr.microsoft.com/mssql/server:2022-latest
Note: When connecting to the docker environment is "localhost, 1432". The comma must be used to separate the localhost from the port.
Learn about five system databases and their roles: resource, msdb, master, model, and tempdb, and how they store metadata, backup history, templates for new databases, and temporary workspace.
Explore how SQL Server stores data and logs in data files and log files, including primary and secondary files (MDF), and how file groups and alter database manage storage.
Fixed roles
The fixed server roles are applied serverwide, and there are several predefined server roles:
SysAdmin: Any member can perform any action on the server.
ServerAdmin: Any member can set configuration options on the server.
SetupAdmin: Any member can manage linked servers and SQL Server startup options and tasks.
Security Admin: Any member can manage server security.
ProcessAdmin: Any member can kill processes running on SQL Server.
DbCreator: Any member can create, alter, drop, and restore databases.
DiskAdmin: Any member can manage SQL Server disk files.
BulkAdmin: Any member can run the bulk insert command.
Predefined database roles
You may need to create your own, but you have access to several predefined database roles:
db_owner: Members have full access.
db_accessadmin: Members can manage Windows groups and SQL Server logins.
db_datareader: Members can read all data.
db_datawriter: Members can add, delete, or modify data in the tables.
db_ddladmin: Members can run dynamic-link library (DLL) statements.
db_securityadmin: Members can modify role membership and manage permissions.
db_bckupoperator: Members can back up the database.
db_denydatareader: Members can’t view data within the database.
db_denydatawriter: Members can’t change or delete data in tables or views.
Configure a server audit in SQL Server 2022, set queue delay and file destination, enable server and database audit specifications for login, backup, and failure events, and review logs.
Identify columns that may hold sensitive data using data discovery and classification in SQL Server Management Studio, view the schema, classify data, and save recommendations to generate a report.
Learn the principles of backup and restore for SQL Server databases, and implement a well-planned strategy to protect data and minimize risk of loss.
Learn how to perform reliable SQL Server backups and restores, including full, differential, and transaction log restores, point-in-time recovery, and upgrade implications.
SQL Server Agent uses SQL Server to store job information. Jobs contain one or more job steps. Each step contains its own task, for example, backing up a database.
SQL Server Agent can run a job on a schedule, in response to a specific event, or on demand. For example, if you want to back up all the company servers every weekday after hours, you can automate this task. Schedule the backup to run after 22:00 Monday through Friday. If the backup encounters a problem, SQL Server Agent can record the event and notify you.
Create a SQL Server Agent job to insert data into the time tracker table every minute, using a T-SQL step on the demo DB and configure schedule and notifications.
Configure and test SQL Server database mail by creating an email profile, adding an SMTP account (gmail), setting profile security, and sending a test email.
Automate daily full backups with SQL Server maintenance plans via the maintenance wizard, store to disk, clean up backups older than four weeks, and generate reports.
Review SQL Server logs to troubleshoot configuration, startup issues, and trace flags; use SP_recycle_error_log to recycle logs, and view agent and database mail logs across seven logs.
DMVs are virtual tables that expose server state information in a structured manner, allowing database administrators to monitor and troubleshoot SQL Server instances. The lecture will cover the structure and usage of DMVs, and how they can be leveraged to gain insight into server health, performance, and resource utilization.
The following DBCC commands operate on an internal read-only database snapshot that the Database Engine creates. The snapshot prevents blocking and concurrency problems when these commands are executed. For more information, see Database Snapshots (SQL Server).
DBCC CHECKALLOC
DBCC CHECKCATALOG
DBCC CHECKDB
DBCC CHECKFILEGROUP
DBCC CHECKTABLE
When you execute one of these DBCC commands, the Database Engine creates a database snapshot and brings it to a transactionally consistent state. The DBCC command then runs the checks against this snapshot. After the DBCC command is completed, this snapshot is dropped.
SQL Server Activity Monitor is a lecture that focuses on exploring the capabilities of SQL Server Activity Monitor as a tool for monitoring and troubleshooting SQL Server instances.
The lecture will cover the various features of SQL Server Activity Monitor, including the ability to view real-time performance metrics, active processes, and resource usage. Attendees will learn how to use Activity Monitor to identify and diagnose performance bottlenecks, such as long-running queries or resource-intensive processes, and take corrective action.
Export a bacpac archive from on premise and import it to docker sql server. Connect via sql management studio and rename the database to adventureworks 2022 for azure migration.
In this lecture, we will cover how to effectively manage user permissions in SQL Server, including granting and revoking database access with expiration dates. We'll explore creating a central UserPermissions table to track user permissions, and implementing stored procedures for granting access (GrantDatabaseLoginAccess) and revoking expired permissions (RevokeExpiredPermissions).
Master the first 90 days with a 30-60-90 roadmap: learn dev, qa, uat, and production environments, and document change while proving reliability through proactive problem solving.
This course has been designed to give you the knowledge and skills to become an expert SQL Server Database Administrator.
If you want to become a SQL database administrator, then this is the course for you.
Here is the course outline:
Section 1 - Introduction
Introduction
What is SQL Server
Section 2 - Setting Up Your Environment
SQL Server Editions
Installing SQL Server 2022
Install Management Studio
SQL Server Configuration Manager
Working With SQL Server in Docker
Section 3 - Database Creation & Configuration
SQL Server System Databases
Database Storage Strategies
Capacity and growth considerations
Configuring Model Database
Creating a Database
SQL Server contained database
Section 4 - Securing Your SQL Server
Managing Users & Login
Managing Contained Users
Implementing Instance-Level Security
Implementing Database-Level Security
SQL Server Audit Specifications
Configuring Server and Database Audit
Data Discovery & Classification
SQL Vulnerability Assessment
Section 5: Backup & Restore
Introduction to Backup and Restore
Understanding Recovery Models
How to Perform Full Backups
How to Perform a Differential Backup
Transaction log backups
Performing Recovery
Backup Strategies
Section 6: Automating Maintenance Routines
What is SQL Server Job Agent
Automating Processes with SQL Server Agent
Configuring and Sending Database Mail
Automating database backups
Section 7: Performance & Monitoring
Reviewing server logs
Exposing Dynamic Management Views (DMVs)
Database Console Commands for SQL Server
SQL Server Activity Monitor
Indexes for performance tuning
Introduction to the SQL Server Query Store
Section 7: Migrate & Import Data
Introduction
Migrating Databases to Amazon Web Services (AWS)
Detaching and Attaching Databases to an Instance
Migrating to Azure and Docker using bacpac archive
Importing and exporting data
Who this course is for:
Anyone who wants to start a career in SQL database administration.
Anyone who wants to have complete SQL database training to get a job in IT
Anyone who wants to advance his/her career
College students looking to pursue database administration.
IT Infrastructure Professionals