Click here to Skip to main content
15,885,914 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello All ,

I recovered the database from the disaster happened on testing database. I have restored full , diff and log backup . But still need to update last 15 min transaction .

I have .ldf file of the database on which disaster happened . I have only that .ldf file.

I am thinking if I could get the SQL queries which was ran during those last 15 min then I can re rean those queries on new database.

How we can read on .ldf file of sql server 2005 to extract the DML operation happened within particular time slot .


Thanks in Advance
--Dr.Kitnajal
Posted

SQL
select * from ::fn_dblog(null,null)


This discussion might help.
http://stackoverflow.com/questions/2080478/read-sql-server-2005-ldf-file[^]
 
Share this answer
 
v2
Comments
dr.kitanjal 13-Jan-12 3:50am    
Thanks
I do not want to run query on database to read log.
I only have .ldf file in my pendrive and I want to read that file for extracting the DML operation
Hi,

Look into this post
 
Share this answer
 
Comments
dr.kitanjal 13-Jan-12 4:17am    
Thanks Jagahathan , but is this tool compatible with SQL SERVER 2005 ?
This can be done by java project


import java.io.*;
import java.util.ArrayList;

//This class written by susantha pathirana for one time use to problem that have to open 600 files and compare client string with 166 client string and identify matching clients
//Has not followed any cording standards so do not complain on that :)

public class Test {
public static void main(String[] args) {
String fileName = "";
// The name of the folder that placed files
File folder = new File("E:\\Win2k3\\Adam\\");
File[] listOfFiles = folder.listFiles();
int count = 0;

for (File file : listOfFiles) {
if (file.isFile()) {
// System.out.println(file.getName());
// The name of the file to open.
fileName = "E:\\Win2k3\\Adam\\" + file.getName();

// This will reference one line at a time
String line = null;

try {
// FileReader reads text files in the default encoding.
FileReader fileReader = new FileReader(fileName);

// Always wrap FileReader in BufferedReader.
BufferedReader bufferedReader = new BufferedReader(
fileReader);

String arr[] = { "adanu", "aliat" };

// String arr[] = {"SH"};
ArrayList<string> t2 = new ArrayList<string>();

// To read file and fill line by line to array list
while ((line = bufferedReader.readLine()) != null) {
t2.add(line);
}

outerloop: for (int j = 0; j < t2.size(); j++) {

for (int k = 0; k < arr.length; k++) {

if ((t2.get(j)).contains(arr[k])) {
// String x = (t2.get(j));
// String y = (arr[k]);
System.out.println(t2 + "," + (arr[k]));
System.out
.println("--------------------------------------------------------------------");
count++;
break outerloop;

}
}

}

// Always close files.
bufferedReader.close();
} catch (FileNotFoundException ex) {
System.out
.println("Unable to open file '" + fileName + "'");
} catch (IOException ex) {
System.out.println("Error reading file '" + fileName + "'");
// Or we could just do this:
// ex.printStackTrace();
}

}
}
System.out.println("Selected EPs" + count);

}
}
Java
<pre lang="java">
 
Share this answer
 
v2
Comments
Richard MacCutchan 5-Nov-15 5:26am    
Please do not post in dead questions; this one is nearlty four years old.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900