1. 程式人生 > >Backing up the tail

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

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 pe

USACO 2008 November Gold Cheering up the Cows /// MST oj24381

operator 一個 技術 -- def oot lap mina https 題目大意: 輸入n,p;n個點,p條路 接下來n行輸入c[];在各個點需要花費的時間 接下來p行輸入u,v,w;u點到v點的路需要花費時間w 求經過所有點且最後回到起點的最少花費時間 ht

[USACO08NOV]安慰奶牛Cheering up the Cow BZOJ 1232 Kruskal

Farmer John變得非常懶, 他不想再繼續維護供奶牛之間供通行的道路. 道路被用來連線N (5 <= N <= 10,000)個牧場, 牧場被連續地編號為1..N. 每一個牧場都是一個奶牛的家. FJ計劃除去P(N-1 <= P <= 100,000)條道路中儘可能多的道路, 但

Script" References MACLEAN‘s post Speed up the index creation.

  alter session set workarea_size_policy=MANUAL; alter session set db_file_multiblock_read_count=512; alter session set events '10351 trace name cont

【跟我學oracle18c】第四十三天:2 Day DBA:9.4 Backing Up Your Database

這一章節與oracle10g,11g無任何區別,僅轉載,不做實踐   9.4 Backing Up Your Database 節描述如何使用Oracle Recovery Manager (RMAN)備份資料庫。Oracle建議的磁碟備份策略提供了資料庫的有效每日備

Chatting it up with NestJS and Angular 6: Setting up the Project

Chatting it up with NestJS and Angular 6: Setting up the ProjectThis is the first article in a series covering the development of a chat application. Why a

Tales from the Tail — SEX with CBD

Client’s TaleShort and sweet. No, I’m not referring to my anal play, but rather my tale. I am 35 and have the most ridiculous irritable bowel disease (IBS)

Big data method could speed up the hunt for new drugs

Researchers have discovered a new anti-epileptic drug target and a whole new approach that promises to speed up the discovery of future drugs to treat debi

AI flags up the risk of fatal heart attacks years early

A new method of analysing heart scans with artificial intelligence (AI) is helping predict which patients are at risk of a deadly heart attack years before

Freeing up the sales force for selling, listening and automating with AI

Sales strategy and the future of customer engagement is in my DNA. As we all see and know, agility, automation and artificial intelligence is changing the

set up the price for incoming emails [beta] | Hacker News

ETHletter is a mail service - like Gmail, Yahoo mail or any other. But there's one big difference - during the email creation, you can set up the price for

Let’s clear up the confusion around the slice( ), splice( ), & split( ) methods in JavaScript

JavaScript built-in methods help us a lot while programming, once we understand them correctly. I would like to explain three of them in this article: the

Picking Up the Pieces

Two histories of MystMyst (1993) by Cyan and Brøderbund.The Myst 25th Anniversary Kickstarter raised $2.8 million from over 19,000 backers in May. Last mon

Speed up the Web Development Productivity with Selenium

Speed up the Web Development Productivity with SeleniumImagine that you are developing a website, and every time you restart, fixing bugs or adding feature

Female Disruptors: Purva Gupta is shaking up the AI world with emotionally

Thank you so much for joining us! What is your “backstory”?I started my career working with ad agency Saatchi & Saatchi, where I discovered early on th

Carbon Farmers Work to Clean Up the World’s Mess

This story is for Medium members.Continue with FacebookContinue with GoogleMedium curates expert stories from leading publishers exclusively for members (w

Don’t Fuck Up the Culture

Hey team,Our next team meeting is dedicated to Core Values, which are essential to building our culture. It occurred to me that before this meeting, I shou

Model paves way for faster, more efficient translations of more languages: New system may open up the world's roughly 7,000 spok

Translation systems from Google, Facebook, and Amazon require training models to look for patterns in millions of documents -- such as legal and political

Setting up the element14 IoT Learner Kit

Brian shows the unboxing of the element14 IoT Learner Kit. He then shows you how to assemble the components, including installing the SD card. To set

Entity Framework : The model backing the '' context has changed since the database was created

解決方案 als state exp 操作 enabled chan question migration 1.采用code first 做項目時,數據庫已經生成,後期修改數據庫表結構。再次運行時出現一下問題: Entity Framework : The model ba