?
Solved

sql server 2008 full bakup every night

Posted on 2012-08-21
4
Medium Priority
?
401 Views
Last Modified: 2012-08-26
hello experts, how I can make a full bakup every night. In addition to the name of the backup has the date and time
0
Comment
Question by:enrique_aeo
  • 2
4 Comments
 
LVL 1

Assisted Solution

by:smoutkast
smoutkast earned 668 total points
ID: 38319183
Hi Enrique. hopefully the link below can help you out

http://stackoverflow.com/questions/3180007/how-to-schedule-backup-in-sql-server-2008
0
 
LVL 9

Assisted Solution

by:Vijaya Reddy Pinnapa Reddy
Vijaya Reddy Pinnapa Reddy earned 1332 total points
ID: 38319239
1. Create to a job and configure schedule to run the job daily at specific time.

The script to run everyday to take back is:

DECLARE @name VARCHAR(50) -- database name 
DECLARE @path VARCHAR(256) -- path for backup files 
DECLARE @fileName VARCHAR(256) -- filename for backup 
DECLARE @fileDate VARCHAR(20) -- used for file name 

SET @path = 'C:\Backup\' 

SELECT @fileDate = CONVERT(VARCHAR(20),GETDATE(),112) 

DECLARE db_cursor CURSOR FOR 
SELECT name 
FROM master.dbo.sysdatabases 
WHERE name='databasename'

OPEN db_cursor 
FETCH NEXT FROM db_cursor INTO @name 

WHILE @@FETCH_STATUS = 0 
BEGIN 
SET @fileName = @path + @name + '_' + @fileDate + '.BAK' 
BACKUP DATABASE @name TO DISK = @fileName 

FETCH NEXT FROM db_cursor INTO @name 
END 

CLOSE db_cursor 
DEALLOCATE db_cursor 

Open in new window


Also refer the following docs.
http://msdn.microsoft.com/en-us/library/ms190268
http://msdn.microsoft.com/en-us/library/ms191439
http://www.mssqltips.com/sqlservertip/1070/simple-script-to-backup-all-sql-server-databases/
0
 

Author Comment

by:enrique_aeo
ID: 38319930
can you explain me
1. Create to a job and configure schedule to run the job daily at specific time.
0
 
LVL 9

Accepted Solution

by:
Vijaya Reddy Pinnapa Reddy earned 1332 total points
ID: 38319994
Go through the following link to create a job.
http://msdn.microsoft.com/en-us/library/ms190268

Expand the SQL server agent
Right click on 2nd right click on jobs --> select create new job
1) Give the name of the job
2)In step, click on new give the name of the step and copy the above command in command box
3)In schedules give name and in the schedule type select "Recurring".
In the Occurs, select Daily and provide the details etc.
If you want configure remaing(alerts,notifications,Targets) options, otherwise click ok.

This job will be executed everyday at scheduled time.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

839 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