Solved

MSSQL Backup

Posted on 2010-11-09
7
484 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
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

A quick step-by-step overview of installing and configuring Carbonite Server Backup.
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
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.

860 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