[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

MSSQL Backup

Posted on 2010-11-09
7
Medium Priority
?
509 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 500 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Suggested Courses

650 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