Wednesday, July 21, 2021

SQL Server- Query to restore database with its file groups and log files

 -- > create a sample database

USE master

GO

 

CREATE DATABASE SampleDB

ON PRIMARY

  (NAME = SampleDB_file1,

    FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL12.SQL2014\MSSQL\data\SampleDB_1.mdf',

          SIZE = 100MB,         

          FILEGROWTH = 10%),

 FILEGROUP SampleDB_MemoryOptimized_filegroup CONTAINS MEMORY_OPTIMIZED_DATA

  ( NAME = SampleDB_MemoryOptimized,

    FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL12.SQL2014\MSSQL\data\SampleDB_MemoryOptimized')

 LOG ON

  ( NAME = SampleDB_log_file1,

    FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL12.SQL2014\MSSQL\data\SampleDB_1.ldf',

          SIZE = 100MB,         

          FILEGROWTH = 10%)

GO

No comments:

Post a Comment

Top 15 SQL interview questions for 2-5 years experienced

  1. What is the difference between UNION and UNION ALL? UNION: To select related information from two tables UNION command is used. It is s...