Solved

MSSQL Backup

Posted on 2010-11-09
7
469 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
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.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

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.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

911 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

19 Experts available now in Live!

Get 1:1 Help Now