Tuesday, March 27, 2012

Backup SQL database without using Enterprise Manager?

Hello,

Is there a way where I can backup SQL database without using Enterprise Manager? If there is, may I know how?Use the OSQL command line tool. This allows you to execute TSQL code. Use the BACKUP TSQL Command:


-- Create the backup device for the full MyNwind backup.
USE master
EXEC sp_addumpdevice 'disk', 'MyNwind_2',
'c:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\MyNwind_2.dat'

--Create the log backup device.
USE master
EXEC sp_addumpdevice 'disk', 'MyNwindLog1',
'c:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\MyNwindLog1.dat'

-- Back up the full MyNwind database.
BACKUP DATABASE MyNwind TO MyNwind_2

-- Update activity has occurred since the full database backup.

-- Back up the log of the MyNwind database.
BACKUP LOG MyNwind
TO MyNwindLog1

|||Thanks for the SQL script. But how do I run it if I don't have Query Analyzer? Is there any tools that will enable me to run it?

Basically I have this situation when MS SQL Server (or SQL Server Tools) is not installed in my PC but I need to backup a SQL database.|||As I mentioned, there is a command line tool, called OSQL.EXE, that will allow you to run an SQL Script, and it is included with any install of SQL Server or MSDE, AFAIK.sql

No comments:

Post a Comment