Showing posts with label logs. Show all posts
Showing posts with label logs. Show all posts

Tuesday, March 27, 2012

Determine Previous Task Executed

I have the failed path of many tasks pointing to a single Script Task that logs a failed entry into my database. In this script task, I need to be able to determine the task that faliled as I need to write a unique error message depending on the task that failed.

In my VB script, how would I determine which task was the one that failed?

Thank You!!!

a SSIS newbie

There is no way I can see to do that.

Have you investigated the logging available in SSIS before you write your own?

If you do want a task for additional error handling work, then try the on error event handler. Event handlers can host an entire workflow of tasks if you want, and are a better way of capturing this type of event compared to workflow constraints. You have some system variables scoped to the event handler that should give you all the information you want.

|||What I do is add a derived column to each error flow. Then in that derived column, I add a new column, ErrorReason (or whatever you like), which is where I store a small string of what the error was. So then in your script component, you could look at that column and act accordingly.

However, it sounds like you can do all of this outside of a script component. (You are inside the data flow, correct? I assume so because you talk of "failed paths.") If you're talking about a failed precedence constraint, then I'll defer to Darren above.|||

Hi AspUser123,

I agree with Darren.

Recently, I implemented a custom error logging mechanism for a client using the onError Event Handler. They wanted the package to continue executing, but capture information about each fault.

Since the Error events bubble, I implemented the entire custom logging solution in the Package onError Event Handler. You can use the SourceName system variable to identify the name of the task that originally generated the error - even if it's nested inside several layers of containers. You can also collect information such as the ErrorDescription and ErrorCode (error number).

In this case I ended up writing the information out to a SQL Server database for storage, reporting, and analysis - but you could easily implement a flat file output. You can use an Execute SQL Task (calling a stored procedure) to write to SQL Server, or add a Data Flow to the onError Event Handler to store the system variable values to a flat file destination.

Hope this helps,
Andy

|||I agree with Darren.

Sunday, March 11, 2012

Detaching and transaction logs

Hi,
I'm using SQL 7 with database 1 GB and transaction log 4 GB.
I tried everything to shrink the log files but no succeed. I read somewhere
that detaching the database, deleting the log file and then reattaching is
the solution.
Can I be sure that all the data that was in the log file is now in the db
with this process?
Thanks in advance,
Haim Beyhan
As sp_detach_db issues Checkoint command first, this should be safe. But
befor doing this, check the article at
http://www.winnetmag.com/Article/Art...37/14337.html.
Dejan Sarka, SQL Server MVP
Associate Mentor
Solid Quality Learning
More than just Training
www.SolidQualityLearning.com
"Haim Beyhan" <haimb@.enigma.com> wrote in message
news:uRU6eyCLEHA.4080@.TK2MSFTNGP12.phx.gbl...
> Hi,
> I'm using SQL 7 with database 1 GB and transaction log 4 GB.
> I tried everything to shrink the log files but no succeed. I read
somewhere
> that detaching the database, deleting the log file and then reattaching is
> the solution.
> Can I be sure that all the data that was in the log file is now in the db
> with this process?
> Thanks in advance,
> Haim Beyhan
>
|||Hi,
Before detaching, can you try this:-
1. Backup the transaction log
Backup log <dbname> to disk='c:\backup\dbname.trn'
2. DBCCSHRINKFILE('logical_log_file_name','truncateon ly')
Ensure that no open transactions are in the database. Check this using DBCC
OPENTRAN('dbname')
If this is not working out, go with Dejan Sarka's suggestion.
Thanks
Hari
MCDBA
"Haim Beyhan" <haimb@.enigma.com> wrote in message
news:uRU6eyCLEHA.4080@.TK2MSFTNGP12.phx.gbl...
> Hi,
> I'm using SQL 7 with database 1 GB and transaction log 4 GB.
> I tried everything to shrink the log files but no succeed. I read
somewhere
> that detaching the database, deleting the log file and then reattaching is
> the solution.
> Can I be sure that all the data that was in the log file is now in the db
> with this process?
> Thanks in advance,
> Haim Beyhan
>
|||Thanks for the reply.
Haim
"Dejan Sarka" <dejan_please_reply_to_newsgroups.sarka@.avtenta.si > wrote in
message news:%23bYwx2CLEHA.3880@.TK2MSFTNGP09.phx.gbl...[vbcol=seagreen]
> As sp_detach_db issues Checkoint command first, this should be safe. But
> befor doing this, check the article at
> http://www.winnetmag.com/Article/Art...37/14337.html.
> --
> Dejan Sarka, SQL Server MVP
> Associate Mentor
> Solid Quality Learning
> More than just Training
> www.SolidQualityLearning.com
> "Haim Beyhan" <haimb@.enigma.com> wrote in message
> news:uRU6eyCLEHA.4080@.TK2MSFTNGP12.phx.gbl...
> somewhere
is[vbcol=seagreen]
db
>
|||Thank you for the reply.
I tried your steps and it did not help. then I tried Dejan's suggestion.
The server created a new log file after the database is reattached.
I hope everything is on the db.
Haim
"Hari" <hari_prasad_k@.hotmail.com> wrote in message
news:%23v4%23dNDLEHA.1120@.TK2MSFTNGP11.phx.gbl...
> Hi,
> Before detaching, can you try this:-
> 1. Backup the transaction log
> Backup log <dbname> to disk='c:\backup\dbname.trn'
> 2. DBCCSHRINKFILE('logical_log_file_name','truncateon ly')
> Ensure that no open transactions are in the database. Check this using
DBCC[vbcol=seagreen]
> OPENTRAN('dbname')
> If this is not working out, go with Dejan Sarka's suggestion.
> Thanks
> Hari
> MCDBA
>
> "Haim Beyhan" <haimb@.enigma.com> wrote in message
> news:uRU6eyCLEHA.4080@.TK2MSFTNGP12.phx.gbl...
> somewhere
is[vbcol=seagreen]
db
>

Detaching and transaction logs

Hi,
I'm using SQL 7 with database 1 GB and transaction log 4 GB.
I tried everything to shrink the log files but no succeed. I read somewhere
that detaching the database, deleting the log file and then reattaching is
the solution.
Can I be sure that all the data that was in the log file is now in the db
with this process?
Thanks in advance,
Haim BeyhanAs sp_detach_db issues Checkoint command first, this should be safe. But
befor doing this, check the article at
http://www.winnetmag.com/Article/ArticleID/14337/14337.html.
--
Dejan Sarka, SQL Server MVP
Associate Mentor
Solid Quality Learning
More than just Training
www.SolidQualityLearning.com
"Haim Beyhan" <haimb@.enigma.com> wrote in message
news:uRU6eyCLEHA.4080@.TK2MSFTNGP12.phx.gbl...
> Hi,
> I'm using SQL 7 with database 1 GB and transaction log 4 GB.
> I tried everything to shrink the log files but no succeed. I read
somewhere
> that detaching the database, deleting the log file and then reattaching is
> the solution.
> Can I be sure that all the data that was in the log file is now in the db
> with this process?
> Thanks in advance,
> Haim Beyhan
>|||Hi,
Before detaching, can you try this:-
1. Backup the transaction log
Backup log <dbname> to disk='c:\backup\dbname.trn'
2. DBCCSHRINKFILE('logical_log_file_name','truncateonly')
Ensure that no open transactions are in the database. Check this using DBCC
OPENTRAN('dbname')
If this is not working out, go with Dejan Sarka's suggestion.
Thanks
Hari
MCDBA
"Haim Beyhan" <haimb@.enigma.com> wrote in message
news:uRU6eyCLEHA.4080@.TK2MSFTNGP12.phx.gbl...
> Hi,
> I'm using SQL 7 with database 1 GB and transaction log 4 GB.
> I tried everything to shrink the log files but no succeed. I read
somewhere
> that detaching the database, deleting the log file and then reattaching is
> the solution.
> Can I be sure that all the data that was in the log file is now in the db
> with this process?
> Thanks in advance,
> Haim Beyhan
>|||Thanks for the reply.
Haim
"Dejan Sarka" <dejan_please_reply_to_newsgroups.sarka@.avtenta.si> wrote in
message news:%23bYwx2CLEHA.3880@.TK2MSFTNGP09.phx.gbl...
> As sp_detach_db issues Checkoint command first, this should be safe. But
> befor doing this, check the article at
> http://www.winnetmag.com/Article/ArticleID/14337/14337.html.
> --
> Dejan Sarka, SQL Server MVP
> Associate Mentor
> Solid Quality Learning
> More than just Training
> www.SolidQualityLearning.com
> "Haim Beyhan" <haimb@.enigma.com> wrote in message
> news:uRU6eyCLEHA.4080@.TK2MSFTNGP12.phx.gbl...
> > Hi,
> >
> > I'm using SQL 7 with database 1 GB and transaction log 4 GB.
> > I tried everything to shrink the log files but no succeed. I read
> somewhere
> > that detaching the database, deleting the log file and then reattaching
is
> > the solution.
> > Can I be sure that all the data that was in the log file is now in the
db
> > with this process?
> >
> > Thanks in advance,
> >
> > Haim Beyhan
> >
> >
>|||Thank you for the reply.
I tried your steps and it did not help. then I tried Dejan's suggestion.
The server created a new log file after the database is reattached.
I hope everything is on the db.
Haim
"Hari" <hari_prasad_k@.hotmail.com> wrote in message
news:%23v4%23dNDLEHA.1120@.TK2MSFTNGP11.phx.gbl...
> Hi,
> Before detaching, can you try this:-
> 1. Backup the transaction log
> Backup log <dbname> to disk='c:\backup\dbname.trn'
> 2. DBCCSHRINKFILE('logical_log_file_name','truncateonly')
> Ensure that no open transactions are in the database. Check this using
DBCC
> OPENTRAN('dbname')
> If this is not working out, go with Dejan Sarka's suggestion.
> Thanks
> Hari
> MCDBA
>
> "Haim Beyhan" <haimb@.enigma.com> wrote in message
> news:uRU6eyCLEHA.4080@.TK2MSFTNGP12.phx.gbl...
> > Hi,
> >
> > I'm using SQL 7 with database 1 GB and transaction log 4 GB.
> > I tried everything to shrink the log files but no succeed. I read
> somewhere
> > that detaching the database, deleting the log file and then reattaching
is
> > the solution.
> > Can I be sure that all the data that was in the log file is now in the
db
> > with this process?
> >
> > Thanks in advance,
> >
> > Haim Beyhan
> >
> >
>

Detaching and transaction logs

Hi,
I'm using SQL 7 with database 1 GB and transaction log 4 GB.
I tried everything to shrink the log files but no succeed. I read somewhere
that detaching the database, deleting the log file and then reattaching is
the solution.
Can I be sure that all the data that was in the log file is now in the db
with this process?
Thanks in advance,
Haim BeyhanAs sp_detach_db issues Checkoint command first, this should be safe. But
befor doing this, check the article at
http://www.winnetmag.com/Article/Ar...337/14337.html.
Dejan Sarka, SQL Server MVP
Associate Mentor
Solid Quality Learning
More than just Training
www.SolidQualityLearning.com
"Haim Beyhan" <haimb@.enigma.com> wrote in message
news:uRU6eyCLEHA.4080@.TK2MSFTNGP12.phx.gbl...
> Hi,
> I'm using SQL 7 with database 1 GB and transaction log 4 GB.
> I tried everything to shrink the log files but no succeed. I read
somewhere
> that detaching the database, deleting the log file and then reattaching is
> the solution.
> Can I be sure that all the data that was in the log file is now in the db
> with this process?
> Thanks in advance,
> Haim Beyhan
>|||Hi,
Before detaching, can you try this:-
1. Backup the transaction log
Backup log <dbname> to disk='c:\backup\dbname.trn'
2. DBCCSHRINKFILE('logical_log_file_name','
truncateonly')
Ensure that no open transactions are in the database. Check this using DBCC
OPENTRAN('dbname')
If this is not working out, go with Dejan Sarka's suggestion.
Thanks
Hari
MCDBA
"Haim Beyhan" <haimb@.enigma.com> wrote in message
news:uRU6eyCLEHA.4080@.TK2MSFTNGP12.phx.gbl...
> Hi,
> I'm using SQL 7 with database 1 GB and transaction log 4 GB.
> I tried everything to shrink the log files but no succeed. I read
somewhere
> that detaching the database, deleting the log file and then reattaching is
> the solution.
> Can I be sure that all the data that was in the log file is now in the db
> with this process?
> Thanks in advance,
> Haim Beyhan
>|||Thanks for the reply.
Haim
"Dejan Sarka" <dejan_please_reply_to_newsgroups.sarka@.avtenta.si> wrote in
message news:%23bYwx2CLEHA.3880@.TK2MSFTNGP09.phx.gbl...
> As sp_detach_db issues Checkoint command first, this should be safe. But
> befor doing this, check the article at
> http://www.winnetmag.com/Article/Ar...337/14337.html.
> --
> Dejan Sarka, SQL Server MVP
> Associate Mentor
> Solid Quality Learning
> More than just Training
> www.SolidQualityLearning.com
> "Haim Beyhan" <haimb@.enigma.com> wrote in message
> news:uRU6eyCLEHA.4080@.TK2MSFTNGP12.phx.gbl...
> somewhere
is[vbcol=seagreen]
db[vbcol=seagreen]
>|||Thank you for the reply.
I tried your steps and it did not help. then I tried Dejan's suggestion.
The server created a new log file after the database is reattached.
I hope everything is on the db.
Haim
"Hari" <hari_prasad_k@.hotmail.com> wrote in message
news:%23v4%23dNDLEHA.1120@.TK2MSFTNGP11.phx.gbl...
> Hi,
> Before detaching, can you try this:-
> 1. Backup the transaction log
> Backup log <dbname> to disk='c:\backup\dbname.trn'
> 2. DBCCSHRINKFILE('logical_log_file_name','
truncateonly')
> Ensure that no open transactions are in the database. Check this using
DBCC
> OPENTRAN('dbname')
> If this is not working out, go with Dejan Sarka's suggestion.
> Thanks
> Hari
> MCDBA
>
> "Haim Beyhan" <haimb@.enigma.com> wrote in message
> news:uRU6eyCLEHA.4080@.TK2MSFTNGP12.phx.gbl...
> somewhere
is[vbcol=seagreen]
db[vbcol=seagreen]
>