Solved

MSSQL Backup

Posted on 2010-11-09
7
458 Views
Last Modified: 2012-05-10
I have created a batch file to do a backup of our server data using the xcopy command and that worked properly. I want to backup my MSSQL database using the same batch file, what sequence of commands do I need to backup my MSSQL Database called "test"?

My OS is SBS 2003. please ote that i dont want to use NTbackup...
0
Comment
Question by:Abbas Haidar
7 Comments
 
LVL 10

Expert Comment

by:Humpdy
ID: 34091740
Is it SQL Express ?
0
 
LVL 10

Expert Comment

by:Humpdy
ID: 34091750
0
 
LVL 1

Expert Comment

by:FirstMM
ID: 34091754
Hi, if I am speaking out of turn then I apologise.
I am not sure if you will be able to restore backups made by xcopy.
Are you copying the SQL server automated backup files (made by SQL server) or backing up the .mdf/.ldf files in the DATA folder?
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 10

Expert Comment

by:Humpdy
ID: 34091762
I think the poster wants to be able to do a SQL backup from within a batch file which he is using already.

adding this into it should do the trick.

cd (locaction where oSQL exe is)
oSQL -E -S server\datbase
backup database database_name to disk='d:\location\db.bak'
go
0
 
LVL 10

Accepted Solution

by:
Humpdy earned 125 total points
ID: 34091775
BTW, you don't want to do a copy of the mdf and ldf file. You probably won't be able to restore that correctly. You have do a SQL backup, like oSQL.
you could also kick off an SSIS package but that's more complex.
0
 
LVL 7

Author Comment

by:Abbas Haidar
ID: 34091778
you are right Humpdy, I want to backup the MSSQL 2005 Databse to my external hard drive using a batch file, I will try your solution and see :D.

thanks
0
 
LVL 3

Expert Comment

by:DDB
ID: 34103625
I have 3 Store Procedures that creates database backups (FULL, DIFF, LOGs). I scheuled 3 separate jobs with SQL Server agent to run backups. I also have another batch command (.bat) file that copies my backup to external drive ising Windows scheduler. I notice that COPY or Xcopy sometimes does not work so I used ROBOCOPY.  
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

Suggested Solutions

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Learn about cloud computing and its benefits for small business owners.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Viewers will learn how the fundamental information of how to create a table.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now