Showing posts with label fairly. Show all posts
Showing posts with label fairly. Show all posts

Sunday, March 11, 2012

Complicated question about update procedures

My company works with a fairly large database that needs to be kept live.
My problem is that we need a method of updating the database without messing the data, or crashing the website.
I am sure this is a common problem with a number of solutions. Couldanyone please direct me to a good article on the best practices forupdating databases like this?
What do you mean by updating the database? Just inserting records o chaging its structure?
|||Anything. Inserting records is not a problem. It is changing the structure which is.
When I am developing, I dont want to be working on the live database.
But if I copy the database and edit the copy, what happens to any new data on the live database?
Hope that is not confusing.
|||When you make updates to the structure of the database you should consider whether it affects the behaviour of the application or not. If it doesn′t you can make the update at anytime (But it will be better to schedule it when there is no heavy traffic). If it affects the application, the update should be accompanied with an update in the application. In this case you should schedule a maintainance stop (obviously the users should be adviced with anticipation), and use that time to update everything, the application, the database, configurations, etc. I also work for a huge company with a lot of servers, databases and web applications running, and this is the way we behave.
|||

I was just wondering what the best approach to this kind of thing is.

For example, lets say I have version 1.0 of an application with a db backend. Now, when I start creating version 2, the application and db will change. Do I :

1. Edit the live db making extra care that version 1.0 is not affected by the changes. This has its obvious problems - one mistake and the whole application goes down.

2. Create a copy of the db, edit that, and then link that in with version 2 when it is ready. The problem with this is that, between the time ot copying the db and releasing version 2.0, the users are still using version 1.0 of the db. I would have to then copy that over. This isnt a problem with minor changes, but it is when I start changing/creating keys and constraints (especially in sql server).
So I was wondering what the industry works around creating the next version of software without corrupting the current version.
I know there is no right answer - it depends on the situation. But any guidence would be appriciated.

|||

jagdipa wrote:

I know there is no right answer - it depends onthe situation. But any guidence would be appriciated.


I don't know that I agree with that statement. I think there is aright answer. It is called the Development, Staging, Productionmodel (DSP). The Staging database starts out as a mirror image ofthe Production database. Update scripts are run and tested on theStaging database until the consistent desiredresult is reached, with the Staging database being restored with abackup of theProduction database before each cycle of tests. This way, whenyou are ready to go live with your changes, you simple run the updatescripts that have been tested and perfected on the Staging databaseagainst your Production database.
Check out these links:
The Development, Staging, and Production Model
Setting up a DSP Environment -- look especially at the Managing Database Development section, and the Staging Environment section


|||Brilliant. Exactly what I was looking for.
I am just wondering if DSP is a standard method the industry uses, and are there other methods applied to this problem?
Again, thank you for the guidance
Jagdip
|||Just wondering if you have any more links about DSP?
|||Hi Jagdip, I was hoping someone else might chime in. I have noidea if the DSP approach is the industry standard, but it's the methodI've come to employ as a best practice for myself (in ideal situationsat least, sometimes some of the steps have been shortcut) and it is theway I've noticed some of my peers have worked. I've only recentlypicked up on the term "DSP" to be honest. When I read thedescription of the acronym I said to myself, "oh, I didn't know therewas a term appplied to this approach".
I just Googled a bit more and came up with this, which uses the DSP approach without using the term:
Migration to Production
I don't have many further resources for you, I'm afraid. The keyis to make your rollout to production consistently repeatable in yourstaging environment. This way when you go live you have minimizedyour risks as much as possible. I can't imagine an approach thatwould be better.


|||The only real problem we have is with updating the database. Writtingthe SQL scripts and saving then is a great way of keeping documentationon DB updates as well as keeping the existing data. Up until now, mycolleage has been working on the live database!!!!
I have had a word with him and he likes it. So thank you for theadvice. I'm in the process of writting and testing a procedure usingDSP, and I will have a look at the other article you gave me.
I guess the only real problem I have with DSP is that it will reallyslow down our RAD ideal. But the boss asked for something like this, sohe's going to have to live with it :-)

Thursday, March 8, 2012

Complicated Backup Strategy Help Requested

I have a fairly complicated backup scenario I could use some help with.
We have a SQL 2000 database loaded up (by batch processing) to monthly
tables (Table_200507, Table_200508, Table_200509, etc.). Once the
month is complete, the data in that table NEVER changes. Additionally,
once the month is complete, we alter the indexes on that table to 100%
fill factors to conserve space. Because we do batch processing, and it
is easy to recreate lost data, we use SIMPLE recovery mode. So, in
summary, we have one live monthly table, and a slew of older, read-only
monthly archive tables.
I want to implement a solution where after each month is over, I can
backup the data for that single month only. Additionally, I want to
support the ability to restore any single month to a new database.
I thought I would be able to do this with filegroups and filegroup
backups; however, SQL appears to be holding me back. I see 2 problems.
First problem - Can't use SIMPLE recovery model with filegroup backups.
I tried to get around that by setting my database to FULL, creating
the backup, then resetting the database back to SIMPLE. The problem
there is that upon restoring the backup, it wants all the subsequent
log backups (which don't exist) even though the data in that particular
filegroup is unchanged.
Second problem - Need to restore all files to a new database before
database will come online. I tried restoring my single filegroup
backup to a new database. SQL told me it first needed the PRIMARY
filegroup. Fine. I made a backup and restored that PRIMARY filegroup
first. Then I restored my single filegroup backup. Fine. Only
problem is that the database has been left in "Loading" status. I
tried issuing a RESTORE DATABASE WITH RECOVERY and got:
Server: Msg 5180, Level 22, State 1, Line 1
Could not open FCB for invalid file ID 2 in database '<db name>'.
Is there any way to use sql to accomplish my goal of usable monthly
backups? One other limitation is that I do not want to create multiple
databases (complicated business reasoning - please trust me). Any help
or advice with similar situations would be much appreciated.
Thanks.
If you only have one table that has data you need to backup why not BCP out
the data each night and back that file up? If you have a way to reproduce
the database and all the objects in it you can rebuild by bcping the data
back in.
Andrew J. Kelly SQL MVP
<jalbenberg@.yahoo.com> wrote in message
news:1126291436.212696.148970@.g44g2000cwa.googlegr oups.com...
>I have a fairly complicated backup scenario I could use some help with.
> We have a SQL 2000 database loaded up (by batch processing) to monthly
> tables (Table_200507, Table_200508, Table_200509, etc.). Once the
> month is complete, the data in that table NEVER changes. Additionally,
> once the month is complete, we alter the indexes on that table to 100%
> fill factors to conserve space. Because we do batch processing, and it
> is easy to recreate lost data, we use SIMPLE recovery mode. So, in
> summary, we have one live monthly table, and a slew of older, read-only
> monthly archive tables.
> I want to implement a solution where after each month is over, I can
> backup the data for that single month only. Additionally, I want to
> support the ability to restore any single month to a new database.
> I thought I would be able to do this with filegroups and filegroup
> backups; however, SQL appears to be holding me back. I see 2 problems.
> First problem - Can't use SIMPLE recovery model with filegroup backups.
> I tried to get around that by setting my database to FULL, creating
> the backup, then resetting the database back to SIMPLE. The problem
> there is that upon restoring the backup, it wants all the subsequent
> log backups (which don't exist) even though the data in that particular
> filegroup is unchanged.
> Second problem - Need to restore all files to a new database before
> database will come online. I tried restoring my single filegroup
> backup to a new database. SQL told me it first needed the PRIMARY
> filegroup. Fine. I made a backup and restored that PRIMARY filegroup
> first. Then I restored my single filegroup backup. Fine. Only
> problem is that the database has been left in "Loading" status. I
> tried issuing a RESTORE DATABASE WITH RECOVERY and got:
> Server: Msg 5180, Level 22, State 1, Line 1
> Could not open FCB for invalid file ID 2 in database '<db name>'.
> Is there any way to use sql to accomplish my goal of usable monthly
> backups? One other limitation is that I do not want to create multiple
> databases (complicated business reasoning - please trust me). Any help
> or advice with similar situations would be much appreciated.
> Thanks.
>
|||>I want to implement a solution where after each month is over, I can
>backup the data for that single month only. Additionally, I want to
>support the ability to restore any single month to a new database.
Create a "backup DB" on another server and export it there once a month.
ChrisR
"jalbenberg@.yahoo.com" wrote:

> I have a fairly complicated backup scenario I could use some help with.
> We have a SQL 2000 database loaded up (by batch processing) to monthly
> tables (Table_200507, Table_200508, Table_200509, etc.). Once the
> month is complete, the data in that table NEVER changes. Additionally,
> once the month is complete, we alter the indexes on that table to 100%
> fill factors to conserve space. Because we do batch processing, and it
> is easy to recreate lost data, we use SIMPLE recovery mode. So, in
> summary, we have one live monthly table, and a slew of older, read-only
> monthly archive tables.
> I want to implement a solution where after each month is over, I can
> backup the data for that single month only. Additionally, I want to
> support the ability to restore any single month to a new database.
> I thought I would be able to do this with filegroups and filegroup
> backups; however, SQL appears to be holding me back. I see 2 problems.
> First problem - Can't use SIMPLE recovery model with filegroup backups.
> I tried to get around that by setting my database to FULL, creating
> the backup, then resetting the database back to SIMPLE. The problem
> there is that upon restoring the backup, it wants all the subsequent
> log backups (which don't exist) even though the data in that particular
> filegroup is unchanged.
> Second problem - Need to restore all files to a new database before
> database will come online. I tried restoring my single filegroup
> backup to a new database. SQL told me it first needed the PRIMARY
> filegroup. Fine. I made a backup and restored that PRIMARY filegroup
> first. Then I restored my single filegroup backup. Fine. Only
> problem is that the database has been left in "Loading" status. I
> tried issuing a RESTORE DATABASE WITH RECOVERY and got:
> Server: Msg 5180, Level 22, State 1, Line 1
> Could not open FCB for invalid file ID 2 in database '<db name>'.
> Is there any way to use sql to accomplish my goal of usable monthly
> backups? One other limitation is that I do not want to create multiple
> databases (complicated business reasoning - please trust me). Any help
> or advice with similar situations would be much appreciated.
> Thanks.
>
|||Great idea - sometimes the "low tech" solutions are the best ones.
Thanks.

Complicated Backup Strategy Help Requested

I have a fairly complicated backup scenario I could use some help with.
We have a SQL 2000 database loaded up (by batch processing) to monthly
tables (Table_200507, Table_200508, Table_200509, etc.). Once the
month is complete, the data in that table NEVER changes. Additionally,
once the month is complete, we alter the indexes on that table to 100%
fill factors to conserve space. Because we do batch processing, and it
is easy to recreate lost data, we use SIMPLE recovery mode. So, in
summary, we have one live monthly table, and a slew of older, read-only
monthly archive tables.
I want to implement a solution where after each month is over, I can
backup the data for that single month only. Additionally, I want to
support the ability to restore any single month to a new database.
I thought I would be able to do this with filegroups and filegroup
backups; however, SQL appears to be holding me back. I see 2 problems.
First problem - Can't use SIMPLE recovery model with filegroup backups.
I tried to get around that by setting my database to FULL, creating
the backup, then resetting the database back to SIMPLE. The problem
there is that upon restoring the backup, it wants all the subsequent
log backups (which don't exist) even though the data in that particular
filegroup is unchanged.
Second problem - Need to restore all files to a new database before
database will come online. I tried restoring my single filegroup
backup to a new database. SQL told me it first needed the PRIMARY
filegroup. Fine. I made a backup and restored that PRIMARY filegroup
first. Then I restored my single filegroup backup. Fine. Only
problem is that the database has been left in "Loading" status. I
tried issuing a RESTORE DATABASE WITH RECOVERY and got:
Server: Msg 5180, Level 22, State 1, Line 1
Could not open FCB for invalid file ID 2 in database '<db name>'.
Is there any way to use sql to accomplish my goal of usable monthly
backups? One other limitation is that I do not want to create multiple
databases (complicated business reasoning - please trust me). Any help
or advice with similar situations would be much appreciated.
Thanks.If you only have one table that has data you need to backup why not BCP out
the data each night and back that file up? If you have a way to reproduce
the database and all the objects in it you can rebuild by bcping the data
back in.
Andrew J. Kelly SQL MVP
<jalbenberg@.yahoo.com> wrote in message
news:1126291436.212696.148970@.g44g2000cwa.googlegroups.com...
>I have a fairly complicated backup scenario I could use some help with.
> We have a SQL 2000 database loaded up (by batch processing) to monthly
> tables (Table_200507, Table_200508, Table_200509, etc.). Once the
> month is complete, the data in that table NEVER changes. Additionally,
> once the month is complete, we alter the indexes on that table to 100%
> fill factors to conserve space. Because we do batch processing, and it
> is easy to recreate lost data, we use SIMPLE recovery mode. So, in
> summary, we have one live monthly table, and a slew of older, read-only
> monthly archive tables.
> I want to implement a solution where after each month is over, I can
> backup the data for that single month only. Additionally, I want to
> support the ability to restore any single month to a new database.
> I thought I would be able to do this with filegroups and filegroup
> backups; however, SQL appears to be holding me back. I see 2 problems.
> First problem - Can't use SIMPLE recovery model with filegroup backups.
> I tried to get around that by setting my database to FULL, creating
> the backup, then resetting the database back to SIMPLE. The problem
> there is that upon restoring the backup, it wants all the subsequent
> log backups (which don't exist) even though the data in that particular
> filegroup is unchanged.
> Second problem - Need to restore all files to a new database before
> database will come online. I tried restoring my single filegroup
> backup to a new database. SQL told me it first needed the PRIMARY
> filegroup. Fine. I made a backup and restored that PRIMARY filegroup
> first. Then I restored my single filegroup backup. Fine. Only
> problem is that the database has been left in "Loading" status. I
> tried issuing a RESTORE DATABASE WITH RECOVERY and got:
> Server: Msg 5180, Level 22, State 1, Line 1
> Could not open FCB for invalid file ID 2 in database '<db name>'.
> Is there any way to use sql to accomplish my goal of usable monthly
> backups? One other limitation is that I do not want to create multiple
> databases (complicated business reasoning - please trust me). Any help
> or advice with similar situations would be much appreciated.
> Thanks.
>|||>I want to implement a solution where after each month is over, I can
>backup the data for that single month only. Additionally, I want to
>support the ability to restore any single month to a new database.
Create a "backup DB" on another server and export it there once a month.
ChrisR
"jalbenberg@.yahoo.com" wrote:

> I have a fairly complicated backup scenario I could use some help with.
> We have a SQL 2000 database loaded up (by batch processing) to monthly
> tables (Table_200507, Table_200508, Table_200509, etc.). Once the
> month is complete, the data in that table NEVER changes. Additionally,
> once the month is complete, we alter the indexes on that table to 100%
> fill factors to conserve space. Because we do batch processing, and it
> is easy to recreate lost data, we use SIMPLE recovery mode. So, in
> summary, we have one live monthly table, and a slew of older, read-only
> monthly archive tables.
> I want to implement a solution where after each month is over, I can
> backup the data for that single month only. Additionally, I want to
> support the ability to restore any single month to a new database.
> I thought I would be able to do this with filegroups and filegroup
> backups; however, SQL appears to be holding me back. I see 2 problems.
> First problem - Can't use SIMPLE recovery model with filegroup backups.
> I tried to get around that by setting my database to FULL, creating
> the backup, then resetting the database back to SIMPLE. The problem
> there is that upon restoring the backup, it wants all the subsequent
> log backups (which don't exist) even though the data in that particular
> filegroup is unchanged.
> Second problem - Need to restore all files to a new database before
> database will come online. I tried restoring my single filegroup
> backup to a new database. SQL told me it first needed the PRIMARY
> filegroup. Fine. I made a backup and restored that PRIMARY filegroup
> first. Then I restored my single filegroup backup. Fine. Only
> problem is that the database has been left in "Loading" status. I
> tried issuing a RESTORE DATABASE WITH RECOVERY and got:
> Server: Msg 5180, Level 22, State 1, Line 1
> Could not open FCB for invalid file ID 2 in database '<db name>'.
> Is there any way to use sql to accomplish my goal of usable monthly
> backups? One other limitation is that I do not want to create multiple
> databases (complicated business reasoning - please trust me). Any help
> or advice with similar situations would be much appreciated.
> Thanks.
>|||Great idea - sometimes the "low tech" solutions are the best ones.
Thanks.

Complicated Backup Strategy Help Requested

I have a fairly complicated backup scenario I could use some help with.
We have a SQL 2000 database loaded up (by batch processing) to monthly
tables (Table_200507, Table_200508, Table_200509, etc.). Once the
month is complete, the data in that table NEVER changes. Additionally,
once the month is complete, we alter the indexes on that table to 100%
fill factors to conserve space. Because we do batch processing, and it
is easy to recreate lost data, we use SIMPLE recovery mode. So, in
summary, we have one live monthly table, and a slew of older, read-only
monthly archive tables.
I want to implement a solution where after each month is over, I can
backup the data for that single month only. Additionally, I want to
support the ability to restore any single month to a new database.
I thought I would be able to do this with filegroups and filegroup
backups; however, SQL appears to be holding me back. I see 2 problems.
First problem - Can't use SIMPLE recovery model with filegroup backups.
I tried to get around that by setting my database to FULL, creating
the backup, then resetting the database back to SIMPLE. The problem
there is that upon restoring the backup, it wants all the subsequent
log backups (which don't exist) even though the data in that particular
filegroup is unchanged.
Second problem - Need to restore all files to a new database before
database will come online. I tried restoring my single filegroup
backup to a new database. SQL told me it first needed the PRIMARY
filegroup. Fine. I made a backup and restored that PRIMARY filegroup
first. Then I restored my single filegroup backup. Fine. Only
problem is that the database has been left in "Loading" status. I
tried issuing a RESTORE DATABASE WITH RECOVERY and got:
Server: Msg 5180, Level 22, State 1, Line 1
Could not open FCB for invalid file ID 2 in database '<db name>'.
Is there any way to use sql to accomplish my goal of usable monthly
backups? One other limitation is that I do not want to create multiple
databases (complicated business reasoning - please trust me). Any help
or advice with similar situations would be much appreciated.
Thanks.If you only have one table that has data you need to backup why not BCP out
the data each night and back that file up? If you have a way to reproduce
the database and all the objects in it you can rebuild by bcping the data
back in.
--
Andrew J. Kelly SQL MVP
<jalbenberg@.yahoo.com> wrote in message
news:1126291436.212696.148970@.g44g2000cwa.googlegroups.com...
>I have a fairly complicated backup scenario I could use some help with.
> We have a SQL 2000 database loaded up (by batch processing) to monthly
> tables (Table_200507, Table_200508, Table_200509, etc.). Once the
> month is complete, the data in that table NEVER changes. Additionally,
> once the month is complete, we alter the indexes on that table to 100%
> fill factors to conserve space. Because we do batch processing, and it
> is easy to recreate lost data, we use SIMPLE recovery mode. So, in
> summary, we have one live monthly table, and a slew of older, read-only
> monthly archive tables.
> I want to implement a solution where after each month is over, I can
> backup the data for that single month only. Additionally, I want to
> support the ability to restore any single month to a new database.
> I thought I would be able to do this with filegroups and filegroup
> backups; however, SQL appears to be holding me back. I see 2 problems.
> First problem - Can't use SIMPLE recovery model with filegroup backups.
> I tried to get around that by setting my database to FULL, creating
> the backup, then resetting the database back to SIMPLE. The problem
> there is that upon restoring the backup, it wants all the subsequent
> log backups (which don't exist) even though the data in that particular
> filegroup is unchanged.
> Second problem - Need to restore all files to a new database before
> database will come online. I tried restoring my single filegroup
> backup to a new database. SQL told me it first needed the PRIMARY
> filegroup. Fine. I made a backup and restored that PRIMARY filegroup
> first. Then I restored my single filegroup backup. Fine. Only
> problem is that the database has been left in "Loading" status. I
> tried issuing a RESTORE DATABASE WITH RECOVERY and got:
> Server: Msg 5180, Level 22, State 1, Line 1
> Could not open FCB for invalid file ID 2 in database '<db name>'.
> Is there any way to use sql to accomplish my goal of usable monthly
> backups? One other limitation is that I do not want to create multiple
> databases (complicated business reasoning - please trust me). Any help
> or advice with similar situations would be much appreciated.
> Thanks.
>|||>I want to implement a solution where after each month is over, I can
>backup the data for that single month only. Additionally, I want to
>support the ability to restore any single month to a new database.
Create a "backup DB" on another server and export it there once a month.
--
ChrisR
"jalbenberg@.yahoo.com" wrote:
> I have a fairly complicated backup scenario I could use some help with.
> We have a SQL 2000 database loaded up (by batch processing) to monthly
> tables (Table_200507, Table_200508, Table_200509, etc.). Once the
> month is complete, the data in that table NEVER changes. Additionally,
> once the month is complete, we alter the indexes on that table to 100%
> fill factors to conserve space. Because we do batch processing, and it
> is easy to recreate lost data, we use SIMPLE recovery mode. So, in
> summary, we have one live monthly table, and a slew of older, read-only
> monthly archive tables.
> I want to implement a solution where after each month is over, I can
> backup the data for that single month only. Additionally, I want to
> support the ability to restore any single month to a new database.
> I thought I would be able to do this with filegroups and filegroup
> backups; however, SQL appears to be holding me back. I see 2 problems.
> First problem - Can't use SIMPLE recovery model with filegroup backups.
> I tried to get around that by setting my database to FULL, creating
> the backup, then resetting the database back to SIMPLE. The problem
> there is that upon restoring the backup, it wants all the subsequent
> log backups (which don't exist) even though the data in that particular
> filegroup is unchanged.
> Second problem - Need to restore all files to a new database before
> database will come online. I tried restoring my single filegroup
> backup to a new database. SQL told me it first needed the PRIMARY
> filegroup. Fine. I made a backup and restored that PRIMARY filegroup
> first. Then I restored my single filegroup backup. Fine. Only
> problem is that the database has been left in "Loading" status. I
> tried issuing a RESTORE DATABASE WITH RECOVERY and got:
> Server: Msg 5180, Level 22, State 1, Line 1
> Could not open FCB for invalid file ID 2 in database '<db name>'.
> Is there any way to use sql to accomplish my goal of usable monthly
> backups? One other limitation is that I do not want to create multiple
> databases (complicated business reasoning - please trust me). Any help
> or advice with similar situations would be much appreciated.
> Thanks.
>|||Great idea - sometimes the "low tech" solutions are the best ones.
Thanks.

Sunday, February 19, 2012

Compiled plans and syscacheobjects

Hi,
I'm wondering if someone knows what causes a compiled plan to get
dropped from the cache. We've got one fairly complicated procedure
that gets removed from cache every few minutes, and then compiled again
the next time its run. The compile takes 10-15 seconds of cpu. The
procedure is used 10-20 times per minute, so i dont think it's because
of lack of use. And we have other procedures called as often that dont
get dropped so frequently. As well, we have the identical procedure,
named differently (called from a different program) that shows the same
behavior, it gets dropped from the cache frequently.
Could it be related to the data the query is looking it?
Any ideas appreciated. Oh yeah, SQL Server 2000, SP3 i think.
Thanks,
Trevortdunsford@.gmail.com wrote:
> Hi,
> I'm wondering if someone knows what causes a compiled plan to get
> dropped from the cache. We've got one fairly complicated procedure
> that gets removed from cache every few minutes, and then compiled again
> the next time its run. The compile takes 10-15 seconds of cpu. The
> procedure is used 10-20 times per minute, so i dont think it's because
> of lack of use. And we have other procedures called as often that dont
> get dropped so frequently. As well, we have the identical procedure,
> named differently (called from a different program) that shows the same
> behavior, it gets dropped from the cache frequently.
> Could it be related to the data the query is looking it?
> Any ideas appreciated. Oh yeah, SQL Server 2000, SP3 i think.
> Thanks,
> Trevor
>
Does this procedure create temp tables?
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||No, it uses table variables:
declare table @.tbl (...)
insert into @.tbl (...)
select ...
select * from @.tbl
Tracy McKibben wrote:
> tdunsford@.gmail.com wrote:
> > Hi,
> >
> > I'm wondering if someone knows what causes a compiled plan to get
> > dropped from the cache. We've got one fairly complicated procedure
> > that gets removed from cache every few minutes, and then compiled again
> > the next time its run. The compile takes 10-15 seconds of cpu. The
> > procedure is used 10-20 times per minute, so i dont think it's because
> > of lack of use. And we have other procedures called as often that dont
> > get dropped so frequently. As well, we have the identical procedure,
> > named differently (called from a different program) that shows the same
> > behavior, it gets dropped from the cache frequently.
> >
> > Could it be related to the data the query is looking it?
> >
> > Any ideas appreciated. Oh yeah, SQL Server 2000, SP3 i think.
> >
> > Thanks,
> >
> > Trevor
> >
> Does this procedure create temp tables?
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com|||tdunsford@.gmail.com wrote:
> No, it uses table variables:
> declare table @.tbl (...)
> insert into @.tbl (...)
> select ...
> select * from @.tbl
>
Have you reviewed this KB article?
http://support.microsoft.com/kb/243586
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||>From what i can understand, this talks about recompiles. I may be
mistaken, but I dont think thats what i'm seeing here. There is no
sp:recompile event. All the cpu/delay occurs before any of the
statements are executed (ie before SP:Starting).
I see 2 options, KEEP PLAN and KEEPFIXED PLAN. Would this help keep
the compile plan in the cache as well, not just the execution plan?
Because recompiling the execution plan takes no time at all...its the
compile plan thats the killer.
Thanks,
Trevor
Tracy McKibben wrote:
> tdunsford@.gmail.com wrote:
> > No, it uses table variables:
> >
> > declare table @.tbl (...)
> >
> > insert into @.tbl (...)
> > select ...
> >
> > select * from @.tbl
> >
> Have you reviewed this KB article?
> http://support.microsoft.com/kb/243586
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com|||Yes you should look into these. The execution plan is based off the compiled
plan so you can't have an executionplan without the compiled plan.
--
Andrew J. Kelly SQL MVP
<tdunsford@.gmail.com> wrote in message
news:1161355332.974366.216790@.e3g2000cwe.googlegroups.com...
> >From what i can understand, this talks about recompiles. I may be
> mistaken, but I dont think thats what i'm seeing here. There is no
> sp:recompile event. All the cpu/delay occurs before any of the
> statements are executed (ie before SP:Starting).
> I see 2 options, KEEP PLAN and KEEPFIXED PLAN. Would this help keep
> the compile plan in the cache as well, not just the execution plan?
> Because recompiling the execution plan takes no time at all...its the
> compile plan thats the killer.
> Thanks,
> Trevor
>
> Tracy McKibben wrote:
>> tdunsford@.gmail.com wrote:
>> > No, it uses table variables:
>> >
>> > declare table @.tbl (...)
>> >
>> > insert into @.tbl (...)
>> > select ...
>> >
>> > select * from @.tbl
>> >
>> Have you reviewed this KB article?
>> http://support.microsoft.com/kb/243586
>>
>> --
>> Tracy McKibben
>> MCDBA
>> http://www.realsqlguy.com
>

Compiled plans and syscacheobjects

Hi,
I'm wondering if someone knows what causes a compiled plan to get
dropped from the cache. We've got one fairly complicated procedure
that gets removed from cache every few minutes, and then compiled again
the next time its run. The compile takes 10-15 seconds of cpu. The
procedure is used 10-20 times per minute, so i dont think it's because
of lack of use. And we have other procedures called as often that dont
get dropped so frequently. As well, we have the identical procedure,
named differently (called from a different program) that shows the same
behavior, it gets dropped from the cache frequently.
Could it be related to the data the query is looking it?
Any ideas appreciated. Oh yeah, SQL Server 2000, SP3 i think.
Thanks,
Trevor
tdunsford@.gmail.com wrote:
> Hi,
> I'm wondering if someone knows what causes a compiled plan to get
> dropped from the cache. We've got one fairly complicated procedure
> that gets removed from cache every few minutes, and then compiled again
> the next time its run. The compile takes 10-15 seconds of cpu. The
> procedure is used 10-20 times per minute, so i dont think it's because
> of lack of use. And we have other procedures called as often that dont
> get dropped so frequently. As well, we have the identical procedure,
> named differently (called from a different program) that shows the same
> behavior, it gets dropped from the cache frequently.
> Could it be related to the data the query is looking it?
> Any ideas appreciated. Oh yeah, SQL Server 2000, SP3 i think.
> Thanks,
> Trevor
>
Does this procedure create temp tables?
Tracy McKibben
MCDBA
http://www.realsqlguy.com
|||No, it uses table variables:
declare table @.tbl (...)
insert into @.tbl (...)
select ...
select * from @.tbl
Tracy McKibben wrote:
> tdunsford@.gmail.com wrote:
> Does this procedure create temp tables?
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com
|||tdunsford@.gmail.com wrote:
> No, it uses table variables:
> declare table @.tbl (...)
> insert into @.tbl (...)
> select ...
> select * from @.tbl
>
Have you reviewed this KB article?
http://support.microsoft.com/kb/243586
Tracy McKibben
MCDBA
http://www.realsqlguy.com
|||>From what i can understand, this talks about recompiles. I may be
mistaken, but I dont think thats what i'm seeing here. There is no
sp:recompile event. All the cpu/delay occurs before any of the
statements are executed (ie before SP:Starting).
I see 2 options, KEEP PLAN and KEEPFIXED PLAN. Would this help keep
the compile plan in the cache as well, not just the execution plan?
Because recompiling the execution plan takes no time at all...its the
compile plan thats the killer.
Thanks,
Trevor
Tracy McKibben wrote:
> tdunsford@.gmail.com wrote:
> Have you reviewed this KB article?
> http://support.microsoft.com/kb/243586
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com
|||Yes you should look into these. The execution plan is based off the compiled
plan so you can't have an executionplan without the compiled plan.
Andrew J. Kelly SQL MVP
<tdunsford@.gmail.com> wrote in message
news:1161355332.974366.216790@.e3g2000cwe.googlegro ups.com...
> mistaken, but I dont think thats what i'm seeing here. There is no
> sp:recompile event. All the cpu/delay occurs before any of the
> statements are executed (ie before SP:Starting).
> I see 2 options, KEEP PLAN and KEEPFIXED PLAN. Would this help keep
> the compile plan in the cache as well, not just the execution plan?
> Because recompiling the execution plan takes no time at all...its the
> compile plan thats the killer.
> Thanks,
> Trevor
>
> Tracy McKibben wrote:
>

Compiled plans and syscacheobjects

Hi,
I'm wondering if someone knows what causes a compiled plan to get
dropped from the cache. We've got one fairly complicated procedure
that gets removed from cache every few minutes, and then compiled again
the next time its run. The compile takes 10-15 seconds of cpu. The
procedure is used 10-20 times per minute, so i dont think it's because
of lack of use. And we have other procedures called as often that dont
get dropped so frequently. As well, we have the identical procedure,
named differently (called from a different program) that shows the same
behavior, it gets dropped from the cache frequently.
Could it be related to the data the query is looking it?
Any ideas appreciated. Oh yeah, SQL Server 2000, SP3 i think.
Thanks,
Trevortdunsford@.gmail.com wrote:
> Hi,
> I'm wondering if someone knows what causes a compiled plan to get
> dropped from the cache. We've got one fairly complicated procedure
> that gets removed from cache every few minutes, and then compiled again
> the next time its run. The compile takes 10-15 seconds of cpu. The
> procedure is used 10-20 times per minute, so i dont think it's because
> of lack of use. And we have other procedures called as often that dont
> get dropped so frequently. As well, we have the identical procedure,
> named differently (called from a different program) that shows the same
> behavior, it gets dropped from the cache frequently.
> Could it be related to the data the query is looking it?
> Any ideas appreciated. Oh yeah, SQL Server 2000, SP3 i think.
> Thanks,
> Trevor
>
Does this procedure create temp tables?
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||No, it uses table variables:
declare table @.tbl (...)
insert into @.tbl (...)
select ...
select * from @.tbl
Tracy McKibben wrote:
> tdunsford@.gmail.com wrote:
> Does this procedure create temp tables?
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com|||tdunsford@.gmail.com wrote:
> No, it uses table variables:
> declare table @.tbl (...)
> insert into @.tbl (...)
> select ...
> select * from @.tbl
>
Have you reviewed this KB article?
http://support.microsoft.com/kb/243586
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||>From what i can understand, this talks about recompiles. I may be
mistaken, but I dont think thats what i'm seeing here. There is no
sp:recompile event. All the cpu/delay occurs before any of the
statements are executed (ie before SP:Starting).
I see 2 options, KEEP PLAN and KEEPFIXED PLAN. Would this help keep
the compile plan in the cache as well, not just the execution plan?
Because recompiling the execution plan takes no time at all...its the
compile plan thats the killer.
Thanks,
Trevor
Tracy McKibben wrote:
> tdunsford@.gmail.com wrote:
> Have you reviewed this KB article?
> http://support.microsoft.com/kb/243586
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com|||Yes you should look into these. The execution plan is based off the compiled
plan so you can't have an executionplan without the compiled plan.
Andrew J. Kelly SQL MVP
<tdunsford@.gmail.com> wrote in message
news:1161355332.974366.216790@.e3g2000cwe.googlegroups.com...
> mistaken, but I dont think thats what i'm seeing here. There is no
> sp:recompile event. All the cpu/delay occurs before any of the
> statements are executed (ie before SP:Starting).
> I see 2 options, KEEP PLAN and KEEPFIXED PLAN. Would this help keep
> the compile plan in the cache as well, not just the execution plan?
> Because recompiling the execution plan takes no time at all...its the
> compile plan thats the killer.
> Thanks,
> Trevor
>
> Tracy McKibben wrote:
>