Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Trace file error Expand / Collapse
Author
Message
Posted Tuesday, April 9, 2013 10:36 PM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Sunday, April 27, 2014 7:55 PM
Points: 218, Visits: 556
Dear all

I am getting following error
"Encountered an error or an unexpected end of trace file 'c:\Program Files\Microsoft SQL Server\MSSQL10_50.LOCAL2008EXPRESS\MSSQL\Log\log_31.trc'."

How do i correct it?


I get it when i run following script -

DECLARE @filename NVARCHAR(1000);
DECLARE @bc INT;
DECLARE @ec INT;
DECLARE @bfn VARCHAR(1000);
DECLARE @efn VARCHAR(10);

-- Get the name of the current default trace
SELECT @filename = CAST(value AS NVARCHAR(1000))
FROM ::fn_trace_getinfo(DEFAULT)
WHERE traceid = 1 AND property = 2;

-- rip apart file name into pieces
SET @filename = REVERSE(@filename);
SET @bc = CHARINDEX('.',@filename);
SET @ec = CHARINDEX('_',@filename)+1;
SET @efn = REVERSE(SUBSTRING(@filename,1,@bc));
SET @bfn = REVERSE(SUBSTRING(@filename,@ec,LEN(@filename)));

-- set filename without rollover number
SET @filename = @bfn + @efn

-- process all trace files
SELECT
ftg.StartTime
,te.name AS EventName
,DB_NAME(ftg.databaseid) AS DatabaseName
,ftg.Filename
,(ftg.IntegerData*8)/1024.0 AS GrowthMB
,(ftg.duration/1000)AS DurMS
FROM ::fn_trace_gettable(@filename, DEFAULT) AS ftg
INNER JOIN sys.trace_events AS te ON ftg.EventClass = te.trace_event_id
WHERE (ftg.EventClass = 92 -- Date File Auto-grow
OR ftg.EventClass = 93) -- Log File Auto-grow
ORDER BY ftg.StartTime




There are 4 trace files _31/_32/_33/_34

Post #1440641
Posted Wednesday, April 10, 2013 6:11 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Yesterday @ 2:51 PM
Points: 374, Visits: 2,286
Make sure one of the traces isn't still in progress! LOL dumb suggestion, shows how little I know etc etc but I haven't met my post quota for this week yet!
Post #1440758
Posted Wednesday, December 18, 2013 8:52 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Yesterday @ 2:40 PM
Points: 79, Visits: 614
Hi I am having the same error. Did you ever figure out what this was?

Thanks in Advance
Post #1524188
Posted Thursday, January 2, 2014 6:44 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 1:30 AM
Points: 6,183, Visits: 13,330
Krishna1 (4/9/2013)
DECLARE @filename NVARCHAR(1000);
DECLARE @bc INT;
DECLARE @ec INT;
DECLARE @bfn VARCHAR(1000);
DECLARE @efn VARCHAR(10);

-- Get the name of the current default trace
SELECT @filename = CAST(value AS NVARCHAR(1000))
FROM ::fn_trace_getinfo(DEFAULT)
WHERE traceid = 1 AND property = 2;

-- rip apart file name into pieces
SET @filename = REVERSE(@filename);
SET @bc = CHARINDEX('.',@filename);
SET @ec = CHARINDEX('_',@filename)+1;
SET @efn = REVERSE(SUBSTRING(@filename,1,@bc));
SET @bfn = REVERSE(SUBSTRING(@filename,@ec,LEN(@filename)));
[/code]

If all you want is the path, this is easier

select reverse(substring(@filename, CHARINDEX('\', @filename, 0) + 1, LEN(@filename)))

c:\Program Files\Microsoft SQL Server\MSSQL10_50.LOCAL2008EXPRESS\MSSQL\Log

Or

select reverse(substring(@filename, CHARINDEX('\', @filename, 0), LEN(@filename)))

c:\Program Files\Microsoft SQL Server\MSSQL10_50.LOCAL2008EXPRESS\MSSQL\Log\





-----------------------------------------------------------------------------------------------------------

"Ya can't make an omelette without breaking just a few eggs"
Post #1527090
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse