当前位置:网站首页>本地备份和还原 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
边栏推荐
- L2tp/ipsec one click installation script
- Exploration on Optimization of elastic expansion engineering
- The describeregion interface of CVM is special and has two versions
- Maxcompute remote connection, uploading and downloading data files
- 后疫情时代下,家庭服务机器人行业才刚启航
- 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
- How to select a third-party software testing company? 2022 ranking of domestic software testing institutions
- What is a CC attack? How to judge whether a website is attacked by CC? How to defend against CC attacks?
- MSSQL high permission injection write horse to Chinese path
- opencvsharp二值图像反色
猜你喜欢
![(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]

相机标定(标定目的、原理)
![[vulhub shooting range]] ZABBIX SQL injection (cve-2016-10134) vulnerability recurrence](/img/c5/f548223666d7379a7d4aaed2953587.png)
[vulhub shooting range]] ZABBIX SQL injection (cve-2016-10134) vulnerability recurrence

屏幕截图推荐—Snipaste

图形技术之管线概念

Session & cookie details
![[wustctf2020] climb](/img/b6/4a0582144c3125e7a0666bbbbfe29d.png)
[wustctf2020] climb

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

Ultra wideband pulse positioning scheme, UWB precise positioning technology, wireless indoor positioning application

Blue Bridge Cup seven segment code (dfs/ shape pressing + parallel search)
随机推荐
Obtain the package name, application name, icon, etc. of the uninstalled APK through packagemanager. There is a small message
阿里云全链路数据治理
Accessing user interface settings using systemparametersinfo
Deploy L2TP in VPN (Part 1)
【008】表格数据逐行筛选,跳出for循环及跳过本次循环思路_#VBA
Hubei College Upgraded to undergraduate - Hushi family planning department
相机标定(标定目的、原理)
Actual target shooting - skillfully use SMB to take down the off-line host
PNAs: Geometric renormalization reveals the self similarity of multi-scale human connectome
What should I pay attention to after the live broadcast system source code is set up?
bjdctf_ 2020_ babystack
buuctf misc [UTCTF2020]docx
Terminal network in VPN client connection settings of router
More than 60 million shovel excrement officials, can they hold a spring of domestic staple food?
Counter attack from outsourcing to big factories! Android has been developed for 5 years, and after a year of dormancy, it has tried to become an offer harvester. Tencent has a fixed salary of 20*15
屏幕截图推荐—Snipaste
[MySQL usage Script] clone data tables, save query data to data tables, and create temporary tables
RDD的执行原理
智能指针备注
L2tp/ipsec one click installation script