SQLServerCentral - www.sqlservercentral.com

A community of more than 1,600,000 database professionals and growing

Featured Contents

The Voice of the DBA

Backup Plans for Data Loss

The British Airways computer failure has been on my mind for a few weeks. It seems like such an epic failure in 2017 from a high public company that many, many people depend on. I still struggle to believe the power explanation, and really, I'm not sure there's any explanation that I would accept. At this point in our industry, there's no good reason for any large, global company to not be able to restart services inside of a couple hours in a DR site. In fact, it really shouldn't even take that long.

However, for many of us, we will have a failure or disaster at some point. It might not even be a hardware failure or system crash. It's much more likely that a user will cause an issue. As our systems grow larger, perhaps even more loaded with transactions, we might not always be able to easily separate out good data from bad, and I would expect we'll experience a restore.

For many of us this will mean we will lose some data from the system. Even with frequent log backups, we might end up with a short period where we can't recover data. Most of us should have conversations with business stakeholders on what the acceptable level of data loss is, and plan to meet those requirements. We should also have plans around how to rebuild data. I wouldn't recommend a full test on a system, but it might be worth a few conversations with those that deal with transactional data and discuss how the latest data might be recreated.

No one wants to lose data, and in many cases, there are ways to rebuild or recover the data with manual efforts. Perhaps your company has paper records, or maybe there's an audit trail that could be used to reconstruct actions. Maybe you rely on memory or even customers to provide information again. Today I'm wondering if you've thought about how you might recover data in a non-technical way and what methods you'd use.

Steve Jones from SQLServerCentral.com

Join the debate, and respond to today's editorial on the forums


The Voice of the DBA Podcast

Listen to the MP3 Audio ( 3.6MB) podcast or subscribe to the feed at iTunes and Libsyn. feed

The Voice of the DBA podcast features music by Everyday Jones. No relation, but I stumbled on to them and really like the music.

ADVERTISEMENT
Database DevOps

Continuous Delivery for SQL Server Databases

Spend less time managing deployment pain and more time adding value. Find out how with database DevOps

SQL Monitor

New SQL Monitor Reporting Module

SQL Monitor now includes a new Reporting module. It allows you to create customized reports, combining the individual server performance metrics available in SQL Monitor with summary information on your entire SQL Server estate. These reports can then be exported to pdf and emailed to you on a scheduled basis. Download SQL Monitor now and get a 14 day free trial

Featured Contents

 

How to Decipher sysschedules

Alan Jefferson from SQLServerCentral.com

Take the mystery out of sysschedules and interpret the data into a plain text format. More »


 

Statistics in SQL: Simple Linear Regressions

Additional Articles from SimpleTalk

Although linear regressions can get complicated, most jobs involving the plotting of a trendline are easy. Simple Linear Regression is handy for the SQL Programmer in making a prediction of a linear trend and giving a figure for the level probability for the prediction, and what is more, they are easy to do with the aggregation that is built into SQL. More »


 

SQL Server Row Count for all Tables in a Database

Additional Articles from MSSQLTips.com

Dattatrey Sindol explains the different ways in which you can get the row counts from all the tables in a SQL Server database. More »


 

From the SQLServerCentral Blogs - Orchestrating SQL Server with Kubernetes

James Anderson - The Database Avenger from SQLServerCentral Blogs

T-SQL Tuesday is a monthly event where SQL Server bloggers write a post based on a subject chosen by the... More »


 

From the SQLServerCentral Blogs - Changing default location for docker containers

Andrew Pruski from SQLServerCentral Blogs

A question that regularly comes up when I talk about containers is, “can you specify where the containers/images live on... More »

Question of the Day

Today's Question (by Steve Jones):

With ALTER SERVER CONFIGURATION in SQL Server 2016, what options can be set for the diagnostic log? (Choose 5)

Think you know the answer? Click here, and find out if you are right.


We keep track of your score to give you bragging rights against your peers.
This question is worth 1 point in this category: Administration.

We'd love to give you credit for your own question and answer.
To submit a QOTD, simply log in to the Contribution Center.

ADVERTISEMENT

Securing SQL Server: DBAs Defending the Database

Protect your data from attack by using SQL Server technologies to implement a defense-in-depth strategy, performing threat analysis, and encrypting sensitive data as a last line of defense against compromise. The multi-layered approach in this book helps ensure that a single breach doesn't lead to loss or compromise of your data that is confidential and important to the business. Get your copy from Amazon today.

Yesterday's Question of the Day

Yesterday's Question (by Carlo Romagnano):

 Select 2 correct answers about the result set of the OUTPUT clause

 CREATE TABLE a(cod VARCHAR(10),description VARCHAR(100)) CREATE TABLE b(cod VARCHAR(10),processed bit) GO INSERT INTO a SELECT * FROM (VALUES ('A','AAAA 1') ,('A','AAAA 2') ,('A','AAAA 3') ,('A','AAAA 4') ,('B','BBBB 1') ,('B','BBBB 2') ,('B','BBBB 3') ,('B','BBBB 4') ,('C','CCCC 1') ,('C','CCCC 2') ,('C','CCCC 3') ,('C','CCCC 4') ) AS V([cod],[description]) GO INSERT INTO b SELECT *,0 FROM (VALUES ('A') ,('B') ,('C') ,('D') ,('E') ) AS V([art]) GO UPDATE b SET processed = 1 OUTPUT deleted.*,a.* FROM b FULL JOIN a ON a.cod = b.cod WHERE b.processed = 0 

(How many rows returned and which values for the description column or any syntax error).

Answer:

  • 5 rows -- all rows from b because of FULL JOIN
  • description is any value matching with cod or NULL

Explanation:

5 rows returned because of FULL JOIN is the right answer.

The OUTPUT clause returns in the INSERTED and DELETED tables only the rows touched. Any joined table (with 1-n) always returns one row and you can't predict which one.

Ref: click here


So, if you run the UPDATE and the SELECT below with the same JOIN syntax, you'll see that the number of rows differs: 5 for the UPDATE and 14 for the SELECT.

 -- OUTPUT returns 5 rows UPDATE b SET processed = 1 OUTPUT deleted.*,a.* FROM b FULL JOIN a ON a.cod = b.cod WHERE b.processed = 0 -- SELECT with the same JOIN returns 14 rows SELECT * FROM b FULL JOIN a ON a.cod = b.cod WHERE b.processed = 1 

» Discuss this question and answer on the forums

Database Pros Who Need Your Help

Here's a few of the new posts today on the forums. To see more, visit the forums.

SQL Server 2016 : SQL Server 2016 - Administration

SQL2017 CTP - Does anyone know if I can do an inplace update from SQL2014 to SQL2017 Enterprise?


SQL Server 2016 : SQL Server 2016 - Development and T-SQL

Copy Table Data - I have a large table that I need to copy.  (insert into , select, from ) It brakes with the following...

How to get the monday of every week - example: today (6/20) tuesday Monday =6/19/2017 last week monday : 6/12/2017 Previous last week monday : 6/05/2017  I need to get all the monday's for...

SQL: HOW to concatenate two fields using trigger, - Hi All, I have SQL database called “S1”, and a table called “WORKORDER”, inside the table, I have two field...

Missing months group by - My data is like below currently- 7 columns below in first table. Date                Country       P1      P2      C1      C2       R1 2017-03-01       IN              0...

calculate percentile - I wanted to calculate the percentile Column from the given data in tsql. Here is the data , how can i get...


SQL Server 2014 : Administration - SQL Server 2014

find out who / what casued my database to increase in size? - So one of my production databases just grew 100 gb in 10 minutes during the lunch break... its been stable...

Report queque - Does SSRS keep track of reporting running queues? If it does, where I can find it? Thanks


SQL Server 2012 : SQL 2012 - General

Scalar function with source conditional to a parameter - My code is as follow ALTER FUNCTION . (@SC1 varchar(30)) RETURNS VARCHAR(3) AS BEGIN DECLARE @LB VARCHAR(3)         SELECT TOP 1 @LB=Buyer         FROM vPurch_Q       &n

Strange visual during restore - A colleague was restoring a large backup & asked me why there was a large, red X across the top of...

Permission denied error on object - Executing the query "PROC_ACTION_INSERT ?,?" failed with the following error: "Cannot find the object 'PROC_ACTION_INSERT ', because it does not exist or...


SQL Server 2008 : SQL Server 2008 - General

Performance: TRUNCATE vs. DROP/CREATE - I'm utterly perplexed by something I'm seeing. I'd always been under the impression that there should be negligible difference between...

get full path from sys.xp_dirtree - hello all. I have this script: IF OBJECT_ID('tempdb..#DirectoryTree') IS NOT NULL DROP TABLE #DirectoryTree; CREATE TABLE #DirectoryTree ( id int IDENTITY(1,1) ,subdirectory nvarchar(512) ,depth int ...


SQL Server 2008 : T-SQL (SS2K8)

Tsql Query help - Hi guys, I am working on a process where the query to be written seems little tricky to me. I have...

Split column value to rows. - Hi All, I was looking for code to split column value into separate rows.. Any help on this.. like for the example below...


Programming : General

alter table and removing IDENTITY property - Hi all Im having some trouble working out the syntax to alter a table column and remove the IDENTITY property from...


Programming : XML

Inserting data using OPENXML - Hi, I received am xml file from the customer (Around 2 gb data). The xml looks complex. I have to...

output to file of result of a SELECT...FOR XML - In the normal fashion (return result of a Select ... For XML Explicit to a file in SQL Query Analyzer) of...

ASP - Reaping the benefits of SQL 2000's FOR XML - There were a very interesting article on www.sqlservercentral.com, about using FOR XML for drop-down boxes, called "ASP - Reaping the benefits...


Data Warehousing : Integration Services

Expression needed for Midnight of previous day - How to get expression for yesterday and day before so that the time stamp resets *exactly to midnight*? I have  Yesterday gives...

This email has been sent to newsletter@newslettercollector.com. To be removed from this list, please click here.
If you have any problems leaving the list, please contact the webmaster@sqlservercentral.com.
This newsletter was sent to you because you signed up at SQLServerCentral.com.
Feel free to forward this to any colleagues that you think might be interested.
If you have received this email from a colleague, you can register to receive it here.
This transmission is ©2017 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved.
Contact: webmaster@sqlservercentral.com