What are mdf,ndf,ldf files and how to see the data in those
files?
Answer Posted / arunyadav007
For reading the log files (.ldf) an undocumented system
stored procedure sp_readerrorlog is there. This SP allows
you to read the contents of the SQL Server error log files
directly from a query window and also allows you to search
for certain keywords when reading the error file. This is
not new to SQL Server 2005, but this tip discusses how this
works for SQL Server 2005.
This is a sample of the stored procedure for SQL Server
2005. You will see that when this gets called it calls an
extended stored procedure xp_readerrorlog.
This procedure takes four parameters:
Value of error log file you want to read: 0 = current, 1 =
Archive #1, 2 = Archive #2, etc...
Log file type: 1 or NULL = error log, 2 = SQL Agent log
Search string 1: String one you want to search for
Search string 2: String two you want to search for to
further refine the results
If you do not pass any parameters this will return the
contents of the current error log.
Example 1
EXEC sp_readerrorlog 6
This statement returns all of the rows from the 6th
archived error log.
Example 2
EXEC sp_readerrorlog 6, 1, '2005'
This returns just 8 rows wherever the value 2005 appears.
Example 3
EXEC sp_readerrorlog 6, 1, '2005', 'exec'
This returns only rows where the value '2005' and 'exec'
exist.
Even though sp_readerrolog accepts only 4 parameters, the
extended stored procedure accepts at least 7 parameters.
If this extended stored procedure is called directly the
parameters are as follows:
Value of error log file you want to read: 0 = current, 1 =
Archive #1, 2 = Archive #2, etc...
Log file type: 1 or NULL = error log, 2 = SQL Agent log
Search string 1: String one you want to search for
Search string 2: String two you want to search for to
further refine the results
?
?
Sort order for results: N'asc' = ascending, N'desc' =
descending
| Is This Answer Correct ? | 15 Yes | 16 No |
Post New Answer View All Answers
Explain what is use of dbcc commands?
Where is my database stored on the hard disk in ms sql server?
Does index slows down insert statements?
What are some of the pros and cons of not dropping the sql server builtinadministrators group? : sql server security
What is a result set object returned by mssql_query()?
What is de-normalization in sql database administration? Give examples?
What gets stored inside msdb database?
What is use of except clause?
How can sql server instances be hidden? : sql server security
If you're given a raw data table, how would perform etl (extract, transform, load) with sql to obtain the data in a desired format?
What are the difference between clustered and a non-clustered index?
What new changes are being made in SQL Server?
wat wil hapn if we give the both read and deny read permission to user?
What is read committed?
Why transaction is important?