Thursday, March 8, 2012
Change to behavior in SQL 2005 SP2?
plan that does a transaction log backup on all databases every hour. Prior
to SP2 (running build 2153), the maintenance plan would silently skip
databases in simple recovery mode. Immediately after applying the service
pack though, the next scheduled job reported an error for every database in
simple recovery mode.
Is this an expected change in behavior with SP2? I did not see anything in
the release notes about this.I've heard various rumblings that you're better off re-creating you
maintenance plans under SP2. The underlying mechanics have been overhauled,
and that just seems like the safest route.
"Michael D'Angelo" <nospamnmdange@.phoenixworx.org> wrote in message
news:%23HKkjvcVHHA.3592@.TK2MSFTNGP03.phx.gbl...
>I just applied SQL 2005 SP2 to our SQL 2005 server. We have a maintenance
>plan that does a transaction log backup on all databases every hour. Prior
>to SP2 (running build 2153), the maintenance plan would silently skip
>databases in simple recovery mode. Immediately after applying the service
>pack though, the next scheduled job reported an error for every database in
>simple recovery mode.
> Is this an expected change in behavior with SP2? I did not see anything
> in the release notes about this.
>|||I actually tried this, but it didn't seem to help. The plan is very simple:
one Backup Database task, set to transaction log and configured to backup
all user databases.
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:OCZR7DdVHHA.388@.TK2MSFTNGP04.phx.gbl...
> I've heard various rumblings that you're better off re-creating you
> maintenance plans under SP2. The underlying mechanics have been
> overhauled, and that just seems like the safest route.
>
> "Michael D'Angelo" <nospamnmdange@.phoenixworx.org> wrote in message
> news:%23HKkjvcVHHA.3592@.TK2MSFTNGP03.phx.gbl...
>>I just applied SQL 2005 SP2 to our SQL 2005 server. We have a maintenance
>>plan that does a transaction log backup on all databases every hour.
>>Prior to SP2 (running build 2153), the maintenance plan would silently
>>skip databases in simple recovery mode. Immediately after applying the
>>service pack though, the next scheduled job reported an error for every
>>database in simple recovery mode.
>> Is this an expected change in behavior with SP2? I did not see anything
>> in the release notes about this.
>|||Michael,
Could this fix be what changed this:-
http://support.microsoft.com/kb/921003/ ?
We found that you could not create a maintenance plan unless the DB was in
Full recovery mode. If you created a maintenance plan and then the DB was
changed to the Bulk-logged recovery mode the log backup job ran but did not
do anything. This patch fixed both situations and could have caused yours!
Chris
"Michael D'Angelo" <nospamnmdange@.phoenixworx.org> wrote in message
news:uWZiEIdVHHA.1208@.TK2MSFTNGP03.phx.gbl...
>I actually tried this, but it didn't seem to help. The plan is very
>simple: one Backup Database task, set to transaction log and configured to
>backup all user databases.
> "Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in
> message news:OCZR7DdVHHA.388@.TK2MSFTNGP04.phx.gbl...
>> I've heard various rumblings that you're better off re-creating you
>> maintenance plans under SP2. The underlying mechanics have been
>> overhauled, and that just seems like the safest route.
>>
>> "Michael D'Angelo" <nospamnmdange@.phoenixworx.org> wrote in message
>> news:%23HKkjvcVHHA.3592@.TK2MSFTNGP03.phx.gbl...
>>I just applied SQL 2005 SP2 to our SQL 2005 server. We have a
>>maintenance plan that does a transaction log backup on all databases
>>every hour. Prior to SP2 (running build 2153), the maintenance plan would
>>silently skip databases in simple recovery mode. Immediately after
>>applying the service pack though, the next scheduled job reported an
>>error for every database in simple recovery mode.
>> Is this an expected change in behavior with SP2? I did not see anything
>> in the release notes about this.
>>
>|||It does seem possible, although that referse to bulk-logged recovery mode
and not simple.
I suppose my only recourse is to call PSS and see if they have a response
other than "only backup databases in full recovery mode."
I prefer to select "All Databases" in the maintenance plan so I don't have
to remember to add new databases to the plan as they are added.
"Chris Wood" <anonymous@.discussions.microsoft.com> wrote in message
news:OLswF8pVHHA.4404@.TK2MSFTNGP03.phx.gbl...
> Michael,
> Could this fix be what changed this:-
> http://support.microsoft.com/kb/921003/ ?
> We found that you could not create a maintenance plan unless the DB was in
> Full recovery mode. If you created a maintenance plan and then the DB was
> changed to the Bulk-logged recovery mode the log backup job ran but did
> not do anything. This patch fixed both situations and could have caused
> yours!
> Chris
> "Michael D'Angelo" <nospamnmdange@.phoenixworx.org> wrote in message
> news:uWZiEIdVHHA.1208@.TK2MSFTNGP03.phx.gbl...
>>I actually tried this, but it didn't seem to help. The plan is very
>>simple: one Backup Database task, set to transaction log and configured to
>>backup all user databases.
>> "Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in
>> message news:OCZR7DdVHHA.388@.TK2MSFTNGP04.phx.gbl...
>> I've heard various rumblings that you're better off re-creating you
>> maintenance plans under SP2. The underlying mechanics have been
>> overhauled, and that just seems like the safest route.
>>
>> "Michael D'Angelo" <nospamnmdange@.phoenixworx.org> wrote in message
>> news:%23HKkjvcVHHA.3592@.TK2MSFTNGP03.phx.gbl...
>>I just applied SQL 2005 SP2 to our SQL 2005 server. We have a
>>maintenance plan that does a transaction log backup on all databases
>>every hour. Prior to SP2 (running build 2153), the maintenance plan
>>would silently skip databases in simple recovery mode. Immediately
>>after applying the service pack though, the next scheduled job reported
>>an error for every database in simple recovery mode.
>> Is this an expected change in behavior with SP2? I did not see
>> anything in the release notes about this.
>>
>>
>|||On second thought maybe I can write a script to only do BACKUP LOG on
databases in FULL recovery mode instead of relying on the maintenance plan
to generate the script.
"Michael D'Angelo" <nospamnmdange@.phoenixworx.org> wrote in message
news:uz8E8y2VHHA.3948@.TK2MSFTNGP05.phx.gbl...
> It does seem possible, although that referse to bulk-logged recovery mode
> and not simple.
> I suppose my only recourse is to call PSS and see if they have a response
> other than "only backup databases in full recovery mode."
> I prefer to select "All Databases" in the maintenance plan so I don't have
> to remember to add new databases to the plan as they are added.
>
> "Chris Wood" <anonymous@.discussions.microsoft.com> wrote in message
> news:OLswF8pVHHA.4404@.TK2MSFTNGP03.phx.gbl...
>> Michael,
>> Could this fix be what changed this:-
>> http://support.microsoft.com/kb/921003/ ?
>> We found that you could not create a maintenance plan unless the DB was
>> in Full recovery mode. If you created a maintenance plan and then the DB
>> was changed to the Bulk-logged recovery mode the log backup job ran but
>> did not do anything. This patch fixed both situations and could have
>> caused yours!
>> Chris
>> "Michael D'Angelo" <nospamnmdange@.phoenixworx.org> wrote in message
>> news:uWZiEIdVHHA.1208@.TK2MSFTNGP03.phx.gbl...
>>I actually tried this, but it didn't seem to help. The plan is very
>>simple: one Backup Database task, set to transaction log and configured
>>to backup all user databases.
>> "Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in
>> message news:OCZR7DdVHHA.388@.TK2MSFTNGP04.phx.gbl...
>> I've heard various rumblings that you're better off re-creating you
>> maintenance plans under SP2. The underlying mechanics have been
>> overhauled, and that just seems like the safest route.
>>
>> "Michael D'Angelo" <nospamnmdange@.phoenixworx.org> wrote in message
>> news:%23HKkjvcVHHA.3592@.TK2MSFTNGP03.phx.gbl...
>>I just applied SQL 2005 SP2 to our SQL 2005 server. We have a
>>maintenance plan that does a transaction log backup on all databases
>>every hour. Prior to SP2 (running build 2153), the maintenance plan
>>would silently skip databases in simple recovery mode. Immediately
>>after applying the service pack though, the next scheduled job reported
>>an error for every database in simple recovery mode.
>> Is this an expected change in behavior with SP2? I did not see
>> anything in the release notes about this.
>>
>>
>>
>|||Michael,
The wizard still gives you the choice of All User databases, All System
database and All databases. I would not expect the system ones to change so
create 2 sets of plans, 1 to cover the system ones and one to cover the user
ones.
Chris
"Michael D'Angelo" <nospamnmdange@.phoenixworx.org> wrote in message
news:uz8E8y2VHHA.3948@.TK2MSFTNGP05.phx.gbl...
> It does seem possible, although that referse to bulk-logged recovery mode
> and not simple.
> I suppose my only recourse is to call PSS and see if they have a response
> other than "only backup databases in full recovery mode."
> I prefer to select "All Databases" in the maintenance plan so I don't have
> to remember to add new databases to the plan as they are added.
>
> "Chris Wood" <anonymous@.discussions.microsoft.com> wrote in message
> news:OLswF8pVHHA.4404@.TK2MSFTNGP03.phx.gbl...
>> Michael,
>> Could this fix be what changed this:-
>> http://support.microsoft.com/kb/921003/ ?
>> We found that you could not create a maintenance plan unless the DB was
>> in Full recovery mode. If you created a maintenance plan and then the DB
>> was changed to the Bulk-logged recovery mode the log backup job ran but
>> did not do anything. This patch fixed both situations and could have
>> caused yours!
>> Chris
>> "Michael D'Angelo" <nospamnmdange@.phoenixworx.org> wrote in message
>> news:uWZiEIdVHHA.1208@.TK2MSFTNGP03.phx.gbl...
>>I actually tried this, but it didn't seem to help. The plan is very
>>simple: one Backup Database task, set to transaction log and configured
>>to backup all user databases.
>> "Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in
>> message news:OCZR7DdVHHA.388@.TK2MSFTNGP04.phx.gbl...
>> I've heard various rumblings that you're better off re-creating you
>> maintenance plans under SP2. The underlying mechanics have been
>> overhauled, and that just seems like the safest route.
>>
>> "Michael D'Angelo" <nospamnmdange@.phoenixworx.org> wrote in message
>> news:%23HKkjvcVHHA.3592@.TK2MSFTNGP03.phx.gbl...
>>I just applied SQL 2005 SP2 to our SQL 2005 server. We have a
>>maintenance plan that does a transaction log backup on all databases
>>every hour. Prior to SP2 (running build 2153), the maintenance plan
>>would silently skip databases in simple recovery mode. Immediately
>>after applying the service pack though, the next scheduled job reported
>>an error for every database in simple recovery mode.
>> Is this an expected change in behavior with SP2? I did not see
>> anything in the release notes about this.
>>
>>
>>
>|||On Feb 23, 11:04 am, "Michael D'Angelo"
<nospamnmda...@.phoenixworx.org> wrote:
> It does seem possible, although that referse to bulk-logged recovery mode
> and not simple.
> I suppose my only recourse is to call PSS and see if they have a response
> other than "only backup databases in full recovery mode."
> I prefer to select "All Databases" in the maintenance plan so I don't have
> to remember to add new databases to the plan as they are added.
>
Have a look at this script of mine... It will automate all of your
backups, including the logs, and will pick up new databases
automatically...
http://realsqlguy.blogspot.com/2007/02/automating-database-backups.html|||Actually, even selecting "All user databases" causes the error. I was
hoping not to have to select specific databases.
"Chris Wood" <anonymous@.discussions.microsoft.com> wrote in message
news:uPILJH3VHHA.3980@.TK2MSFTNGP02.phx.gbl...
> Michael,
> The wizard still gives you the choice of All User databases, All System
> database and All databases. I would not expect the system ones to change
> so create 2 sets of plans, 1 to cover the system ones and one to cover the
> user ones.
> Chris
> "Michael D'Angelo" <nospamnmdange@.phoenixworx.org> wrote in message
> news:uz8E8y2VHHA.3948@.TK2MSFTNGP05.phx.gbl...
>> It does seem possible, although that referse to bulk-logged recovery mode
>> and not simple.
>> I suppose my only recourse is to call PSS and see if they have a response
>> other than "only backup databases in full recovery mode."
>> I prefer to select "All Databases" in the maintenance plan so I don't
>> have to remember to add new databases to the plan as they are added.
>>
>> "Chris Wood" <anonymous@.discussions.microsoft.com> wrote in message
>> news:OLswF8pVHHA.4404@.TK2MSFTNGP03.phx.gbl...
>> Michael,
>> Could this fix be what changed this:-
>> http://support.microsoft.com/kb/921003/ ?
>> We found that you could not create a maintenance plan unless the DB was
>> in Full recovery mode. If you created a maintenance plan and then the DB
>> was changed to the Bulk-logged recovery mode the log backup job ran but
>> did not do anything. This patch fixed both situations and could have
>> caused yours!
>> Chris
>> "Michael D'Angelo" <nospamnmdange@.phoenixworx.org> wrote in message
>> news:uWZiEIdVHHA.1208@.TK2MSFTNGP03.phx.gbl...
>>I actually tried this, but it didn't seem to help. The plan is very
>>simple: one Backup Database task, set to transaction log and configured
>>to backup all user databases.
>> "Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in
>> message news:OCZR7DdVHHA.388@.TK2MSFTNGP04.phx.gbl...
>> I've heard various rumblings that you're better off re-creating you
>> maintenance plans under SP2. The underlying mechanics have been
>> overhauled, and that just seems like the safest route.
>>
>> "Michael D'Angelo" <nospamnmdange@.phoenixworx.org> wrote in message
>> news:%23HKkjvcVHHA.3592@.TK2MSFTNGP03.phx.gbl...
>>I just applied SQL 2005 SP2 to our SQL 2005 server. We have a
>>maintenance plan that does a transaction log backup on all databases
>>every hour. Prior to SP2 (running build 2153), the maintenance plan
>>would silently skip databases in simple recovery mode. Immediately
>>after applying the service pack though, the next scheduled job
>>reported an error for every database in simple recovery mode.
>> Is this an expected change in behavior with SP2? I did not see
>> anything in the release notes about this.
>>
>>
>>
>>
>|||Thanks I'll take a look!
"Tracy McKibben" <tracy.mckibben@.gmail.com> wrote in message
news:1172254771.872080.170760@.v33g2000cwv.googlegroups.com...
> On Feb 23, 11:04 am, "Michael D'Angelo"
> <nospamnmda...@.phoenixworx.org> wrote:
>> It does seem possible, although that referse to bulk-logged recovery mode
>> and not simple.
>> I suppose my only recourse is to call PSS and see if they have a response
>> other than "only backup databases in full recovery mode."
>> I prefer to select "All Databases" in the maintenance plan so I don't
>> have
>> to remember to add new databases to the plan as they are added.
> Have a look at this script of mine... It will automate all of your
> backups, including the logs, and will pick up new databases
> automatically...
> http://realsqlguy.blogspot.com/2007/02/automating-database-backups.html
>
Wednesday, March 7, 2012
Change the InsertCommand of a datasource before insert
Hi,
I am trying to set the InsertCommand of a SqlDataSource prior to a new record being created in DetailsView. It has to be changed because certain fields are not being used in one scenerio and it is causing Null's to be written to the database.
Here is what I have tried:
I set the Insert command on page Load:
protectedvoid Page_Load(object sender,EventArgs e){
SqlDataSource3.InsertCommand =
"Insert into table (name,realName,type,extraValue) VALUES (@.name,@.realName,@.type,@.extraValue)";}
But I don't want to insert the "extraValue if a certain condition is true so I want to change the insert command to SqlDataSource3.InsertCommand ="Insert into table (name,realName,type) VALUES (@.name,@.realName,@.type)
I tried to do that in the following:
protectedvoid DetailsView1_ItemInserted(Object sender, System.Web.UI.WebControls.DetailsViewInsertedEventArgs e){
SqlDataSource3.InsertCommand ="Insert into table (name,realName,type,extraValue) VALUES (@.name,@.realName,@.type,@.extraValue)";
if (e.Exception !=null){
ErrorMessageLabel.Text =
"An error occured while entering this record. Please verify you have entered data in the correct format.";e.ExceptionHandled =
true;Response.Write(e.Exception);
}
GridView1.DataBind();
GridView1.DataBind();
}
But it doesn't seem to change,
Any Help would be appreciated,
Doug
Excuse me, maybe I missed it, but where did you change the insert command of SqlDataSource3? I saw you assign the same string to the insert command of SqlDataSource3 twice:
The first time:
protected void Page_Load(object sender, EventArgs e)
{
SqlDataSource3.InsertCommand =
"Insert into table (name,realName,type,extraValue) VALUES (@.name,@.realName,@.type,@.extraValue)";
}
And the second time:
protected void DetailsView1_ItemInserted(Object sender, System.Web.UI.WebControls.DetailsViewInsertedEventArgs e)
{
SqlDataSource3.InsertCommand ="Insert into table (name,realName,type,extraValue) VALUES (@.name,@.realName,@.type,@.extraValue)";
|||Sorry I made the same reply by mistake
|||Some logic for this:
On you page load event:
IF condition1 is true THEN
SqlDataSource3.SelectCommand=" SELECT name,realName,type,extraValue FROM table"
SqlDataSource3.InsertCommand =
"Insert into table (name,realName,type,extraValue) VALUES (@.name,@.realName,@.type,@.extraValue)"
ELSE
SqlDataSource3.SelectCommand ="SELECT name,realName,type FROM table"
SqlDataSource3.InsertCommand ="Insert into table (name,realName,type) VALUES (@.name,@.realName,@.type)
END IF
}
|||Sorry, the second should be:
protected void DetailsView1_ItemInserted(Object sender, System.Web.UI.WebControls.DetailsViewInsertedEventArgs e)
{
SqlDataSource3.InsertCommand ="Insert into table (name,realName,type) VALUES (@.name,@.realName,@.type)
That is actually what I tried. But it doesn't seem to change..
|||Thanks for taking a look,
Unfortunately the condition doesn't change on page load, it changes when a radio button is clicked within this page:
protectedvoid Type_Changed(object sender,EventArgs e){
string aha = ((RadioButtonList)DetailsView1.FindControl("type")).SelectedItem.Value;if (aha =="Mortgage"){
DetailsView1.Fields[6].Visible =
true;DetailsView1.Fields[7].Visible =
true;DetailsView1.Fields[8].Visible =
true;}
else{
DetailsView1.Fields[6].Visible =
false;DetailsView1.Fields[7].Visible =
false;DetailsView1.Fields[8].Visible =
false;}
}
I tried to change the Sql Insert command here but it doesn't seem to work.
Thanks again,
Doug