sql server - sql transaction log backup theory -


the more transaction log more confused. think lot of people wrong. want make sure understand theory. please correct thinking if it's wrong.

the log has nothing full or diff backups (no tied or related in way). log contains changes database since last log backup. hence log chain. make changes database, copy placed in log , marked when it's committed database. think of full history of changes since beginning of time. gets cleared out when backup transaction log (log). continuous stream/record of changes.

yes, log chain starts first full backup ever created. fulls after don't reset log chain.

  1. load memory part of database going modified
  2. copy change/query transaction log
  3. make change loaded part in memory
  4. commit disk , checkpoints log

full-log-log-log-log

let's make full backup. log backups after. first log contain changes committed before full backup. it's nature of logs. again, logs aren't related in way full or diffs. assume when restore full logs after, know start restoring comparing date , time of full backup logs. don't want recommit changes done in full backup. thought process.




let's have backup process:

full weekly/diff nightly/logs hourly

for brevity's sake, won't fill example tons of log backups. should point across.

full-log-log-log-log-diff-log-log-log-log-diff-log-log-log-log

  • let's need restore current backup. if diffs bad? can still restore point in time because full , logs good. don't need diffs. although restore might take days. xd

    full-log-log-log-log-diff-log-log-log-log-diff-log-log-log-log

  • let's need restore current backup. fastest way restore full backup , latest diff. finally, restore logs after diff. assume sql compare date/time of log diff , reapply correct changes. again, logs have nothing full or diffs. continuous stream/record of changes since last log backup (independent).

    questions:

  • do understand logs correctly?
  • are restore examples correct?
  • if log becomes corrupted how restart log chain? apparently, full backup doesn't restart log chain.

    there seems 20 different answers online conflict each other. nobody can straight.

    https://docs.microsoft.com/en-us/sql/relational-databases/backup-restore/transaction-log-backups-sql-server

    https://www.sqlskills.com/blogs/paul/a-sql-server-dba-myth-a-day-2030-restarting-a-log-backup-chain-requires-a-full-database-backup/


  • Comments

    Popular posts from this blog

    resizing Telegram inline keyboard -

    command line - How can a Python program background itself? -

    php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -