KenshiroM
asked on
How do i change the Backup Folder Destination (SQL Server 2005)
Hi Guys,
I am doing an automatic backup of my databases, and they are being saved on C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backu p. Since i dont have enough space on the C drive, i want that they automatically go to a specified destination on another Hard Drive.
This is the code im using:
<--- Start--->
declare @cmd nvarchar(2000)
declare bcur cursor for
SELECT N'BACKUP DATABASE ' + name + ' TO DISK = '''+name+'-Data''
WITH NAME = N'''+name+'-Full Database Backup'', DESCRIPTION = N''Full Production Instance'', MEDIANAME = N'''+name+'Media'', MEDIADESCRIPTION = N'''+name+' Backup Media Set'', FORMAT, INIT'
FROM master..sysdatabases
WHERE name NOT LIKE 'TempDB'
open bcur
fetch next from bcur into @cmd
WHILE @@FETCH_STATUS = 0
begin
exec sp_executesql @cmd
fetch next from bcur into @cmd
end
close bcur
deallocate bcur
<--- End of Code--->
I am doing an automatic backup of my databases, and they are being saved on C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backu
This is the code im using:
<--- Start--->
declare @cmd nvarchar(2000)
declare bcur cursor for
SELECT N'BACKUP DATABASE ' + name + ' TO DISK = '''+name+'-Data''
WITH NAME = N'''+name+'-Full Database Backup'', DESCRIPTION = N''Full Production Instance'', MEDIANAME = N'''+name+'Media'', MEDIADESCRIPTION = N'''+name+' Backup Media Set'', FORMAT, INIT'
FROM master..sysdatabases
WHERE name NOT LIKE 'TempDB'
open bcur
fetch next from bcur into @cmd
WHILE @@FETCH_STATUS = 0
begin
exec sp_executesql @cmd
fetch next from bcur into @cmd
end
close bcur
deallocate bcur
<--- End of Code--->
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Here's a registry key you can modify, however:
HKEY_LOCAL_MACHINE\SOFTWAR