In this video you will learn how to create contained database in SQL Server 2012 and SQL server 2014 using SQL Server Management studio as well as using T-SQL script. It also demonstrates what is contained databases, various option and properties of contained databases, how to configure SQL Server instance for contained databases, how to configure SQL Server database for partial contained database, what is partial contained database in SQL Server and how contained databases are isolated from normal databases in sql server.
Scripts used in this video for Contained Database in SQL Server
EXEC sys.sp_configure N'contained database authentication', N'1'
GO
RECONFIGURE WITH OVERRIDE
GO
CREATE DATABASE [MYContainedDB]
CONTAINMENT = PARTIAL
ON PRIMARY
( NAME = N'MYContainedDB', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL12.SQLPROD\MSSQL\DATA\MYContainedDB.mdf' , SIZE = 4096KB , FILEGROWTH = 1024KB )
LOG ON
( NAME = N'MYContainedDB_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL12.SQLPROD\MSSQL\DATA\MYContainedDB_log.ldf' , SIZE = 1024KB , FILEGROWTH = 10%)
GO
ALTER DATABASE [MYContainedDB] SET COMPATIBILITY_LEVEL = 120
GO
ALTER DATABASE [MYContainedDB] SET ANSI_NULL_DEFAULT OFF
GO
ALTER DATABASE [MYContainedDB] SET ANSI_NULLS OFF
GO
ALTER DATABASE [MYContainedDB] SET ANSI_PADDING OFF
GO
ALTER DATABASE [MYContainedDB] SET ANSI_WARNINGS OFF
GO
ALTER DATABASE [MYContainedDB] SET ARITHABORT OFF
GO
ALTER DATABASE [MYContainedDB] SET AUTO_CLOSE OFF
GO
ALTER DATABASE [MYContainedDB] SET AUTO_SHRINK OFF
GO
ALTER DATABASE [MYContainedDB] SET AUTO_CREATE_STATISTICS ON
GO
ALTER DATABASE [MYContainedDB] SET AUTO_UPDATE_STATISTICS ON
GO
ALTER DATABASE [MYContainedDB] SET CURSOR_CLOSE_ON_COMMIT OFF
GO
ALTER DATABASE [MYContainedDB] SET CURSOR_DEFAULT GLOBAL
GO
ALTER DATABASE [MYContainedDB] SET CONCAT_NULL_YIELDS_NULL OFF
GO
ALTER DATABASE [MYContainedDB] SET NUMERIC_ROUNDABORT OFF
GO
ALTER DATABASE [MYContainedDB] SET QUOTED_IDENTIFIER OFF
GO
ALTER DATABASE [MYContainedDB] SET RECURSIVE_TRIGGERS OFF
GO
ALTER DATABASE [MYContainedDB] SET DISABLE_BROKER
GO
ALTER DATABASE [MYContainedDB] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO
ALTER DATABASE [MYContainedDB] SET DATE_CORRELATION_OPTIMIZATION OFF
GO
ALTER DATABASE [MYContainedDB] SET PARAMETERIZATION SIMPLE
GO
ALTER DATABASE [MYContainedDB] SET READ_COMMITTED_SNAPSHOT OFF
GO
ALTER DATABASE [MYContainedDB] SET READ_WRITE
GO
ALTER DATABASE [MYContainedDB] SET RECOVERY FULL
GO
ALTER DATABASE [MYContainedDB] SET MULTI_USER
GO
ALTER DATABASE [MYContainedDB] SET PAGE_VERIFY CHECKSUM
GO
ALTER DATABASE [MYContainedDB] SET DEFAULT_FULLTEXT_LANGUAGE = 1033
GO
ALTER DATABASE [MYContainedDB] SET DEFAULT_LANGUAGE = 1033
GO
ALTER DATABASE [MYContainedDB] SET NESTED_TRIGGERS = ON
GO
ALTER DATABASE [MYContainedDB] SET TRANSFORM_NOISE_WORDS = OFF
GO
ALTER DATABASE [MYContainedDB] SET TWO_DIGIT_YEAR_CUTOFF = 2049
GO
ALTER DATABASE [MYContainedDB] SET TARGET_RECOVERY_TIME = 0 SECONDS
GO
ALTER DATABASE [MYContainedDB] SET DELAYED_DURABILITY = DISABLED
GO
USE [MYContainedDB]
GO
IF NOT EXISTS (SELECT name FROM sys.filegroups WHERE is_default=1 AND name = N'PRIMARY') ALTER DATABASE [MYContainedDB] MODIFY FILEGROUP [PRIMARY] DEFAULT
GO
Scripts used in this video for Contained Database in SQL Server
EXEC sys.sp_configure N'contained database authentication', N'1'
GO
RECONFIGURE WITH OVERRIDE
GO
CREATE DATABASE [MYContainedDB]
CONTAINMENT = PARTIAL
ON PRIMARY
( NAME = N'MYContainedDB', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL12.SQLPROD\MSSQL\DATA\MYContainedDB.mdf' , SIZE = 4096KB , FILEGROWTH = 1024KB )
LOG ON
( NAME = N'MYContainedDB_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL12.SQLPROD\MSSQL\DATA\MYContainedDB_log.ldf' , SIZE = 1024KB , FILEGROWTH = 10%)
GO
ALTER DATABASE [MYContainedDB] SET COMPATIBILITY_LEVEL = 120
GO
ALTER DATABASE [MYContainedDB] SET ANSI_NULL_DEFAULT OFF
GO
ALTER DATABASE [MYContainedDB] SET ANSI_NULLS OFF
GO
ALTER DATABASE [MYContainedDB] SET ANSI_PADDING OFF
GO
ALTER DATABASE [MYContainedDB] SET ANSI_WARNINGS OFF
GO
ALTER DATABASE [MYContainedDB] SET ARITHABORT OFF
GO
ALTER DATABASE [MYContainedDB] SET AUTO_CLOSE OFF
GO
ALTER DATABASE [MYContainedDB] SET AUTO_SHRINK OFF
GO
ALTER DATABASE [MYContainedDB] SET AUTO_CREATE_STATISTICS ON
GO
ALTER DATABASE [MYContainedDB] SET AUTO_UPDATE_STATISTICS ON
GO
ALTER DATABASE [MYContainedDB] SET CURSOR_CLOSE_ON_COMMIT OFF
GO
ALTER DATABASE [MYContainedDB] SET CURSOR_DEFAULT GLOBAL
GO
ALTER DATABASE [MYContainedDB] SET CONCAT_NULL_YIELDS_NULL OFF
GO
ALTER DATABASE [MYContainedDB] SET NUMERIC_ROUNDABORT OFF
GO
ALTER DATABASE [MYContainedDB] SET QUOTED_IDENTIFIER OFF
GO
ALTER DATABASE [MYContainedDB] SET RECURSIVE_TRIGGERS OFF
GO
ALTER DATABASE [MYContainedDB] SET DISABLE_BROKER
GO
ALTER DATABASE [MYContainedDB] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO
ALTER DATABASE [MYContainedDB] SET DATE_CORRELATION_OPTIMIZATION OFF
GO
ALTER DATABASE [MYContainedDB] SET PARAMETERIZATION SIMPLE
GO
ALTER DATABASE [MYContainedDB] SET READ_COMMITTED_SNAPSHOT OFF
GO
ALTER DATABASE [MYContainedDB] SET READ_WRITE
GO
ALTER DATABASE [MYContainedDB] SET RECOVERY FULL
GO
ALTER DATABASE [MYContainedDB] SET MULTI_USER
GO
ALTER DATABASE [MYContainedDB] SET PAGE_VERIFY CHECKSUM
GO
ALTER DATABASE [MYContainedDB] SET DEFAULT_FULLTEXT_LANGUAGE = 1033
GO
ALTER DATABASE [MYContainedDB] SET DEFAULT_LANGUAGE = 1033
GO
ALTER DATABASE [MYContainedDB] SET NESTED_TRIGGERS = ON
GO
ALTER DATABASE [MYContainedDB] SET TRANSFORM_NOISE_WORDS = OFF
GO
ALTER DATABASE [MYContainedDB] SET TWO_DIGIT_YEAR_CUTOFF = 2049
GO
ALTER DATABASE [MYContainedDB] SET TARGET_RECOVERY_TIME = 0 SECONDS
GO
ALTER DATABASE [MYContainedDB] SET DELAYED_DURABILITY = DISABLED
GO
USE [MYContainedDB]
GO
IF NOT EXISTS (SELECT name FROM sys.filegroups WHERE is_default=1 AND name = N'PRIMARY') ALTER DATABASE [MYContainedDB] MODIFY FILEGROUP [PRIMARY] DEFAULT
GO
How to Create Contained Database in SQL Server - MS DBA Tutorial
If you want to develop healthy eating habits, make small changes over a longer period. You'll need to focus on eating consistent, well-balanced meals and eating a variety of foods. https://tutuappx.com/
ReplyDeleteVidmate
I use delphi software language and I found useful tools for better work.
ReplyDelete