Backing up to NUL:

存储架构 2017-12-31

Backing up to NUL is like backing up directly to the trash

Linux folks have lots of jokes & fun t-shirts about /dev/null/ . The null device is a handy location to dump output to, when you don’t actually care about the output. In PowerShell, you can use Out-Null to dump extra output into the ether, and keep your logs or console clean.

Just like Linux has /dev/null/, Windows has NUL:

This means you can back up your database into the ether: BACKUP DATABASE MyDatabase TO DISK = 'NUL:'

That seems like a terrible idea!

It certainly isn’t going to help you if you need to restore. But it can be pretty helpful.

If you’re investigating slow backups, this can be a great tool to help in troubleshooting. By backing up to NUL, you can eliminate latency introduced by network & your backup storage. This effectively tells you if SQL Server is slow taking backups, or if the slowness is on the other side.

If you’re using Availability Groups, you need to take a full backup before you can add it to the AG. Especially for non-production environments, when I add a new database to an AG, I’ll back it up to NUL, then use direct seeding to initialize the database into the AG. It’ll get a real backup tomorrow, and that’s good enough for non-production databases.

Use caution

If you find yourself backing up to NUL often, question yourself about why.

If you’re doing it in Production, make sure you understand how it impacts your recovery plan.

Log backups to NUL will break log shipping, and break your log chain for point-in-time recovery. Full backups to NUL will still reset the differential bitmap (unless you use COPY_ONLY).

It can be a handy trick, but it can also be really dangerous. Proceed with caution.

责编内容by:Impatient DBA (源链)。感谢您的支持!

您可能感兴趣的

介绍一下渐进式 Web App(消息推送) – Part 3... 在第一篇: 介绍一下渐进式 Web App(离线) - Part 1 中我们介绍了一个典型的PWA应该是什么样子的,并且介绍了一下sercer worker和应用壳(app shell),在第二篇(...
How to choose a database for your microservices The past 10 years have seen the explosive growth of large-scale distributed systems. This trend has ...
Kubernetes 分布式应用部署和人脸识别 app 实例... 好的,伙计,让我们静下心来。下面将会是一个漫长但充满希望和有趣的旅程。 我将使用 Kubernetes 部署分布式应用程序。我试图创建一个类似于真实世界 app 的应用程序。显然...
How can I double my auto_increment&... Hey how would I be able to duplicate my only auto increment key to another key, basically I want my ...
Baidu音乐爬虫 Baidu音乐歌曲爬虫: 1、分析Baidu音乐歌曲下载接口,组装参数 2、判断是否需要登录 a、使用cookie b、使用selenium 3、歌曲信息页面分析 4、数据表设...