Backing up the tail
The tail of the transaction log usually refers to the contents of the database's transaction log that has not been backed up. Basically, every time you perform a transaction log backup, you are backing up the tail of the transaction log.
Then why all the fuss over this? Well, the complication starts when the database's data files are no longer available, perhaps due to a media failure. When this occurs, the next logical step is to back up the current transaction log, and apply this backup to the standby database. You can back up the transaction log even though the data files are no longer available, using the NO_TRUNCATE option e.g.
| BACKUP LOG AdventureWorks TO DISK = 'G:\Backups\AdventureWorks_log_tail.bak' WITH NO_TRUNCATE |
You can then use the resulting log backup to bring the standby database to the state the database was in before the failure.
| This is another good reason to place your transaction log files on different disks from the data files. If they were on the same disks, a disk failure would prevent you from taking a backup of the transaction log. |
Another complication is when your database is using the bulk-logged recovery model, and the current transaction log contains minimally logged transactions. In this situation, a transaction log backup needs to store the modified data pages (extents). If the data files are not available, you cannot back up the transaction log, even with the NO_TRUNCATE option.
Lastly, in SQL Server 2005 and above, every time you try to restore a database which already exists, is using the full or bulk-logged recovery models, and the transaction log contains active transactions, an error similar to the following is displayed:
| Server: Msg 3159, Level 16, State 1, Line 1 The tail of the log for the database "AdventureWorks" 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. Server: Msg 3013, Level 16, State 1, Line 1 RESTORE DATABASE is terminating abnormally. |
This is just SQL Server's way of telling you that there are log records in the transaction log that have not been backed up. If the current transaction log can be discarded, you can use the REPLACE option to tell SQL Server to ignore the current transaction log e.g.
| RESTORE DATABASE AdventureWorks FROM DISK = 'G:\Backups\AdventureWorks_full.bak' WITH REPLACE |
Backing up the tail的更多相关文章
- 转载:Restore SQL Server database and overwrite existing database
转载自:https://www.mssqltips.com/sqlservertutorial/121/restore-sql-server-database-and-overwrite-existi ...
- 数据备份与恢复 半持久化 全持久化 fork aof rdb Backing up Disaster recovery 备份 容灾
Redis数据备份与恢复 - 流年晕开时光 - 博客园 https://www.cnblogs.com/deny/p/11531355.html Redis数据备份与恢复 Redis所有数据都是保存在 ...
- head/tail实现
只实现了head/tail的基本功能,默认显示十行及-n参数. 一.使用带缓冲的系统调用. write/read等系统调用是不带缓冲的,可以包装一层,使其带缓冲. t ...
- REDHAT一总复习1 输出重定向及head tail的用法
1.使用bash命令,在server机上完成以下任务.(考点是:head tail的使用) .显示/usr/bin/clean-binary-files文件的前12行,并将其输出到/home/stu ...
- tail命令详解
搜索 纠正错误 添加实例 tail 在屏幕上显示指定文件的末尾若干行 补充说明 tail命令 用于输入文件中的尾部内容.tail命令默认在屏幕上显示指定文件的末尾10行.如果给定的文件不止一个,则在 ...
- Linux命令详解之—tail命令
tail命令也是一个非常常用的文件查看类的命令,今天就为大家介绍下Linux tail命令的用法. 更多Linux命令详情请看:Linux命令速查手册 Linux tail命令主要用来从指定点开始将文 ...
- linux命令之tail
tail用于输出文件末尾部分.一个比较有用的功能是tail + grep实现类似于安卓开发时调试使用的logcat,具体操作是: 一般我是用SecureCRT连接linux,然后使用SecureCRT ...
- PHP实现linux命令tail -f
PHP实现linux命令tail -f 今天突然想到之前有人问过我的一个问题,如何通过PHP实现linux中的命令tail -f,这里就来分析实现下. 这个想一想也挺简单,通过一个循环检测文件,看文件 ...
- tail -f 和 -F 的用法
tail -f 和 -F 的用法 Tai 2010-08-16 16:03:18 -f 是--follow[=HOW]的缩写, 可以一直读文件末尾的字符并打印出来."[=HOW]" ...
随机推荐
- 单例模式(Singleton-Pattern)百媚生
1 动机 对于系统中的某些类来说,只有一个实例很重要,例如,一个系统中可以存在多个打印任务,但是只能有一个正在工作的任务;一个系统只能有一个窗口管理器或文件系统;一个系统只能有一个计时工具或ID(序号 ...
- 【Jmeter】配置不同业务请求比例,应对综合场景压测
背景 在进行综合场景压测时,遇到了如何实现不同的请求所占比例不同的问题. 有人说将这些请求分别放到单独的线程组下,然后将线程组的线程数按照比例进行配置. 这种方法不是很好,因为服务器对不同的请求处理能 ...
- $.proxy用法详解
jQuery中的$.proxy官方描述为: 描述:接受一个函数,然后返回一个新函数,并且这个新函数始终保持了特定的上下文语境. 官方API: jQuery.proxy( function, conte ...
- UVA-10384 The Wall Pushers (IDA*)
题目大意:走迷宫,遇到墙时可以推着墙走,但墙后还是墙时便不能推.求出一条任意的最短路径. 题目分析:这道题出的比较人性,输入的时候便是将四周的墙用二进制数表示好了,其实这样减轻了做题人的负担.IDA* ...
- The web application you are attempting to access on this web server is currently unavailable.......
今天去服务器安装了个.net 4.0 framework(原本有1.0和2.0的),配置好站点后,选择版本为4.0,访问出错,错误代码如下 Server Application Unavailable ...
- vue 表单校验 一
表单校验 一 最近使用elment-ui表单进行各种校验,心力交瘁,依旧不能很好地解决,先列出自己的归类,后期一个个攻破 表单校验史 表单校验准则 参考资源 1 2 3 4 5 第一种 显示明确的错误 ...
- 054——VUE中vue-router之实例讲解定义一下单页面路由
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- JMeter VS LoadRunner
对比项 JMeter LoadRunner 安装 简单,下载解压即可 复杂,安装包大于1GB,安装时间较久 录制/回放模式 支持 支持 测试协议 偏少,但用户可自行拓展 较多,用户不可自行拓展 分布式 ...
- Python3.5 源码安装 Ubuntu16.04环境
安装源码编译所需的各种依赖库:(Ubuntu16.04环境下) sudo apt-get install zlib1g-dev libbz2-dev libssl-dev libncurses5-de ...
- Linux系统下 MYSQL数据库中的数据库文件在本机内迁移 (需暂停服务的方式)
Linux系统下 MYSQL数据库中的数据库文件在本机内迁移 本机采用Ubuntu16.04系统,tar方式安装MySQL5.7.21 数据库安装文件夹为 /home/devil/mysql 现 ...