简体   繁体   English

如何在SQL Server 2012或更高版本中使用密码进行数据库备份?

[英]How can I take database backup with password in SQL Server 2012 or higher version?

I can create database backup with password in SQL Server 2000 to SQL Server 2008 R2. 我可以使用SQL Server 2000中的密码创建数据库备份到SQL Server 2008 R2。 But In SQL Server 2012 and 2016, I failed to create password protected database backups. 但是在SQL Server 2012和2016中,我无法创建受密码保护的数据库备份。

If backup has no password, then my database may be restored by anybody and then data confidentiality as well as database schema may be disclosed. 如果备份没有密码,那么任何人都可以恢复我的数据库,然后可以披露数据机密性和数据库架构。 Please help me if anybody knows how to take password protected backup in SQL Server 2012 and 2016. 如果有人知道如何在SQL Server 2012和2016中进行密码保护的备份,请帮助我。

I am using this script to create backup with password in SQL Server 2000, SQL Server 2008 as well as SQL Server 2008 R2: 我正在使用此脚本在SQL Server 2000,SQL Server 2008和SQL Server 2008 R2中使用密码创建备份:

Backup database DATABASENAME 
To Disk = 'd:\databasebackup.bak' 
with Password='dbpassword', INIT

This feature is deprecated. 不推荐使用此功能。 Please run the query below 请在下面运行查询

SELECT * FROM sys.dm_os_performance_counters   
WHERE instance_name like '%password%'

Basically you now have to use a certificate, once you have a certificate configured 基本上,一旦配置了证书,现在就必须使用证书

BACKUP DATABASE DATABASENAME To Disk = 'd:\databasebackup.bak' 
WITH  
  ENCRYPTION   
   (  
   ALGORITHM = AES_256,  
   SERVER CERTIFICATE = MyCert  
   ),  

Full details here as I pointed out in the comment https://docs.microsoft.com/en-us/sql/relational-databases/backup-restore/create-an-encrypted-backup 正如我在评论https://docs.microsoft.com/zh-cn/sql/relational-databases/backup-restore/create-an-encrypted-backup中指出的那样,此处提供了完整的详细信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM