|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Programatically Accessing Maintenance Plans through SMOCan anyone point me to any resources on how to programmatically add
databases to maintenance plans through SMO on SQL 2005 preferably using VB? Thanks! Brad Hello Brad,
I understand that you'd like to add database to an task in existing maintenance plan in SQL 2005 by SMO. As for as I know, SMO does not include interface to manage maintenance plans. Manitenance plan components is based on SSIS in SQL 2005. The maintenance plan feature of SQL Server Database Engine requires components of SQL Server 2005 Integration Services (SSIS). To create or execute maintenance plans, you must install SSIS. http://msdn2.microsoft.com/en-us/library/ms187658.aspx Also: http://support.microsoft.com/kb/913967/en-us http://support.microsoft.com/kb/909036/en-us You could find manitenance plan packages is listed under manitance plan entry under msdb folder if you connect to SSIS service in management studio. Acutally you could export the package to a dtsx file and edit the package in VS 2005. Also, you could import a dtsx package into maintenance plan entry so that you could see it under manintenace entry under database engine connection. However, there is no exposed components/interfaces (from SSIS runtime) as I know that we could develop to edit the pacakge directly via code. BTW, the package is stored as binary code in sysdtspackages90 table in msdb database. You could see SSIS architeture from the following link: http://msdn2.microsoft.com/en-us/library/ms403344.aspx I understand it will be more convenient for to be able to change/edit the package by code, and this feedback will be routed to the product team. I also encourage you submit via the link below http://lab.msdn.microsoft.com/productfeedback/default.aspx Since maintance plan is actually SSIS package, you may want to consider create package directly by code and schedule to run packages in SQL jobs automatically: http://msdn2.microsoft.com/en-us/library/ms135991.aspx Also, as MVP Hari once mentioned, there is other option to not use the maintenance plans. You may consider Write your own maintenance scripts to work around the issues. The following links are for your reference: http://www.dbazine.com/sql/sql-articles/cook10 http://realsqlguy.com/serendipity/archives/11-Send-In-Backup!.html If you have futher questions or concerns on this, please feel free to let's know. I look forward to your comments. Thanks! Best Regards, Peter Yang MCSE2000/2003, MCSA, MCDBA Microsoft Online Community Support ================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif ications <http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx>. Note: The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. Please note that each follow up response may take approximately 2 business days as the support professional working with you may need further investigation to reach the most efficient resolution. The offering is not appropriate for situations that require urgent, real-time or phone-based interactions or complex project analysis and dump analysis issues. Issues of this nature are best handled working with a dedicated Microsoft Support Engineer by contacting Microsoft Customer Support Services (CSS) at <http://msdn.microsoft.com/subscriptions/support/default.aspx>. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights. So basically we either have to manage all maintenance plans by hand or
completely script full backups, transaction log backups, optimizations and integrity checks? Those are some great options Microsoft has left us with. Show quoteHide quote "Peter Yang [MSFT]" <pet***@online.microsoft.com> wrote in message news:m%23L0Xmk1GHA.400@TK2MSFTNGXA01.phx.gbl... > Hello Brad, > > I understand that you'd like to add database to an task in existing > maintenance plan in SQL 2005 by SMO. > > As for as I know, SMO does not include interface to manage maintenance > plans. Manitenance plan components is based on SSIS in SQL 2005. The > maintenance plan feature of SQL Server Database Engine requires components > of SQL Server 2005 Integration Services (SSIS). To create or execute > maintenance plans, you must install SSIS. > > http://msdn2.microsoft.com/en-us/library/ms187658.aspx > > Also: > > http://support.microsoft.com/kb/913967/en-us > > http://support.microsoft.com/kb/909036/en-us > > You could find manitenance plan packages is listed under manitance plan > entry under msdb folder if you connect to SSIS service in management > studio. Acutally you could export the package to a dtsx file and edit the > package in VS 2005. Also, you could import a dtsx package into maintenance > plan entry so that you could see it under manintenace entry under database > engine connection. > > However, there is no exposed components/interfaces (from SSIS runtime) as > I > know that we could develop to edit the pacakge directly via code. BTW, the > package is stored as binary code in sysdtspackages90 table in msdb > database. You could see SSIS architeture from the following link: > http://msdn2.microsoft.com/en-us/library/ms403344.aspx > > > I understand it will be more convenient for to be able to change/edit the > package by code, and this feedback will be routed to the product team. I > also encourage you submit via the link below > > http://lab.msdn.microsoft.com/productfeedback/default.aspx > > > Since maintance plan is actually SSIS package, you may want to consider > create package directly by code and schedule to run packages in SQL jobs > automatically: > > http://msdn2.microsoft.com/en-us/library/ms135991.aspx > > > Also, as MVP Hari once mentioned, there is other option to not use the > maintenance plans. You may consider Write your own maintenance scripts to > work around the issues. The following links are for your reference: > > http://www.dbazine.com/sql/sql-articles/cook10 > http://realsqlguy.com/serendipity/archives/11-Send-In-Backup!.html > > If you have futher questions or concerns on this, please feel free to > let's > know. I look forward to your comments. Thanks! > > Best Regards, > > Peter Yang > MCSE2000/2003, MCSA, MCDBA > Microsoft Online Community Support > ================================================== > Get notification to my posts through email? Please refer to > http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif > ications > <http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx>. > Note: The MSDN Managed Newsgroup support offering is for non-urgent issues > where an initial response from the community or a Microsoft Support > Engineer within 1 business day is acceptable. Please note that each follow > up response may take approximately 2 business days as the support > professional working with you may need further investigation to reach the > most efficient resolution. The offering is not appropriate for situations > that require urgent, real-time or phone-based interactions or complex > project analysis and dump analysis issues. Issues of this nature are best > handled working with a dedicated Microsoft Support Engineer by contacting > Microsoft Customer Support Services (CSS) at > <http://msdn.microsoft.com/subscriptions/support/default.aspx>. > ================================================== > This posting is provided "AS IS" with no warranties, and confers no > rights. > Brad Baker wrote:
> So basically we either have to manage all maintenance plans by hand or WHY are you so opposed to creating your own maintenance scripts? The > completely script full backups, transaction log backups, optimizations and > integrity checks? Those are some great options Microsoft has left us with. > backup script that I sent you DOES NOT require you to type in database names. Even if it did, the fact that it is a script enables you to MODIFY IT to suit your needs, something you can't do with the canned tools. Any experienced DBA will tell you that scripts are the way to go. > The backup script that I sent you DOES NOT require you to type in database Based on my understanding utilizing your script would require one of two > names. approaches: 1) Backup all DBS simultaneously - we cannot do this it would take too long. I.E. DB backups would run into prime time when the servers are in use. 2) Setup multiple scripts, type the names of DBs in each script - which is error prone and time consuming. As previously mentioned the other problem with your scripts is that they do not seen to do optimizations or integrity checks. Although I found another TSQL script that does do everything here: http://www.sqldbatips.com/displaycode.asp?ID=26 > Any experienced DBA will tell you that scripts are the way to go. I'm not a DBA. We don't have a DBA on staff. We probably should, but we don't so we have to make due with what we have. So that leaves two options: 1) Hire a DBA/consultant to code this - which will probably be costly 2) Myself or another person on staff has to learn TSQL for the sole purpose of generating maintenance plans. Neither of the approaches above sounds like a good solution but I guess those are the options we've been left with. Show quoteHide quote "Tracy McKibben" <tr***@realsqlguy.com> wrote in message news:4506E78E.5080400@realsqlguy.com... > Brad Baker wrote: >> So basically we either have to manage all maintenance plans by hand or >> completely script full backups, transaction log backups, optimizations >> and integrity checks? Those are some great options Microsoft has left us >> with. >> > > WHY are you so opposed to creating your own maintenance scripts? The > backup script that I sent you DOES NOT require you to type in database > names. Even if it did, the fact that it is a script enables you to MODIFY > IT to suit your needs, something you can't do with the canned tools. Any > experienced DBA will tell you that scripts are the way to go. > > > -- > Tracy McKibben > MCDBA > http://www.realsqlguy.com Brad Baker wrote:
>> The backup script that I sent you DOES NOT require you to type in database With minimal effort, my backup script (or ANY backup script) could be >> names. > > Based on my understanding utilizing your script would require one of two > approaches: > > 1) Backup all DBS simultaneously - we cannot do this it would take too long. > I.E. DB backups would run into prime time when the servers are in use. > > 2) Setup multiple scripts, type the names of DBs in each script - which is > error prone and time consuming. modified to limit what DB's it touches, like by doing databases starting with A-H on Monday, I-Q on Tuesday, R-Z on Wednesday, or whatever you want. > As previously mentioned the other problem with your scripts is that they do I gave you two scripts, one for backups, one for "optimizations", i.e. > not seen to do optimizations or integrity checks. Although I found another rebuilding fragmented indexes. > TSQL script that does do everything here: I'm not a mechanic, but I did learn to change my own oil and do basic > http://www.sqldbatips.com/displaycode.asp?ID=26 > > >> Any experienced DBA will tell you that scripts are the way to go. > > I'm not a DBA. We don't have a DBA on staff. We probably should, but we > don't so we have to make due with what we have. So that leaves two options: > > 1) Hire a DBA/consultant to code this - which will probably be costly > 2) Myself or another person on staff has to learn TSQL for the sole purpose > of generating maintenance plans. car maintenance so I'm not dependent on my car dealership. If you're writing applications that run against SQL Server, shouldn't you know a bit about SQL? > Neither of the approaches above sounds like a good solution but I guess I guess all I can say is "Good luck"...> those are the options we've been left with. > List of Databases:
AABBABA, ABABAAA, AAABABA, BABABAA, BAAABAA Example GUI ======================= [x] AABBABA [x] BABABAA [ ] ABABAAA [x] BAAABAA [x] AAABABA EXAMPLE SCRIPT (pseudo code) ======================= BACKUP: ABABAAA,BABABAA,AAABABA,AABBABA Quick - Tell me which DB isn't being backed up using the GUI, and which DB isn't being backed up with the script. Which takes longer to do? Now imagine that you have 200 databases instead of 5 and maybe you will start to understand why I'd rather work with a GUI than a script. :) Ok so maybe my example is a bit exaggerated but not by far - our DBs use strict naming conventions which are very similar but slightly different. It's easy to inadvertently miss a DB when you're using scripts, versus a GUI with checkboxes. Granted I'm sure there is some way of specifying ranges of databases (A-H, I-J, etc) using a script, but the script would have to be quite a bit more sophisticated. Somehow query for a list of databases (I'm not sure how you would obtain that), and then break them up into ranges (again not sure how the logic on that work?). Regarding your car mechanic analogy - sure I know how to do some basic select, join, update, and delete statements but TSQL certainly looks a heck of a lot more complicated than a few simple SQL statements. I'm assuming you're a DBA so I'm sure these all seems simple to you, but to me, it certainly doesn't. I don't mean to seem ungrateful - I'm sure you're trying to help and I appreciate that. Brad Show quoteHide quote "Tracy McKibben" <tr***@realsqlguy.com> wrote in message news:450708EC.6050305@realsqlguy.com... > Brad Baker wrote: >>> The backup script that I sent you DOES NOT require you to type in >>> database names. >> >> Based on my understanding utilizing your script would require one of two >> approaches: >> >> 1) Backup all DBS simultaneously - we cannot do this it would take too >> long. I.E. DB backups would run into prime time when the servers are in >> use. >> >> 2) Setup multiple scripts, type the names of DBs in each script - which >> is error prone and time consuming. > > With minimal effort, my backup script (or ANY backup script) could be > modified to limit what DB's it touches, like by doing databases starting > with A-H on Monday, I-Q on Tuesday, R-Z on Wednesday, or whatever you > want. > >> As previously mentioned the other problem with your scripts is that they >> do not seen to do optimizations or integrity checks. Although I found >> another > > I gave you two scripts, one for backups, one for "optimizations", i.e. > rebuilding fragmented indexes. > >> TSQL script that does do everything here: >> http://www.sqldbatips.com/displaycode.asp?ID=26 >> >> >>> Any experienced DBA will tell you that scripts are the way to go. >> >> I'm not a DBA. We don't have a DBA on staff. We probably should, but we >> don't so we have to make due with what we have. So that leaves two >> options: >> >> 1) Hire a DBA/consultant to code this - which will probably be costly >> 2) Myself or another person on staff has to learn TSQL for the sole >> purpose of generating maintenance plans. > > I'm not a mechanic, but I did learn to change my own oil and do basic car > maintenance so I'm not dependent on my car dealership. If you're writing > applications that run against SQL Server, shouldn't you know a bit about > SQL? > > >> Neither of the approaches above sounds like a good solution but I guess >> those are the options we've been left with. >> > > I guess all I can say is "Good luck"... > > > -- > Tracy McKibben > MCDBA > http://www.realsqlguy.com Hello Brad,
I guess product team may think the requirement to edit the packages directly is limited. Anyway, this is a great idea for a future product enhancement and you may submit your feedback directly to product team as I mentioned. Currently, if you need more flexsiblity on this, creating maintenance script might be a better option. Thank you for your understanding. Best Regards, Peter Yang MCSE2000/2003, MCSA, MCDBA Microsoft Online Partner Support ===================================================== This posting is provided "AS IS" with no warranties, and confers no rights. ======================================================
Cannot see system views?
How to calculate a 5 minute running average? Script for importing Windows active directory domain user accounts? How do I run a DTS package from vb.net SQL2K: Query to consolidate multiple rows into single row with additional data? Is "inner join" the same as "join"? ACCESS TO MSSQL Incorrect syntax near the keyword 'AS'. Data Manipulation Server: Msg 8623 - The query processor could not produce a query p Trouble with Stored Procedure - SQL 2005 |
|||||||||||||||||||||||