transaction-log

SQL Server: What exactly is the backup_finish_date in master.sys.databases

久未见 提交于 2020-01-07 08:37:19
问题 When querying for the last backup_finish_date with the following query (from SQL Server: how to query when the last transaction log backup has been taken?): SELECT d.name, d.recovery_model_desc, MAX(b.backup_finish_date) AS backup_finish_date FROM master.sys.databases d LEFT OUTER JOIN msdb..backupset b ON b.database_name = d.name AND b.type = 'L' GROUP BY d.name, d.recovery_model_desc ORDER BY backup_finish_date DESC The backup_finish_date for all my databases is null, this is for DBs with a

How to get the logical name of the transaction log in SQL Server 2005

痴心易碎 提交于 2020-01-01 07:31:08
问题 I am trying to write a T-SQL routine that shrink the transaction log file using DBCC SHRINKFILE based on the logical name of the database. The DB_NAME() function gives you the logical name of the database. Is there an equivalent one for the transaction log? If not, is there some other way to get this information? The default name for the transaction logs is <<Database Name>>_log , but I would rather not rely on this. 回答1: You can use: SELECT name FROM sys.master_files WHERE database_id = db

TSQL Insert Transaction Log Filling up

允我心安 提交于 2019-12-25 07:47:02
问题 Need to generate some test data. This insert is 800,000 X 1,000. I know a lot but this is a real application where the random will be a calculated number. How can I break this up so the transaction log does not fill up? insert into sIDcrossMatch select docSVsys1.sID, docSVsys2.sID, Abs(Checksum(NewId())) % 100 As RandomInteger from docSVsys as docSVsys1 join docSVsys as docSVsys2 on docSVsys1.sID <> docSVsys2.sID where docSVsys1.sID < 1000 order by docSVsys1.sID, docSVsys2.sID It will insert

Update query on millions of rows fills the transaction log

一笑奈何 提交于 2019-12-25 04:29:41
问题 I need to update millions of rows as part of my next release, but doing so fills the transaction log and fails. I have a few ideas but I'm not a SQL expert so I'm sure there will be gotchas that I'm not aware of. Pertinent points: I need to hand a script over to the operations team so need a T-SQL method with no manual intervention. Apparently the transaction log gets recycled every 15 minutes. (I've thought about writing a loop with a try-catch with WAITFOR DELAY '00:15:00' in the catch

Reverse changes from transaction log in SQL Server 2008 R2?

∥☆過路亽.° 提交于 2019-12-23 00:52:08
问题 We have a SQL Server 2008 R2 database that backs up transaction logs every now and then. Today there was a big error in the database caused at around 12am... I have transaction logs up to 8am and then 12am - 16pm - etc. My question is: can I sort of reverse-merge those transaction logs into database, so that I return to the database state at 8am? Or is my best chance to recover an older full backup and restore all transaction logs up to 8am? The first option is preferable since full backup

SQL Server: how to query when the last transaction log backup has been taken?

只谈情不闲聊 提交于 2019-12-20 18:53:20
问题 I would like to query for all databases (in SQL Server 2008 instance) date when the last transaction log backup has been taken. How to do that? I know that this information is somewhere, but I don't know where. 回答1: SELECT d.name, MAX(b.backup_finish_date) AS backup_finish_date FROM master.sys.sysdatabases d LEFT OUTER JOIN msdb..backupset b ON b.database_name = d.name AND b.type = 'L' GROUP BY d.name ORDER BY backup_finish_date DESC 回答2: I recommend using this modified script so you can see

Where can I find the MySQL transaction log?

半城伤御伤魂 提交于 2019-12-18 10:59:15
问题 Does MySQL keep a transaction log and if so where could I find it? A number of rows have mysteriously been deleted from a table and I want to try and see how and when it occurred. 回答1: If you turned on - mysql can track binary log, which contains all the modifications (to be clear - it contains the queries that had changed something). But anyway, it is useless if you do not have the initial dump, which precedes the binlog turning on. Also i suppose if you made the dump and turned on binlog -

SQL Server: How do I increase the size of the transaction log?

你。 提交于 2019-12-13 12:06:49
问题 How do I increase the size of the transaction log? Is is also possible to temporarily increase the transaction log? Let's say I have the following scenario. I have a Delete operation that's too big for the current transaction log. I wan't to: Increase the transaction log (can I detect the current size?, can I tell how large I need the transaction log to be for my operation?) (Perform my operation) Backup the transaction log Restore the size of the transaction log. 回答1: Short answer: SQL 2k5

view the changed values after an update statement

落花浮王杯 提交于 2019-12-13 03:31:27
问题 just wondering if it is possible to view the changes of an update command on a table after it has happened? would the transaction log store this kind of information i.e this is the previous/current value this is the new/changed value not sure if this is possible. the server is ms sql 2008 回答1: The transaction log does contain the information, although decoding it is not trivial - I wrote a blog post with an example of decoding a simple update statement in the transaction log - http:/

Are ad-hoc read-only queries stored in SQL Server transaction log?

假装没事ソ 提交于 2019-12-12 11:45:36
问题 In SQL Server 2008 with the database recovery model configured to full , are queries such as select col1,col2,col3 from TableName logged to the transaction log files. In other words, can I determine what queries were run on the database on a particular day using the transaction log backups? 回答1: No. The transaction log does not record queries at all. It just records the info necessary to roll forward or roll back transactions (and a SELECT query would not generate any logged activity at all)