99 WAYS DATA COULD DIE
and what can we do about it.
I AM ARGELO
ROYCE
BAUTISTA
3 years in the IT Industry
Full-stack developer
Enjoys creating reports (SSRS, Excel, & Power Query)
Enjoys exploring Microsoft technologies and other related techs
YOUR DATA COULD DIE IF
SOMETHING BAD HAPPENS TO
YOUR:
Hardware
• Unintended critters
infesting the server
• Lightning, power surges,
and other electricity
related
• Acts of God
Software
• Virus
• Corruption*
• Hack
• Accidental execution of
TSQL Statements
FOR HARDWARE PROBLEMS:
REDUNDANCY
Main Server Redundant Server Cloud
FOR SOFTWARE PROBLEMS:
VIGILANCE
• Schedule your updates
• Do not use the server for personal urges
• Limit the privileges of accounts those that they need
• Be knowledgeable on the TSQL Statements that can kill
data
TSQL STATEMENTS THAT CAN
KILL DATA
DROP Statements
DROP DATABASE
DROP TABLE
DROP COLUMN
DMLs
UPDATE
DELETE FROM
TRUNCATE TABLE
MERGE
RESTORE
RESTORE DATABASE
FROM
RESTORE LOG
FROM
WHAT CAN WE DO?
Ways we could recover/prevent Data from dying because of
unintended execution of TSQL Statements
MITIGATIONS
Restore to latest
backup
RESTORE DATABASE TestDB
FROM TestDBbak
WITH FILE=1, NORECOVERY;
RESTORE LOG TestDB
FROM TestDBBak
WITH FILE=2, NORECOVERY,
STOPAT = ‘Feb 24, 2015 2:56 PM’;
Restore backup to a
new database and
get lost data from
there
RESTORE DATABASE NewDb
FROM TestDBbak
WITH FILE=1, NORECOVERY;
RESTORE LOG NewDb
FROM TestDBBak
WITH FILE=2, NORECOVERY,
STOPAT = ‘Feb 24, 2015 2:56 PM’;
SELECT *
FROM tblTest
WHERE TestID BETWEEN 10 AND 20
Use ApexSQL
Recover
USING APEXSQL RESTORE
NOTE
• ApexSQL Recover trial version only recovers the 10th
deleted row (only a single row).
• It is recommended that you prevent accidental deaths of
data by utilizing a free tool called SSMSBoost.
PREVENTING ACCIDENTS
USING SSMSBOOST
REFERENCES
• 9 ways to lose data
• https://www.brentozar.com/archive/2015/02/9-ways-to-lose-your-data/
• Finding Data Corruption
• https://www.simple-talk.com/sql/database-administration/finding-data-
corruption/
• Minimizing Data loss
• http://www.karaszi.com/sqlserver/info_minimizing_data_loss.asp
REFERENCES
• Recover SQL Database data deleted by accident
• http://blog.sqlauthority.com/2014/06/09/sql-server-how-to-recover-
sql-database-data-deleted-by-accident/
• RESTORE (Transact-SQL)
• https://msdn.microsoft.com/en-us/library/ms186858.aspx
• SQL Server Database Corruption
• http://sqlmag.com/blog/sql-server-database-corruption-part-xiii-
recap
REFERENCES
• When is data lost...
• http://serverfault.com/questions/497524/when-is-data-lost-
when-using-simple-recovery-model-in-sql-server
• ApexSQL
• http://www.apexsql.com
• SSMSBoost
• http://www.ssmsboost.com

PHISSUG S01E02: 99 way your data could die

  • 1.
    99 WAYS DATACOULD DIE and what can we do about it.
  • 2.
    I AM ARGELO ROYCE BAUTISTA 3years in the IT Industry Full-stack developer Enjoys creating reports (SSRS, Excel, & Power Query) Enjoys exploring Microsoft technologies and other related techs
  • 3.
    YOUR DATA COULDDIE IF SOMETHING BAD HAPPENS TO YOUR: Hardware • Unintended critters infesting the server • Lightning, power surges, and other electricity related • Acts of God Software • Virus • Corruption* • Hack • Accidental execution of TSQL Statements
  • 4.
    FOR HARDWARE PROBLEMS: REDUNDANCY MainServer Redundant Server Cloud
  • 5.
    FOR SOFTWARE PROBLEMS: VIGILANCE •Schedule your updates • Do not use the server for personal urges • Limit the privileges of accounts those that they need • Be knowledgeable on the TSQL Statements that can kill data
  • 6.
    TSQL STATEMENTS THATCAN KILL DATA DROP Statements DROP DATABASE DROP TABLE DROP COLUMN DMLs UPDATE DELETE FROM TRUNCATE TABLE MERGE RESTORE RESTORE DATABASE FROM RESTORE LOG FROM
  • 7.
    WHAT CAN WEDO? Ways we could recover/prevent Data from dying because of unintended execution of TSQL Statements
  • 8.
    MITIGATIONS Restore to latest backup RESTOREDATABASE TestDB FROM TestDBbak WITH FILE=1, NORECOVERY; RESTORE LOG TestDB FROM TestDBBak WITH FILE=2, NORECOVERY, STOPAT = ‘Feb 24, 2015 2:56 PM’; Restore backup to a new database and get lost data from there RESTORE DATABASE NewDb FROM TestDBbak WITH FILE=1, NORECOVERY; RESTORE LOG NewDb FROM TestDBBak WITH FILE=2, NORECOVERY, STOPAT = ‘Feb 24, 2015 2:56 PM’; SELECT * FROM tblTest WHERE TestID BETWEEN 10 AND 20 Use ApexSQL Recover
  • 9.
  • 10.
    NOTE • ApexSQL Recovertrial version only recovers the 10th deleted row (only a single row). • It is recommended that you prevent accidental deaths of data by utilizing a free tool called SSMSBoost.
  • 11.
  • 12.
    REFERENCES • 9 waysto lose data • https://www.brentozar.com/archive/2015/02/9-ways-to-lose-your-data/ • Finding Data Corruption • https://www.simple-talk.com/sql/database-administration/finding-data- corruption/ • Minimizing Data loss • http://www.karaszi.com/sqlserver/info_minimizing_data_loss.asp
  • 13.
    REFERENCES • Recover SQLDatabase data deleted by accident • http://blog.sqlauthority.com/2014/06/09/sql-server-how-to-recover- sql-database-data-deleted-by-accident/ • RESTORE (Transact-SQL) • https://msdn.microsoft.com/en-us/library/ms186858.aspx • SQL Server Database Corruption • http://sqlmag.com/blog/sql-server-database-corruption-part-xiii- recap
  • 14.
    REFERENCES • When isdata lost... • http://serverfault.com/questions/497524/when-is-data-lost- when-using-simple-recovery-model-in-sql-server • ApexSQL • http://www.apexsql.com • SSMSBoost • http://www.ssmsboost.com