当前位置:网站首页>本地备份和还原 SQL Server 数据库
本地备份和还原 SQL Server 数据库
2022-06-24 06:46:00 【Rusty well began】
1、若要对数据库进行备份,请执行以下步骤:
- 启动 SQL Server Management Studio (SSMS) 并连接到 SQL Server 实例。
- 在对象资源管理器中,展开“数据库”节点 。
- 右键单击数据库,将鼠标悬停在“任务”上,然后选择“备份…” 。
- 在“目标”下,确认备份路径正确。 如需更改路径,请选择“删除”以删除现有路径,然后选择“添加”来键入新路径 。 可通过省略号导航到特定文件。
- 选择“确定”以备份数据库。

或者,可以运行以下 Transact-SQL 命令来备份数据库。 该路径在你的计算机上可能有所不同:
USE [master];
GO
BACKUP DATABASE [SQLTestDB]
TO DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\Backup\SQLTestDB.bak'
WITH NOFORMAT, NOINIT,
NAME = N'SQLTestDB-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10;
GO
2、还原备份
要还原数据库,请按照以下步骤操作:
启动 SQL Server Management Studio (SSMS) 并连接到 SQL Server 实例。
在对象资源管理器中右键单击“数据库”节点,然后选择“还原数据库…” 。

选择“设备:”,然后选择省略号 (…) 来查找备份文件。
选择“添加”,然后导航到 .bak 文件所在的位置。 选择 .bak 文件,然后选择“确定”。
选择“确定”,关闭“选择备份设备”对话框 。
选择“确定”以还原数据库备份。

或者,可以运行以下 Transact-SQL 脚本来还原数据库。 该路径在你的计算机上可能有所不同:
USE [master];
GO
RESTORE DATABASE [SQLTestDB]
FROM DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\Backup\SQLTestDB.bak' WITH FILE = 1, NOUNLOAD, STATS = 5;
GO
3、清理资源
运行以下 Transact-SQL 命令来删除所创建的数据库及其在 msdb 数据库中的备份历史记录:
EXEC msdb.dbo.sp_delete_database_backuphistory @database_name = N'SQLTestDB'
GO
USE [master];
GO
DROP DATABASE [SQLTestDB];
GO
边栏推荐
- Obtain the package name, application name, icon, etc. of the uninstalled APK through packagemanager. There is a small message
- [Lua language from bronze to king] Part 2: development environment construction +3 editor usage examples
- [frame rate doubling] development and implementation of FPGA based video frame rate doubling system Verilog
- Continue to have a fever. Try the asynchronous operation of dart language. The efficiency is increased by 500%
- 【Django中运行scrapy框架,并将数据存入数据库】
- 相机标定(标定目的、原理)
- A summary of the posture of bouncing and forwarding around the firewall
- MaxCompute远程连接,上传、下载数据文件操作
- Reconfiguration of nebula integration testing framework based on BDD theory (Part 2)
- The describeregion interface of CVM is special and has two versions
猜你喜欢

Blue Bridge Cup seven segment code (dfs/ shape pressing + parallel search)
![(cve-2020-11978) command injection vulnerability recurrence in airflow DAG [vulhub range]](/img/33/d601a6f92b1b73798dceb027263223.png)
(cve-2020-11978) command injection vulnerability recurrence in airflow DAG [vulhub range]

Accessing user interface settings using systemparametersinfo

相機標定(標定目的、原理)
![[frame rate doubling] development and implementation of FPGA based video frame rate doubling system Verilog](/img/38/92486c92557e6e5a10a362eb2b7bdf.png)
[frame rate doubling] development and implementation of FPGA based video frame rate doubling system Verilog

图形技术之坐标转换

bjdctf_ 2020_ babystack
![[WUSTCTF2020]alison_ likes_ jojo](/img/a9/dcc6f524772cd0b8781289cbaef63f.png)
[WUSTCTF2020]alison_ likes_ jojo

Camera calibration (calibration purpose and principle)

exness:鲍威尔坚持抗通胀承诺,指出衰退是可能的
随机推荐
报错“Computation failed in `stat_summary_hex()`”
Session & cookie details
Climbing 10000 NASA pictures about Mars exploration, I found a secret
In the era of industrial Internet, there are no more centers in the real sense, and these centers just turn tangible into intangible
New features of PHP: bytecode cache and built-in server
只显示两行,超出部分省略号显示
Maxcompute remote connection, uploading and downloading data files
New ways to play web security [6] preventing repeated use of graphic verification codes
C code writing specification
线程的阻塞问题
When MFC uses the console, the project path cannot have spaces or Chinese, otherwise an error will be reported. Lnk1342 fails to save the backup copy of the binary file to be edited, etc
exness:鲍威尔坚持抗通胀承诺,指出衰退是可能的
What industries and scenarios can the easynvr/easygbs/easycvr platform developed by tsingsee green rhino video be used in?
简单的折射效果
[learn FPGA programming from scratch -42]: Vision - technological evolution of chip design in the "post Moorish era" - 1 - current situation
Selector (>, ~, +, [])
PNAs: Geometric renormalization reveals the self similarity of multi-scale human connectome
LeetCode 207:课程表(拓扑排序判断是否成环)
[mrctf2020] thousand layer routine
C escape character