473,756 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calling SQL Server backup maintenance plan from VB program ?

I have created a backup maintenance plan in SQL Server 2005. Is there any
way to run/execute this SQL Server backup maintenance plan from VB.NET ?
Thank you.
Jul 3 '07 #1
4 3691
"fniles" <fn****@pfmail. comwrote in
news:Oy******** ******@TK2MSFTN GP03.phx.gbl:
I have created a backup maintenance plan in SQL Server 2005. Is there
any way to run/execute this SQL Server backup maintenance plan from
VB.NET ? Thank you.
Take a look at the new SQL Management Objects (SMO). I think you can call a
backup plan from there.

http://msdn2.microsoft.com/en-
us/library/microsoft.sqlse rver.management .smo.backup.asp x
Jul 3 '07 #2
or you can also connect using any API and just execute sp_start_job.

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Spam Catcher" <sp**********@r ogers.comwrote in message
news:Xn******** *************** ***********@127 .0.0.1...
"fniles" <fn****@pfmail. comwrote in
news:Oy******** ******@TK2MSFTN GP03.phx.gbl:
>I have created a backup maintenance plan in SQL Server 2005. Is there
any way to run/execute this SQL Server backup maintenance plan from
VB.NET ? Thank you.

Take a look at the new SQL Management Objects (SMO). I think you can call a
backup plan from there.

http://msdn2.microsoft.com/en-
us/library/microsoft.sqlse rver.management .smo.backup.asp x

Jul 3 '07 #3
Thank you.
I tried the following but got an error
Dim srv As Server
srv = New Server("SQLServ ermachinename")
Dim db As Database
db = srv.Databases(" myDbName") --error "Failed to connect to
server SQLServermachin ename

Do I need to supply either the srv or db with the User ID and password ?
Is it correct that for New Server I want to set "SQLServermachi nename" to it
?

Thank you.

"Spam Catcher" <sp**********@r ogers.comwrote in message
news:Xn******** *************** ***********@127 .0.0.1...
"fniles" <fn****@pfmail. comwrote in
news:Oy******** ******@TK2MSFTN GP03.phx.gbl:
>I have created a backup maintenance plan in SQL Server 2005. Is there
any way to run/execute this SQL Server backup maintenance plan from
VB.NET ? Thank you.

Take a look at the new SQL Management Objects (SMO). I think you can call
a
backup plan from there.

http://msdn2.microsoft.com/en-
us/library/microsoft.sqlse rver.management .smo.backup.asp x

Jul 5 '07 #4
Dim srv As Server
srv = New Server("SQLServ ermachinename")
Above will use Windows authentication to connect to the specified server name. If you want to
connect to a named instance, well, you specify the server\instance name just as in any application.
If you want to use SQL authentication, you need to use a ServerConnectio n object. See:
ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/smo9/html/a17f72ef-e02b-47af-b58a-c4219b5bba81.ht m

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"fniles" <fn****@pfmail. comwrote in message news:uI******** ******@TK2MSFTN GP05.phx.gbl...
Thank you.
I tried the following but got an error
Dim srv As Server
srv = New Server("SQLServ ermachinename")
Dim db As Database
db = srv.Databases(" myDbName") --error "Failed to connect to server SQLServermachin ename

Do I need to supply either the srv or db with the User ID and password ?
Is it correct that for New Server I want to set "SQLServermachi nename" to it ?

Thank you.

"Spam Catcher" <sp**********@r ogers.comwrote in message
news:Xn******** *************** ***********@127 .0.0.1...
>"fniles" <fn****@pfmail. comwrote in
news:Oy******* *******@TK2MSFT NGP03.phx.gbl:
>>I have created a backup maintenance plan in SQL Server 2005. Is there
any way to run/execute this SQL Server backup maintenance plan from
VB.NET ? Thank you.

Take a look at the new SQL Management Objects (SMO). I think you can call a
backup plan from there.

http://msdn2.microsoft.com/en-
us/library/microsoft.sqlse rver.management .smo.backup.asp x

Jul 6 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1993
by: jwbeaty | last post by:
Here's a weird one. I'm running SQL Server 7 and when I run a backup something weird happens. When I perform the backup via Enterprise Manager by right clicking on the database I want to backup, I click on OK but no progress blocks show up in the window showing you the status of the backup. The completion window pops up saying that the DB has been backed up. OK--Fine, maybe the backup is really quick. Then, through Explorer, I look...
1
1821
by: cloverme | last post by:
The database is configured for single publisher, many subscribers, merge replication. The maintenance plan started to fail a couple of months ago and the database would not get backed up. After clearing all the locks, I am able to backup the database manually. The locks return again and I'm not able to backup the database with the maintenance plan. How can I get around the lock issue or solve it so that I can backup the database again?...
9
9950
by: tech_guru | last post by:
Hello!! I am relatively new to SQL and am having a problem. I have taken over a SQL 2000 db that did not have any backup plans scheduled for it. I created a maintenance plan that backs up the database every night and another plan that backs up the system databases once a week. I ran both these jobs successfully, but when I created a third plan to backup the transaction log it fails with the following message: Executed as user: NT...
0
1332
by: Mike | last post by:
In SQL 2000 I have been using Log Shipping to keep a warm backup copy of all my production databases in a different site. Prior to setting up my Maintenance Plan to implement log shipping, on my Secondary server I create the warm backups using the following statement: RESTORE DATABASE ProdDB FROM DISK = 'E:\Backup\ProdDB\ProdDB.bak' WITH MOVE 'ProdDB_Data' TO 'E:\DATA\ProdDB.mdf', MOVE 'ProdDB_Log' TO 'E:\DATA\ProdDB.ldf', STANDBY =...
1
3638
by: microsoft . public . sqlserver | last post by:
I am using SQL server 7.0. After restoring all the databses (Except distribution) Everything seems to be working fine except the backup maintenance plan. I put following detail in the maintenance plan "General Tab: Plan Name --- DB Maintenance Plan1 () All Databases Optimizations tab:
2
1540
by: mmohammed | last post by:
Hi All, I am trying to Schedule a full backup and a transaction log backup in sql server 2005 using Maintenance Plan.My requirement is to schedule these two backups at different time say 10pm and 10.30 pm daily.But when i am using Maintenance Plan it only allows me to schedule both jobs at one time that is it shows only Maintenance Plan Schedule in which you can have only one schedule. Can anyone please tell me...
0
1786
by: mmohammed | last post by:
Hi All, I am trying to Schedule a full backup and a transaction log backup in sql server 2005 using Maintenance Plan.My requirement is to schedule these two backups at different time say 10pm and 10.30 pm daily.But when i am using Maintenance Plan it only allows me to schedule both jobs at one time that is it shows only Maintenance Plan Schedule in which you can have only one schedule. Can anyone please tell me how to schedule these two...
0
1461
by: pk | last post by:
I have a problem that I would like to resolve through scripting, but I'm not sure how to go about it (or if it's even possible.) We're trying to work around a bug ( http://support.microsoft.com/default.aspx?scid=kb;en-us;303292&Product=sql2k ) that requires us to split up our maintenance plan into two parts. In the first, we backup "All User Databases". This runs fine. The second maintenance plan backs up the transaction logs and then...
2
1724
by: robboll | last post by:
Maybe I am asking for the world, but it seems to me that I should be able to run some scripts against a SQL Server to derive everything of interest to a database administrator. Things like: Server Name Database Name Database Owner (DBO) File Group(s) Users and Permissions Database Size/Log File Size and Space Available
0
9462
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9287
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10046
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9886
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9857
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5318
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3817
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3369
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2677
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.