how to backup and restore database of SQL Server
Back up
1,右键选中需要备份的数据库,Tasks-->Backup
2.General中,Destination,先remove掉之前的,然后再Add
需要注意的是,add的文件,必须要以.bak为后缀名,否则后面restore的话,不会显示出备份的文件
Restore
1.在数据库服务器的Databases上右键,选择Restore Database
1.1 General选项卡
1.1.1选择Device进行浏览,找到之前备份的文件。在查看文件的时候,默认是查看.bak文件。
不过也可以选择all files,那样可以看到所有的文件
1.1.2 General里面,Destination中的Database需要起一个不同的名字,这个名字是显示在ManagementStudio中的
选择路径之后,点击刷新的图标,然后下方会自动筛选
可以同时添加多个备份数据库,但是每一个数据库的restore plan是需要切换选项卡来进行独立设置的
1.2 Files选项卡
在General中,每切换一个数据库,Files选项卡中都需要独立配置一下
Logical File中的Rows Data和Log,都需要进行重命名,确保不重名。Restored as 这个列的里面的数据需要重命名
1.3 Options选项卡
取消勾选Tail-log backup
Restore failed
Restore failed
TITLE: Microsoft SQL Server Management Studio
------------------------------
Restore of database 'd_lisa_Program_dev01_v5000' failed. (Microsoft.SqlServer.Management.RelationalEngineTasks)
------------------------------
ADDITIONAL INFORMATION:
System.Data.SqlClient.SqlError: The tail of the log for the database "d_lisa_Program_dev01_v5000" has not been backed up. Use BACKUP LOG WITH NORECOVERY to backup the log if it contains work you do not want to lose. Use the WITH REPLACE or WITH STOPAT clause of the RESTORE statement to just overwrite the contents of the log. (Microsoft.SqlServer.SmoExtended)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=12.0.6024.0+((SQL14_PCU_Main).180907-0056)&LinkId=20476
------------------------------
BUTTONS:
OK
------------------------------
The error message you are getting tells you exactly what you need to do if you don't care about the existing database or log.
RESTORE DATABASE DAtabaseName FROM DISK = 'C:\DBName-Full Database Backup'
WITH REPLACE
In SQL Server Management Studio (Tasks > Restore), you can add the WITH REPLACE
option by opening the page "Options" on the left side and ticking "Overwrite the existing database".
官方文档
https://msdn.microsoft.com/en-us/library/ms187510(v=sql.110).aspx 仅针对于SQL Server 2012
https://docs.microsoft.com/en-us/sql/relational-databases/backup-restore/create-a-full-database-backup-sql-server 针对于SQLServer 2016
how to backup and restore database of SQL Server的更多相关文章
- 转载:Character data is represented incorrectly when the code page of the client computer differs from the code page of the database in SQL Server 2005
https://support.microsoft.com/en-us/kb/904803 Character data is represented incorrectly when the cod ...
- [Windows Azure] Managing SQL Database using SQL Server Management Studio
Managing Windows Azure SQL Database using SQL Server Management Studio You can use Windows Azure SQL ...
- 未能正确加载“VSTS for Database Professionals Sql Server Data-tier Application”包。(转)
今天费了九牛二虎之力,重转好了vs2010之后,打开解决方案,报出下面的错误: ---------------------------Microsoft Visual Studio---------- ...
- Get Error when restoring database in Sql Server 2008 R2
When I restored a database I got an error: "The backup set holds a backup of a database ot ...
- 【数据库-Azure SQL Database】SQL Server 如何将数据库备份到 Azure Storage
打开本地的 SQL Server Management Studio.首先创建 Credentials.命令如下: IF NOT EXISTS (SELECT * FROM sys.credent ...
- Import .bak file to a database in SQL server
https://stackoverflow.com/questions/1535914/import-bak-file-to-a-database-in-sql-server On SQL Serve ...
- Intellij Idea 配置database 连接SQL Server 2012
首先确认通过TCP IP来连接连接SQLServer 2012 确保 Server Authentication选择了SQL Server and Windows Authentication ...
- Restore database use sql `*.bak` file
1.第一步: 2.第二步: 3.第三布: 4.第四步:
- 打开visual studio 2010报错:未能正确加载“VSTS for Database Professionals Sql Server Data-tier Application”包
1 解决: 运行cmd 2 输入:regsvr32 %windir%\system32\jscript.dll
随机推荐
- IIFE 萌新学习笔记
立即执行函数表达式(IIFE) IIFE:Immediately-Invoked Function Expression(立即执行函数表达式) 一 常用写法: //经常使用的写法(function() ...
- luogub P4886 快递员(点分治)
记得是9月月赛题,当时做的时候觉得跟ZJOI2015幻想乡战略游戏那道题很像???,就写了,然后就写挂了... 我们发现假设当前点为根,我们算出\(m\)次询问中最远的\(a\)对点,如果这\(a\) ...
- 双系统 windows引导项添加
[root@MiWiFi-R2D-srv ~]# vi /etc/grub.d/40_custom #!/bin/sh exec tail -n +3 $0# This file provides a ...
- dashboard安装
1,安装程序包 # yum install -y openstack-dashboard 2,修改配置文件 # vim /etc/openstack-dashboard/local_settings ...
- 在Windows Server 2008 R2中删除网桥
How to remove a network bridge in Windows Server 2008 R2 症状: 删除网桥的时候,按理说应该在“网络连接”中选择要被删除的网桥,右键点击,然后选 ...
- Qt之图形(简笔画-绘制卡通蚂蚁)
简述 关于简笔画的介绍很多,有动物.水果.蔬菜.交通工具等,通常会对绘制一步步进行拆分.组合.然后绘制为我们想要的结果. 下面来介绍另外的一个种类:昆虫类-卡通蚂蚁. 简述 绘制 效果 源码 绘制 效 ...
- UILite-MFC/WTL/DirectUI界面库
之前写了UILite库介绍: http://blog.csdn.net/zhangzq86/article/details/9093945 如今UILite库能够使用git訪问了: https://g ...
- UVa 10069 Distinct Subsequences(大数 DP)
题意 求母串中子串出现的次数(长度不超过1后面100个0 显然要用大数了) 令a为子串 b为母串 d[i][j]表示子串前i个字母在母串前j个字母中出现的次数 当a[i]==b[j]&am ...
- 设置linux session 编码
设置linux session 编码 export LANG=zh_CN.utf-8
- HDU 5399 Too Simple (2015年多校比赛第9场)
1.题目描写叙述:点击打开链接 2.解题思路:本题分情况讨论.比赛时候真是想的太简单了.以为就是(n!)^(cnt-1). 终于无限WA. 本题有几个特殊情况须要额外推断. 首先,假设输入的时候.有某 ...