{"id":1513,"date":"2014-02-07T09:00:00","date_gmt":"2014-02-07T17:00:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/dataplatforminsider\/2014\/02\/07\/differential-database-backup-with-memory-optimized-tables\/"},"modified":"2024-01-22T22:49:02","modified_gmt":"2024-01-23T06:49:02","slug":"differential-database-backup-with-memory-optimized-tables","status":"publish","type":"post","link":"https:\/\/www.microsoft.com\/en-us\/sql-server\/blog\/2014\/02\/07\/differential-database-backup-with-memory-optimized-tables\/","title":{"rendered":"Differential Database Backup with Memory-Optimized Tables"},"content":{"rendered":"
This blog describes how differential database backup is taken on database with one or more memory-optimized tables. For full database backups, please refer to Database Backup with Memory-Optimized Tables<\/a>.<\/p>\n For disk-based tables, the differential database backup includes only the pages that have changed since the last full database backup. \u00a0SQL Server 2014 supports differential backup on databases with memory-optimized tables. The differential backup of a database with memory-optimized tables contains the following data<\/p>\n Note, this optimization is only available in RTM. In CTP2, the differential database backup included all data\/delta files just like in full database backup.<\/p>\n Let us walk through an example showing the difference in size of full database backup and a differential database backup. The example is based on the following database and the table schema. Please refer to blog State-transition-of-checkpoint-files-in-databases-with-memory-optimized-tables<\/a>\u00a0 for details on the state of CFPs in the following examples.<\/p>\n CREATE DATABASE<\/span> imoltp<\/span><\/p>\n GO<\/span><\/p>\n ALTER DATABASE<\/span> imoltp ADD FILEGROUP<\/span> imoltp_mod CONTAINS<\/span> MEMORY_OPTIMIZED_DATA<\/span><\/p>\n ALTER DATABASE<\/span> imoltp ADD FILE<\/span> (name=‘imoltp_mod’<\/span>, filename<\/span>=‘c:dataimoltp_mod’<\/span>) TO FILEGROUP<\/span> imoltp_mod<\/span><\/p>\n GO<\/span><\/p>\n use<\/span> imoltp<\/span><\/p>\n go<\/span><\/p>\n — create the table with each row around 8K<\/span><\/p>\n CREATE TABLE<\/span> dbo.t_memopt (<\/span><\/p>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 c1 int<\/span> NOT NULL,<\/span><\/p>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 c2 char<\/span>(40) NOT NULL,<\/span><\/p>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 c3 char<\/span>(8000) NOT NULL,<\/span><\/p>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 CONSTRAINT<\/span> [pk_t_memopt_c1] PRIMARY KEY NONCLUSTERED HASH<\/span> (c1)<\/span><\/p>\n WITH<\/span> (BUCKET_COUNT<\/span> = 100000)<\/span><\/p>\n ) WITH<\/span> (MEMORY_OPTIMIZED<\/span> = ON<\/span>, DURABILITY<\/span> = SCHEMA_AND_DATA)<\/span><\/p>\n go<\/span><\/p>\n — load 8000 rows. This should load 5 16MB files<\/span><\/p>\n declare<\/span> @i int<\/span> = 0<\/span><\/p>\n while<\/span> (@i < 8000)<\/span><\/p>\n begin<\/span><\/p>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 insert<\/span> t_memopt values<\/span> (@i, ‘a’<\/span>, replicate<\/span> (‘b’<\/span>, 8000))<\/span><\/p>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 set<\/span> @i += 1;<\/span><\/p>\n end<\/span><\/p>\n — Do Manual checkpoint<\/span><\/p>\n Checkpoint<\/span><\/p>\n\n
\n
Example-1 Full and Differential database backup a database after loading 8000 rows and completing the manual checkpoint<\/h2>\n