Friday, March 30, 2012
Reading a transaction log file
As far as I can see, Microsoft do not provide such a tool and so far I've
tried a product called "SLR" and "ApexSQL Log". Both look OK and work OK with
"small" log files.
My problem is that the file I need to look at is 581MB and both products
just fail miserably when trying to look at these files (I think there are
about 1.3 million transcations in this file).
Before asking why I need to look at this file, I must stress that its
because of problem (server running out of disk space, so log backups were not
happening) that the log grew so big. Unfortunately, the site does not have a
DBA and I've been called in, as this all came to light when 5 important
tables appeared to have been "re-created" (dropped and created empty, with no
indexes, etc...). That has all been recovered, but they want to know how this
happened!!
I know for a fact that this 581mb log backup contains the transactions that
did the damage.
Any other ideas will be welcome!!
Is there not a command line utility, such simpy dumps all the info in these
file to a nice readable text file?? Or should I just persevere with the 2
products mentioned above?
Thanks
Hi,
There is no command line utility to convert the transaction log to text
file. Probably you could try the Logexplorer from Lumigent.
www.lumigent.com
Thanks
Hari
SQL Server MVP
"Jason Harrington" <Jason Harrington@.discussions.microsoft.com> wrote in
message news:A0EAB1FD-BAC2-4201-8153-695DEEF11210@.microsoft.com...
> I'm having alot of trouble reading a SQL 2000 transaction log backup file.
> As far as I can see, Microsoft do not provide such a tool and so far I've
> tried a product called "SLR" and "ApexSQL Log". Both look OK and work OK
> with
> "small" log files.
> My problem is that the file I need to look at is 581MB and both products
> just fail miserably when trying to look at these files (I think there are
> about 1.3 million transcations in this file).
> Before asking why I need to look at this file, I must stress that its
> because of problem (server running out of disk space, so log backups were
> not
> happening) that the log grew so big. Unfortunately, the site does not have
> a
> DBA and I've been called in, as this all came to light when 5 important
> tables appeared to have been "re-created" (dropped and created empty, with
> no
> indexes, etc...). That has all been recovered, but they want to know how
> this
> happened!!
> I know for a fact that this 581mb log backup contains the transactions
> that
> did the damage.
> Any other ideas will be welcome!!
> Is there not a command line utility, such simpy dumps all the info in
> these
> file to a nice readable text file?? Or should I just persevere with the
> 2
> products mentioned above?
> Thanks
|||I'm currently in discussion with a UK reseller of this product. The
evaluation version of this product only allows you to run against "northwind"
database and one of their own.
I asked if it would be able to read a 581mb file and they said if we were
interested in buying the product, they would test it for us!!!
Not really what I wanted to hear!!
I've been running SLR all day since 9.30am this morning, its now 3.30pm and
its about 75% of the way through reading it!!! We 'll see.....
Thanks for your response.
Jason
"Hari Prasad" wrote:
> Hi,
> There is no command line utility to convert the transaction log to text
> file. Probably you could try the Logexplorer from Lumigent.
> www.lumigent.com
> Thanks
> Hari
> SQL Server MVP
> "Jason Harrington" <Jason Harrington@.discussions.microsoft.com> wrote in
> message news:A0EAB1FD-BAC2-4201-8153-695DEEF11210@.microsoft.com...
>
>
|||We use Log Explorer and I've used it on much bigger log files than that with
no real issues.
HTH
Jasper Smith (SQL Server MVP)
http://www.sqldbatips.com
I support PASS - the definitive, global
community for SQL Server professionals -
http://www.sqlpass.org
"Jason Harrington" <JasonHarrington@.discussions.microsoft.com> wrote in
message news:907814B5-F9D3-492A-B024-E8DC00EFF538@.microsoft.com...[vbcol=seagreen]
> I'm currently in discussion with a UK reseller of this product. The
> evaluation version of this product only allows you to run against
> "northwind"
> database and one of their own.
> I asked if it would be able to read a 581mb file and they said if we were
> interested in buying the product, they would test it for us!!!
> Not really what I wanted to hear!!
> I've been running SLR all day since 9.30am this morning, its now 3.30pm
> and
> its about 75% of the way through reading it!!! We 'll see.....
> Thanks for your response.
> Jason
> "Hari Prasad" wrote:
Wednesday, March 21, 2012
Read All Variables in a Script Task w/o Enumerating Them
I'm having trouble with my configurations. All of my configurations are targeting variables and the various properties are all set to expressions containing the targeted variables. I would like (during debugging) to dump out all of the variables.
Is there a way to access all variables from a script task? It looks like you have to enumerate the variables you want in the ReadOnlyVariables or ReadWriteVariables properties. I'd rather not miss one by forgetting to list it.
No, because there is no way of discovering what variables are available at run-time, and the locking mechanism to get access to the variable and it's value requires a name.
This type of funtionality is only available through the design-time UI interfaces.
|||You might be able to use the OnVariableValueChanged event to capture the variable values as they are set. You do need to make sure that RaiseChangedEvent is true for each variable.|||Thanks, but the reason for this was to help me understand the details of how the configuration was working. Will OnVariableValueChanged work even if the change was due to loading a configuration?
|||No, actually it doesn't. I just tested it, and it appears that the event doesn't fire on configurations. Maybe someone from MSFT could comment on why it doesn't? I can guess a few reasons, but I think there are some valid scenarios where you would want to capture values even when they are set from configurations.
Back to your original question, they are adding a Watson-style debugger in 2008 that will dump the current state of the package on demand. That will include the variable values. Not a big help today, but something to look forward to.
|||Actually, the 2008 version will help once released. Any info on which CTP that feature will be in?
|||CTP 5, from what MSFT said at the PASS Summit.Read All Variables in a Script Task w/o Enumerating Them
I'm having trouble with my configurations. All of my configurations are targeting variables and the various properties are all set to expressions containing the targeted variables. I would like (during debugging) to dump out all of the variables.
Is there a way to access all variables from a script task? It looks like you have to enumerate the variables you want in the ReadOnlyVariables or ReadWriteVariables properties. I'd rather not miss one by forgetting to list it.
No, because there is no way of discovering what variables are available at run-time, and the locking mechanism to get access to the variable and it's value requires a name.
This type of funtionality is only available through the design-time UI interfaces.
|||You might be able to use the OnVariableValueChanged event to capture the variable values as they are set. You do need to make sure that RaiseChangedEvent is true for each variable.|||Thanks, but the reason for this was to help me understand the details of how the configuration was working. Will OnVariableValueChanged work even if the change was due to loading a configuration?
|||No, actually it doesn't. I just tested it, and it appears that the event doesn't fire on configurations. Maybe someone from MSFT could comment on why it doesn't? I can guess a few reasons, but I think there are some valid scenarios where you would want to capture values even when they are set from configurations.
Back to your original question, they are adding a Watson-style debugger in 2008 that will dump the current state of the package on demand. That will include the variable values. Not a big help today, but something to look forward to.
|||Actually, the 2008 version will help once released. Any info on which CTP that feature will be in?
|||CTP 5, from what MSFT said at the PASS Summit.Read All Variables in a Script Task w/o Enumerating Them
I'm having trouble with my configurations. All of my configurations are targeting variables and the various properties are all set to expressions containing the targeted variables. I would like (during debugging) to dump out all of the variables.
Is there a way to access all variables from a script task? It looks like you have to enumerate the variables you want in the ReadOnlyVariables or ReadWriteVariables properties. I'd rather not miss one by forgetting to list it.
No, because there is no way of discovering what variables are available at run-time, and the locking mechanism to get access to the variable and it's value requires a name.
This type of funtionality is only available through the design-time UI interfaces.
|||You might be able to use the OnVariableValueChanged event to capture the variable values as they are set. You do need to make sure that RaiseChangedEvent is true for each variable.|||Thanks, but the reason for this was to help me understand the details of how the configuration was working. Will OnVariableValueChanged work even if the change was due to loading a configuration?
|||No, actually it doesn't. I just tested it, and it appears that the event doesn't fire on configurations. Maybe someone from MSFT could comment on why it doesn't? I can guess a few reasons, but I think there are some valid scenarios where you would want to capture values even when they are set from configurations.
Back to your original question, they are adding a Watson-style debugger in 2008 that will dump the current state of the package on demand. That will include the variable values. Not a big help today, but something to look forward to.
|||Actually, the 2008 version will help once released. Any info on which CTP that feature will be in?
|||CTP 5, from what MSFT said at the PASS Summit.Tuesday, March 20, 2012
Re: Stored procedure not executing correctly
I am having trouble with this stored procedure. The @.curr_type stores the first value of inspection type of the recordset , @.inspec_type stores the current record of the inspection type. @.inspec_type moves to the next record while @.curr_type's value remain the same for comparisons.
The error is in the Else statment. These variables,@.curr_type and @.inspec_type, values are = 3 the else statement should not be executed.
Is something wrong with my code or logic?
Thank you for any assistance.Mind posting some code ?|||Yeah, without seeing it you want us to guess? Well, I guess that the ELSE is not executed because a check for a value of the variable does not take into account a possibility of NULL. Good enough, hey?! ;)|||so Sorry! absent minded me.
Here is my code:
CREATE PROCEDURE dbo.spCheck_inspection_type
@.inspec_type smallint Out, @.curr_type smallint Out
AS--ve
declare insp_type cursor
For
Select inspection_type
From tblTmp_inspec
Where partial <> 0 or complete <> 0;
set @.curr_type = 0;
Open insp_type
Fetch Next From insp_type Into @.inspec_type
While @.@.FETCH_STATUS = 0
Begin
if @.curr_type = 0
set @.curr_type = @.inspec_type;
Else
--last inspection type is @.curr_type
Begin
if @.curr_type <> @.inspec_type
close insp_type
deallocate insp_type
return(1);
End
Fetch Next From insp_type Into @.inspec_type
End
close insp_type
deallocate insp_type
return(0);
GO
The ELSE statment executed eventhough both variables 's values is 3 . Why?
Thank you much!!|||Indeting is SO overlooked...
You have logic problems...I guess they don't call them scop termintors here...
BUT...for now, to make it easier to read, use a BEGIN and END for every logic block...AND make sure to match them up...
BUT...This is WAY to over done for what you're trying to do...which is?
Here, look at this
CREATE PROC spCheck_inspection_type
@.inspec_type smallint OUT, @.curr_type smallint OuT
AS
DECLARE insp_type CURSOR
FOR
SELECT inspection_type FROM tblTmp_inspec WHERE partial <> 0 or complete <> 0;
SET @.curr_type = 0;
Open insp_type
FETCH NEXT FROM insp_type INTO @.inspec_type
WHILE @.@.FETCH_STATUS = 0
BEGIN
IF @.curr_type = 0
SET @.curr_type = @.inspec_type;
ELSE
BEGIN
IF @.curr_type <> @.inspec_type
CLOSE insp_type
DEALLOCATE insp_type
RETURN 1
END
FETCH NEXT FROM insp_type INTO @.inspec_type
END
CLOSE insp_type
DEALLOCATE insp_type
RETURN 0
GO|||That's too many colors,Brett, andno comment on what they mean!
All the guy is missing is BEGIN...END on the test for @.curr_type <> @.inspec_type: if @.curr_type <> @.inspec_type begin
close insp_type
deallocate insp_type
return(1);
end|||fine...fine...fine...
BUT!
Would you do this?
I mean, what does it even mean?|||Yup, there are problems with the code. Most obvious one is that the cursor declaration does not take into account the order of records as they get returned. This would yield unpredictable results when the app is running on a single CPU machine while being tested, compared to a prod environment when it gets deployed onto a SMP system.
To avoid usage of cursor, while fixing the ORDERing issue, would be to do the following:
declare @.curr_type int, @.record_id int
select @.curr_type = inspection_type, @.record_id = <record_id> from (
select top 1 <record_id>, inspection_type from tblTmp_inspec
WHERE partial <> 0 or complete <> 0
order by <record_id>) x
if exists (select 1 from tblTmp_inspec where <record_id> > @.record_id
and partial <> 0 or complete <> 0 and inspection_type <> @.curr_type)
return 1
else
return 0|||Brett, that was the most beautiful piece of SQL I've ever seen.
I am reminded of the Old Testament story of Joseph and his "Code of many colors". It must have looked something like that.
:)|||Brett, that was the most beautiful piece of SQL I've ever seen.
:)
And you know that's saying something...because he's, well, blind
Thanks Dude...
Seriously, alicejwz, Lettuce know what you're doing, and we can hook you up.
Re: Trouble in getting a value from bit data type in stored procedure
I'm trying to get the stored procedure to return a value from a field in a table. The value in the field stores a bit value and default value is set to 0. So there should always a value in that field but it is giving me a null value. Can anyone see why.
I'm calling sp thru vb. Thanks much!
This is VB:
sub
Set cancel_inspection_query = Nothing
With cancel_inspection_query
.ActiveConnection = CurrentProject.Connection
.CommandText = "spInspec_cancel_initial_scan1"
.CommandType = adCmdStoredProc
.Parameters.Append .CreateParameter("ret_val", adInteger, adParamReturnValue)
.Parameters.Append .CreateParameter("@.inspec_id", adInteger, adParamInput, 4, Me!inspecid.Caption)
.Parameters.Append .CreateParameter("@.bag_num", adInteger, adParamInput, 4, Me!bag_num.Caption)
.Parameters.Append .CreateParameter("@.sampling_id", adInteger, adParamInput, 4, Me!rmr.Caption)
.Execute , , adExecuteNoRecords
End With
Debug.Print cancel_inspection_query("ret_val").Value
end sub
This is sp:
CREATE PROCEDURE dbo.spInspec_cancel_initial_scan1
@.inspec_id int,
@.sampling_id int,
@.bag_num int
AS
declare @.inspection_complete bit
SELECT @.inspection_complete = inspection_complete
FROM dbo.tblBag_results
WHERE bag_num = @.bag_num;
begin
if @.inspection_complete= 1
return(1)
Else
if @.inspection_complete = 0
return(100)
--else
--return(-1)The Table DDL would help.
Is Bag_Num a PK or unique index?
If not, that's a problem...
Also is the column defined as NOT NULL?
If not, that's a problem...
And why not use an OUTPUT variable instead?
You should let SQL Server manage the return value. I've seen times when it overrides your value...which could be a problem if you code for a particular value...