Tags
Advanced SQL Interview Questions and Answers, Advanced SQL tutorial pdf, any recommended websites for sql puzzles, Best SQL Puzzles, Buy SQL Server Interview Questions Book Online at Low Price, COmples tSQL puzzles, Complex SQL Challenges, complex sql statement(puzzle), Complex tsql, Complex TSQL Challenge, convert string to proper case in sql server, Divide rows into two columns, Download SQL Questions, Download SQL Server Interview Question in PDF, Download SQL SERVER Interview questions, Download SQL Server Interview questions and answers, download sql server interview questions and answers pdf, download sql server interview questions by Pawan Khowal, download sql server interview questions by Pawan Kumar, download sql server interview questions by Pawan Kumar Khowal, Download T-SQL Interview Questions, Free Download SQL SERVER Interview questions, Get Next Value Puzzle, Huge blank areas in database field, Improve SQL Skills, Interview Puzzles in SQL Server, Interview Qs.SQL SERVER Questions, Interview questions and Answers for MS SQL Server designing, Interview Questions and Answers For SQL, Interview questions on Joins, Interview Questions on SQL, Interview SQL Puzzles, InterviewQuestions, InterviewQuestions for SQL, Learn complex SQL, Learn SQL, Learn T-SQL, Microsoft SQL Server interview questions for DBA, MS SQL Server interview questions, MSBI Interview Questions, Objective Puzzle, Pawan, Pawan Khowal, Pawan Kumar, Pawan Kumar Khowal, PL/SQL Challenges, Puzzle SQL, puzzle sql developer, Puzzle SQl Server, Puzzles, PUzzles in SQL SERVER, Queries for SQL Interview, Remove Huge Multiple Spaces from a DB Fields, Remove Multiple Spaces from a DB Fields, Separate Int and char from a string column, Single Quote update SQL, SQL, SQL - The Pattern Puzzles, SQL 2012, SQL 2014, SQL 2014 Interview Questions, SQL Challenge, SQL Challenges, SQL Extreme Difficult Puzzle, SQL FAQ, SQL FAQs, sql group by only rows which are in sequence, SQL Interview Q & A, SQL Interview Questions, SQL Interview Questions - Part 2, SQL Interview Questions for SQL Professionals, SQL Joins, SQL Pattern Puzzles, SQL pl/sql puzzles, SQL prime number puzzle, SQL puzzle, SQL Puzzles, sql puzzles & answers, sql puzzles and answers free download, sql puzzles and answers pdf, sql puzzles for interview, sql puzzles oracle, SQL Queries, SQL Queries asked in interviews, SQL QUERY PUZZLES, SQL Query to Find Nth Highest Salary of Employee, SQL Questions, SQL Quiz, SQL Replace Puzzle, SQL Server - Common Interview Questions and Answers, SQL SERVER - Find Nth Highest Salary of Employee, SQL Server - General Interview Questions and Answers, sql server 2008 interview questions, SQL Server 2008 Interview Questions and Answers, SQL Server Database, SQL Server database developer interview questions and answers, sql server dba interview questions, SQL Server developer Interview questions and answers, SQL Server developer Interview questions with answers, SQL Server Developer T-SQL Interview Questions, SQL server filter index with LIKE and RIGHT function?, SQL Server Interview Puzzle, SQL SERVER Interview questions, SQL SERVER Interview questions & Answers, SQL Server Interview Questions - Part 1, SQL Server Interview questions and answers, SQL Server Interview Questions and Answers - Free PDF, SQL SERVER Interview questions and answers for experienced, sql server interview questions and answers for net developers, SQL Server Interview Questions And Answers.pdf, sql server interview questions by Pawan Khowal sql interview questions, SQL SERVER Interview questions pdf, SQL Server Interview Questions | MSBISKILLS.Com, SQL Server Interview Questions | MSBISKILLS.com Top 50 SQL Server Questions & Answers, SQL Server Interview Questions/Answers Part-1, SQL Server Puzzle, SQL SERVER Puzzles, SQL server Questions and Answers, SQL SERVER Tips, SQL Skills, SQL Sudoku, SQL Tips & Tricks, SQL Tips and Tricks, SQL Top clause, SQL Tough Puzzle, SQL Tricks, SQL Trikcy question, sql/database interview for puzzle sql developer, SQLBI Interview Questions, SQLSERVER, SUM of grouped COUNT in SQL Query, T SQL Puzzles, T-SQL Challenge, T-SQL Interview Questions | SQL Server Interviews and Jobs, T-SQL Puzzle, T-SQL Server Interview Questions, T-SQL Tricky Puzzles, The Status Puzzle, Top 10 Frequently Asked SQL Query Interview Questions, TOP 100 SQL SERVER INTERVIEW QUESTIONS QUERIES, Top 50 SQL Server Interview Question for Testers, Tough SQL Challenges, Tough SQL Puzzles, Tricky Questions, TSQL, TSQL Challenge, TSQL Challenges, TSQL Interview questions, TSQL Puzzle, TSQL Puzzles, TSQL Queries
NEW T-SQL FEATURES IN SQL SERVER 2017- I [ DBCC CLONEDATABASE ]
In this post we shall check out the new features Microsoft introduced in SQL Server 2016.
New feature – I | [ DBCC CLONEDATABASE ]
Microsoft introduced a new management command called DBCC CLONEDATABASE command in MS SQL SERVER 2017. This command will generate a clone of a database by using DBCC CLONEDATABASE. With DBCC CLONEDATABASE feature you can generate a clone of a database in order to investigate a performance issue related to a Query or Workload.
Cloning process:-
1. Creates a new destination database that uses the same file layout as the source but with default file sizes as the model database.
2. Creates an internal snapshot of the source database.
3. Copies the system metadata from the source to the destination database.
4. Copies all schema for all objects from the source to the destination database.
5. Copies statistics for all indexes from the source to the destination database.
Notes–
1. This new database can use used to investigate a performance issue related to the query optimizer.
2. The new DB is primarily intended for troubleshooting and diagnostic purposes.
3. Microsoft recommends detaching of the cloned database after the database is created.
4. DBCC CLONEDATABASE is not supported to be used as a production database.
5. The new cloned database created is ReadOnly, with no data. The most important point is that it will have Statistics.
6. As best practice suggested by Microsoft product team this clone Database is not supposed to remain in PROD database
, but can be moved to a Dev or Test box for further troubleshooting and diagnostic purposes.
On other SQL Versions–
You can get the same command in other versions also by installing the service packs.
Service Pack 4 | Microsoft SQL Server 2012 |
---|---|
Service Pack 2 | Microsoft SQL Server 2014 |
Service Pack 1 | Microsoft SQL Server 2016 |
Sample example for [ CREATE OR ALTER ]
Generate Sample Data
-- --Create a new Database CREATE DATABASE testPawan GO --Use the new database USE testPawan GO --Create a new table in the new database CREATE TABLE [dbo].[SplitStrings]( [Id] [int] NULL, [Vals] [varchar](100) NULL ) ON [PRIMARY] GO SET ANSI_PADDING OFF GO INSERT [dbo].[SplitStrings] ([Id], [Vals]) VALUES (1, N'a,b') GO INSERT [dbo].[SplitStrings] ([Id], [Vals]) VALUES (2, N'a') GO INSERT [dbo].[SplitStrings] ([Id], [Vals]) VALUES (3, N'b,3') GO INSERT [dbo].[SplitStrings] ([Id], [Vals]) VALUES (4, N'c,u') GO -- |
TableData
Id | Vals |
---|---|
1 | a,b |
2 | a |
3 | b,3 |
4 | c,u |
CLONEDATABASE Command
-- --CLONEDATABASE Command DBCC CLONEDATABASE ( 'testPawan' , 'NewPawan' ) GO -- |
Output
-- Database cloning for 'testPawan' has started with target as 'NewPawan'. Database cloning for 'testPawan' has finished. Cloned database is 'NewPawan'. Database 'NewPawan' is a cloned database. A cloned database should be used for diagnostic purposes only and is not supported for use in a production environment. DBCC execution completed. If DBCC printed error messages, contact your system administrator. -- |
The CLONEDATABASE command will create the new readonly database called NewPawan. Check out the details
Check Data in the new database table
-- USE NewPawan GO SELECT * FROM NewPawan.dbo.SplitStrings Id Vals ----------- ---------------------------------------------------------------------------------------------------- (0 rows affected) -- |
Refer below for more details-
Enjoy !!! Keep Learning
Pawan Khowal
Http://MSBISkills.com