Click here to Skip to main content
15,902,938 members
Home / Discussions / Database
   

Database

 
GeneralHelp in Stored Procedure sqlserver Pin
aaraaayen22-Jan-08 20:55
aaraaayen22-Jan-08 20:55 
GeneralRe: Help in Stored Procedure sqlserver Pin
pmarfleet22-Jan-08 22:07
pmarfleet22-Jan-08 22:07 
GeneralRe: Help in Stored Procedure sqlserver Pin
KANGAROO_22-Jan-08 22:25
KANGAROO_22-Jan-08 22:25 
GeneralRe: Help in Stored Procedure sqlserver Pin
andyharman22-Jan-08 22:34
professionalandyharman22-Jan-08 22:34 
GeneralRe: Help in Stored Procedure sqlserver Pin
aaraaayen22-Jan-08 23:31
aaraaayen22-Jan-08 23:31 
GeneralRe: Help in Stored Procedure sqlserver Pin
aaraaayen23-Jan-08 0:02
aaraaayen23-Jan-08 0:02 
GeneralAttaching an .MDF file without an LDF file Pin
ffowler22-Jan-08 11:25
ffowler22-Jan-08 11:25 
GeneralRe: Attaching an .MDF file without an LDF file Pin
Mike Dimmick23-Jan-08 12:40
Mike Dimmick23-Jan-08 12:40 
The way SQL Server works is that when you make a change to the database, the operation is immediately logged to the log file. It then makes the changes to the in-memory copy of the data, but does not immediately flush those changes back to the data file. It only does so when it needs to flush data out to reuse the buffer space, on idle, and when a checkpoint operation occurs. The checkpoint operation basically synchronizes the data and log, and is done frequently enough that the configured recovery interval can be achieved, that is, the time to recover from a system failure assuming that the data and log files are intact. The default recover interval is one minute, that is, a recovery should take around one minute to complete.

(In practice the log is also buffered to allow multiple log records to be written out in one operation. However, when you commit a transaction, the log records relating to that transaction have to be completely written to disk before SQL Server will proceed with the following statement or return to the client.)

The upshot of this lazy writing is that the data file may not be transactionally consistent. In fact, it probably isn't. Your best bet is to restore from a known-good backup - you will of course lose the operations that took place after the backup was made.

I'm not sure if you can reattach this database. What you probably should have done is run DBCC CHECKDB with one of the REPAIR options. You may be able to attach using CREATE DATABASE ... FOR ATTACH_REBUILD_LOG on SQL Server 2005; for SQL Server 2000 try sp_attach_db.

For the future, if you're not already doing so: it's considered best practice to keep your transaction logs on a separate disk (array) from the data, so that a failed data volume doesn't cause you to lose your transaction logs as well - remember that if you have logs but no data file you can back up the logs, restore a full database backup then restore the log backup to recover to the point of failure. In addition you can get some performance benefit because the disk head is typically over the place that the next block of log records need to be written - disk latency is governed by head seek time. If you plan to use RAID to protect your logs, go with RAID 1, mirroring - there is no benefit from striping (the writes are sequential and would simply target each disk in turn) and RAID 5 hurts write performance.


DoEvents: Generating unexpected recursion since 1991

QuestionSybase Linked Server Pin
mobius11100122-Jan-08 3:22
mobius11100122-Jan-08 3:22 
QuestionHow to use one sp's result in my new Sp Pin
pashitech21-Jan-08 18:26
pashitech21-Jan-08 18:26 
AnswerRe: How to use one sp's result in my new Sp Pin
Joe21-Jan-08 18:49
Joe21-Jan-08 18:49 
AnswerRe: How to use one sp's result in my new Sp Pin
andyharman22-Jan-08 0:13
professionalandyharman22-Jan-08 0:13 
GeneralCreating a User Defined Type For Time Pin
AAGTHosting21-Jan-08 13:46
AAGTHosting21-Jan-08 13:46 
GeneralRe: Creating a User Defined Type For Time Pin
PIEBALDconsult21-Jan-08 14:54
mvePIEBALDconsult21-Jan-08 14:54 
GeneralRe: Creating a User Defined Type For Time Pin
AAGTHosting21-Jan-08 20:35
AAGTHosting21-Jan-08 20:35 
GeneralAccess/Jet SQL (Uggh!!) Code Commenting Pin
martin_hughes21-Jan-08 10:52
martin_hughes21-Jan-08 10:52 
GeneralMysql strong typed dataset relations error. Pin
Y_R21-Jan-08 4:28
Y_R21-Jan-08 4:28 
Generalselect count values in sql Pin
eyeseetee21-Jan-08 4:01
eyeseetee21-Jan-08 4:01 
GeneralRe: select count values in sql Pin
Pete O'Hanlon21-Jan-08 4:52
mvePete O'Hanlon21-Jan-08 4:52 
Questionhow to use the keyword LIKE in the SQL query in C# statement Pin
mavii21-Jan-08 2:29
mavii21-Jan-08 2:29 
AnswerRe: how to use the keyword LIKE in the SQL query in C# statement Pin
Pete O'Hanlon21-Jan-08 4:56
mvePete O'Hanlon21-Jan-08 4:56 
AnswerRe: how to use the keyword LIKE in the SQL query in C# statement [modified] Pin
Michael Potter22-Jan-08 5:20
Michael Potter22-Jan-08 5:20 
GeneralUnable to see SQL Server Agent in Object Explorer of sqlserver 2005 Pin
Satish - Developer21-Jan-08 2:24
Satish - Developer21-Jan-08 2:24 
QuestionHow can we access a Table from a Database to the another DataBase Pin
John.L.Ponratnam21-Jan-08 1:15
John.L.Ponratnam21-Jan-08 1:15 
AnswerRe: How can we access a Table from a Database to the another DataBase Pin
pmarfleet21-Jan-08 2:02
pmarfleet21-Jan-08 2:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.