如何阅读.ldf文件 [英] How to read .ldf file
问题描述
Hello All,
我从测试数据库发生的灾难中恢复了数据库。我已经恢复了完整,差异和日志备份。但仍需要更新最后15分钟的交易。
我有发生灾难的数据库的.ldf文件。我只有那个.ldf文件。
我在想如果我能得到那些在过去15分钟内运行的SQL查询,那么我可以重新查询这些查询新数据库。
我们如何读取sql server 2005的.ldf文件以解压在特定时段内发生的DML操作。
在此先感谢
--Dr.Kitnajal
< pre lang =SQL> 选择 * 来自 :: fn_dblog( null , null )
此讨论可能帮助。
http://stackoverflow.com/questions/ 2080478 / read-sql-server-2005-ldf-file [ ^ ]
看看这个 post
这可以通过java项目完成
import java.io. *;
import java.util.ArrayList;
//这个类由susantha pathirana一次性使用问题,必须打开600个文件并比较客户端字符串与166客户端字符串并识别匹配的客户端
//没有遵循任何措辞标准所以不要抱怨:)
公共类测试{
public static void main(String [] args){
String fileName = ;
//放置文件的文件夹的名称
文件夹=新文件(E:\\Win2k3 \\Adam \ \);
文件[] listOfFiles = folder.listFiles();
int count = 0;
for(文件文件:listOfFiles){
if(file.isFile()){
// System.out.println(file.getName());
//要归档的文件名打开。
fileName =E:\\Win2k3 \\Adam\\+ file.getName();
//这将一次引用一行
String line = null;
试试{
// FileReader以默认编码读取文本文件。
FileReader fileReader = new FileReader(fileName);
//始终换行BufferedReader中的FileReader。
BufferedReader bufferedReader = new BufferedReader(
fileReader);
String arr [] = {adanu,aliat};
// String arr [] = {SH};
ArrayList< string> ; t2 = new ArrayList< string>();
//读取文件并逐行填充到数组列表
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])){
//字符串x =(t2.get(j));
//字符串y =(arr [k]);
System.out.println(t2 +,+(arr [k]));
System.out
.println(-------------- -------------------------------------------------- ----);
count ++;
打破外环;
}
}
}
//始终关闭文件。
bufferedReader.close();
} catch(FileNot FoundException ex){
System.out
.println(无法打开文件'+ fileName +');
} catch(IOException ex){
System.out.println(错误读取文件'+ fileName +');
//或者我们可以这样做:
// ex.printStackTrace();
}
}
}
System.out.println(选定的EP+计数);
}
}
< pre lang = java跨度>>
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解决方案select * from ::fn_dblog(null,null)
This discussion might help.
http://stackoverflow.com/questions/2080478/read-sql-server-2005-ldf-file[^]
Hi,
Look into this post
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);
}
}
<pre lang="java">
这篇关于如何阅读.ldf文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!