[Database] How to quickly clone (clone) a 20 TB SQL Server database

A few months ago, the Business Intelligence department came to discuss with the DBA, hoping to set a schedule for replicating the database to replicate about 20 TB of the database to another SQL Server every day for data scientists (Data Scientists) to use. That's right! It's 20 TB, and it's on a daily basis.

Setting backup and restore replication schedules sounds quite easy, but the problem is that if you use the built-in recovery method of SQL Server, the replication process of a 20 TB database is estimated to take about 26 hours to complete, but everyone has only every day 24 hours is not practical at all. Therefore, to achieve the mission, we must rely on the help of Storage Admin.

Let us think about how to use the magic of SAN storage snapshot in the replication process. Usually Storage Admin creates a volume (create a volume) from the SAN, cuts disk luns (cut disk luns) from the volume, and then attaches the disk luns (attach disk luns) to the virtual host (VM) of SQL Server and sets it as storage space (Such as E:\ ). The time of Snapshot 1GB is the same as the time of Snapshot 20 TB, and it takes about 30 to 60 seconds to complete. Before the snapshot, the system freezes the I/O of the SQL server, confirms that there is no database activity when storing the photo, and releases the I/O after the photo is taken to allow SQL Server to resume normal use.

After understanding the concept of the above storage, all database replication procedures are now summarized as follows.

First, create and install a new destination (destination) SQL server, and then create an empty replicated database. The name of the replicated database and the name of the data must be the same as the name of the source (source) database, and the user and permissions must be set . (For example, the MDF and LDF of the user database are both at E:.)

schedule:

  1. In source SQL server, snapshot E:\ drive (including MDF and LDF).

  2. Attach the snapshot obtained in step 1 to the destination (destination) SQL Server to replace the original E:.

  3. Restart the destination SQL server service.

In this way, the daily replication process of this 20 TB database was completed in 30 minutes.

#database#

Want to know more exciting content, come and pay attention to Sichuanese in Hong Kong

Guess you like

Origin blog.csdn.net/wlcs_6305/article/details/114922799