Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


How to create a database backup using visual studio


How to create a database backup using visual studio

Author
Message
calbimonte.daniel
calbimonte.daniel
SSC Veteran
SSC Veteran (206 reputation)SSC Veteran (206 reputation)SSC Veteran (206 reputation)SSC Veteran (206 reputation)SSC Veteran (206 reputation)SSC Veteran (206 reputation)SSC Veteran (206 reputation)SSC Veteran (206 reputation)

Group: General Forum Members
Points: 206 Visits: 416
Comments posted to this topic are about the item How to create a database backup using visual studio
vinaypugalia
vinaypugalia
SSC Rookie
SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)

Group: General Forum Members
Points: 27 Visits: 271
Hi, you can even go for using SMO to get your task done in a more easy way. Please refer this msdn link.

-Vinay Pugalia
If a post answers your question, please click "Mark As Answer" on that post.
Web : Inkey Solutions
Blog : My Blog
Email : Vinay Pugalia
Perry Whittle
Perry Whittle
SSChampion
SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)

Group: General Forum Members
Points: 10753 Visits: 16786
Agreed, use the backup.sqlbackup method via SMO. You'll also be able to display a nice little progress bar too

-----------------------------------------------------------------------------------------------------------

"Ya can't make an omelette without breaking just a few eggs" ;-)
Drenlin
Drenlin
SSC Veteran
SSC Veteran (225 reputation)SSC Veteran (225 reputation)SSC Veteran (225 reputation)SSC Veteran (225 reputation)SSC Veteran (225 reputation)SSC Veteran (225 reputation)SSC Veteran (225 reputation)SSC Veteran (225 reputation)

Group: General Forum Members
Points: 225 Visits: 165
I am in a situation of being an accidental DBA to databases that are controlled by 3rd party. We are allowed to perform tasks on the engine but not allowed to add stored procedures. Backups is a role we need to perform and I am also currenlty looking at maintenance plans.

I like the idea of this C# backup application but unsure what route I should take:
Put the stored procedure in the master database
or
Try and work out how to do the same but without the stored procedure

What are the thoughts of the community?
vinaypugalia
vinaypugalia
SSC Rookie
SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)

Group: General Forum Members
Points: 27 Visits: 271
Adding any User objects to the Master DB is a very BAD idea. There are many ways you could achieve the backups -
1. Schedule the Backups using SQL Jobs.
2. If your version does not support it, you can create a .sql script file for backup and execute it using sqlcmd from the command prompt.
3. You can even schedule a batch file in your OS which intern would be calling the SQLCMD command.
4. Use SMO as I have already suggested.

Hope, this helps!

-Vinay Pugalia
If a post answers your question, please click "Mark As Answer" on that post.
Web : Inkey Solutions
Blog : My Blog
Email : Vinay Pugalia
Resender
Resender
SSC-Addicted
SSC-Addicted (491 reputation)SSC-Addicted (491 reputation)SSC-Addicted (491 reputation)SSC-Addicted (491 reputation)SSC-Addicted (491 reputation)SSC-Addicted (491 reputation)SSC-Addicted (491 reputation)SSC-Addicted (491 reputation)

Group: General Forum Members
Points: 491 Visits: 1564
While the topic is interesting why would you need to have this.

MS SQL server already has plenty of backup tools, it would be handy for those rdbms that rely on command line rather then GUI interface.
Drenlin
Drenlin
SSC Veteran
SSC Veteran (225 reputation)SSC Veteran (225 reputation)SSC Veteran (225 reputation)SSC Veteran (225 reputation)SSC Veteran (225 reputation)SSC Veteran (225 reputation)SSC Veteran (225 reputation)SSC Veteran (225 reputation)

Group: General Forum Members
Points: 225 Visits: 165
@vineypugalia - Thank you for the comments. I shall leave the Master database alone then.

@resender - There will be cases when something like this will be useful. With the software I am supporting, some of the customers have the database on their site and we have to provide the tools to perform the backups and support things remotely. Currently the backup is a batch file that runs the commandline version of a 3rd party application that deals with backups, attach and detachment of databases. I would rather provide some dedicated backup application that can check dates of the backup file created. DOS can't do this and I have more knowledge on C# tahn powershell. I guess I shall have to dive into Powershell.
jose.manuel.corral
jose.manuel.corral
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
Points: 1 Visits: 6
I think there is a bad example of how to make a tool to backup a database.
In my opinion you have to use SMO (a good example is this http://www.sqlserverclub.com/articles/introduction-to-sql-server-shared-management-objects-smo.aspx). If you don't know C# maybe you couldn't write a technical article or maybe you could write in other medias like a forum or in your blog.

I have the email subscription to this website since 2 years and I never have seen an article like this. I read every article with lot of patience, there are lot of very complete articles and there are another non-complete articles, but in general the technical skills of the articles are good.

I'm Sorry to be picky about the technical article, I encourage you to keep writing and you post something with more consistency on SMO.

A lot of spirit.

PS: I'm Sorry for my english, I am learning still.
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (51K reputation)SSC Guru (51K reputation)SSC Guru (51K reputation)SSC Guru (51K reputation)SSC Guru (51K reputation)SSC Guru (51K reputation)SSC Guru (51K reputation)SSC Guru (51K reputation)

Group: General Forum Members
Points: 51429 Visits: 40305
vinaypugalia (3/30/2012)
Adding any User objects to the Master DB is a very BAD idea.


Heh... At the risk of starting World War III, you are denying yourself one amazing tool for DBA's. Yeah, yeah... I know all the warnings everyone gives about MS maybe some day picking the same name as one of your procs (easily prevented by thoughtful naming) and MS maybe overwriting all of the master database and destroying your procs (easily overcome with a distribution sproc properly maintained in source control) but, as parenthetically indicated, those are minor almost trivial obstacles.

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
Although they tell us that they want it real bad, our primary goal is to ensure that we dont actually give it to them that way.
Although change is inevitable, change for the better is not.
Just because you can do something in PowerShell, doesnt mean you should. Wink

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Drenlin
Drenlin
SSC Veteran
SSC Veteran (225 reputation)SSC Veteran (225 reputation)SSC Veteran (225 reputation)SSC Veteran (225 reputation)SSC Veteran (225 reputation)SSC Veteran (225 reputation)SSC Veteran (225 reputation)SSC Veteran (225 reputation)

Group: General Forum Members
Points: 225 Visits: 165
This is what I like about forums. Different viewpoints so I can then look at what would suit our situation best. As with everything, there is no single solution.

Perhaps I was too hasty in accepting the quickest reply but all the comments will be looked at openly. I will admit I am scared to insert something into the Master database but unsure if this was just me being so fresh to DBA tasks.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search