Showing posts with label masterexec. Show all posts
Showing posts with label masterexec. Show all posts

Thursday, March 8, 2012

backups...

Hello all I have this T-SQL string.
Use master
Exec sp_addumpdevice 'disk', 'dbEvents_backup',
'\\pmafiles\X$\SQL\TMS\dbEvents\eventsba
ckup'
Backup Database dbEvents to dbEvents_backup
Exec sp_dropdevice 'dbEvents_backup'
I have two questions
When the backup runs it isn't writing over the existing backup. It
seems to be appending the information.
Secondly, is it this an effective approach in:
adding the dumpdevice
backing it up
and then deleting the device
thanksvncntj@.hotmail.com wrote:
> Hello all I have this T-SQL string.
>
> Use master
> Exec sp_addumpdevice 'disk', 'dbEvents_backup',
> '\\pmafiles\X$\SQL\TMS\dbEvents\eventsba
ckup'
> Backup Database dbEvents to dbEvents_backup
> Exec sp_dropdevice 'dbEvents_backup'
>
> I have two questions
> When the backup runs it isn't writing over the existing backup. It
> seems to be appending the information.
> Secondly, is it this an effective approach in:
> adding the dumpdevice
> backing it up
> and then deleting the device
> thanks
>
You can skip the creation/deletion of the backup device by using TO DISK
in your backup command. To overwrite the existing backup, add WITH INIT
to the backup command. See Books Online for details.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||vncntj@.hotmail.com wrote:
> Hello all I have this T-SQL string.
>
> Use master
> Exec sp_addumpdevice 'disk', 'dbEvents_backup',
> '\\pmafiles\X$\SQL\TMS\dbEvents\eventsba
ckup'
> Backup Database dbEvents to dbEvents_backup
> Exec sp_dropdevice 'dbEvents_backup'
>
> I have two questions
> When the backup runs it isn't writing over the existing backup. It
> seems to be appending the information.
> Secondly, is it this an effective approach in:
> adding the dumpdevice
> backing it up
> and then deleting the device
> thanks
>
Hi
Like mentioned by Tracy, you can skip creation of the device by backing
up to disk, but I wonder why you drop the device after every backup if
it's the same device you add again next time?
Regards
Steen Schlter Persson
Databaseadministrator / Systemadministrator|||YOU GUYS ROCK!!!!!!!!!!
Steen Persson (DK) wrote:
> vncntj@.hotmail.com wrote:
> Hi
> Like mentioned by Tracy, you can skip creation of the device by backing
> up to disk, but I wonder why you drop the device after every backup if
> it's the same device you add again next time?
>
> --
> Regards
> Steen Schl=FCter Persson
> Databaseadministrator / Systemadministrator
> --020001090101040705090406
> Content-Type: text/html; charset=3DISO-8859-1
> X-Google-AttachSize: 1287
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
> <head>
> <meta content=3D"text/html;charset=3DISO-8859-1" http-equiv=3D"Content-=
Type">
> </head>
> <body bgcolor=3D"#ffffff" text=3D"#000000">
> <a class=3D"moz-txt-link-abbreviated" href=3D"mailto:vncntj@.hotmail.com">=
vncntj@.hotmail.com</a> wrote:
> <blockquote
> cite=3D"mid1152217677.737502.210350@.m73g2000cwd.googlegroups.com"
> type=3D"cite">
> <pre wrap=3D"">Hello all I have this T-SQL string.
>
> Use master
> Exec sp_addumpdevice 'disk', 'dbEvents_backup',
> '\\pmafiles\X$\SQL\TMS\dbEvents\eventsba
ckup'
> Backup Database dbEvents to dbEvents_backup
> Exec sp_dropdevice 'dbEvents_backup'
>
> I have two questions
> When the backup runs it isn't writing over the existing backup. It
> seems to be appending the information.
> Secondly, is it this an effective approach in:
> adding the dumpdevice
> backing it up
> and then deleting the device
> thanks
> </pre>
> </blockquote>
> <font size=3D"-1"><font face=3D"Arial">Hi<br>
> <br>
> Like mentioned by Tracy, you can skip creation of the device by backing
> up to disk, but I wonder why you drop the device after every backup if
> it's the same device you add again next time?<br>
> <br>
> <br>
> -- <br>
> Regards<br>
> Steen Schlüter Persson<br>
> Databaseadministrator / Systemadministrator<br>
> </font></font>
> </body>
> </html>
>=20
> --020001090101040705090406--

Friday, February 10, 2012

backup to network drive

I'm trying to create a job to backup to a network drive. The following SQL does not execute successfully:
USE master
EXEC sp_addumpdevice 'disk', 'Thurs6', '\\servername\DATA\SQL\Backup\Thursday 6 PM.txt'
BACKUP LOG Mock8 TO Thurs6 WITH INIT
However, if I change the destination file to one located on the SQL server, it executes fine. I've also tried this using a mapped drive letter, and that doesn't work either. Any thoughts?
Backups are done under the account that sql server runs under and not the
account you are logged on as. So if SQL Server is not running under a domain
account with access to that share it can not see it.
Andrew J. Kelly SQL MVP
"mike" <mike@.discussions.microsoft.com> wrote in message
news:85586673-2350-4BC0-A64D-4B2664703C92@.microsoft.com...
> I'm trying to create a job to backup to a network drive. The following SQL
does not execute successfully:
> USE master
> EXEC sp_addumpdevice 'disk', 'Thurs6',
'\\servername\DATA\SQL\Backup\Thursday 6 PM.txt'
> BACKUP LOG Mock8 TO Thurs6 WITH INIT
> However, if I change the destination file to one located on the SQL
server, it executes fine. I've also tried this using a mapped drive letter,
and that doesn't work either. Any thoughts?
|||It could be that the account used by SQL Server doesn't have permissions to
that share. Can you post the exact error messages?
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
"mike" <mike@.discussions.microsoft.com> wrote in message
news:85586673-2350-4BC0-A64D-4B2664703C92@.microsoft.com...
> I'm trying to create a job to backup to a network drive. The following SQL
does not execute successfully:
> USE master
> EXEC sp_addumpdevice 'disk', 'Thurs6',
'\\servername\DATA\SQL\Backup\Thursday 6 PM.txt'
> BACKUP LOG Mock8 TO Thurs6 WITH INIT
> However, if I change the destination file to one located on the SQL
server, it executes fine. I've also tried this using a mapped drive letter,
and that doesn't work either. Any thoughts?
|||Hi,
To solve the issue you have start the SQL Server service using an Domain OS
user which got write access to the remote share.
So go to Control Panel -- Admin Tools -- Services -- MSSQL Server sercice--
Double click and select the "Log on" option.
There you give a Valid Domain OS user and password to start the service. Now
stop and start the MSSQL Serevr service.
Note: That domain user should have previlages in the remote share to write
the file as well as prev. to start the SQL server.
After this you try to execute the Backup database command in Query
Analyzer:-
USE master
go
EXEC sp_addumpdevice 'disk', 'Thurs6',
'\\servername\DATA\SQL\Backup\Thursday 6 PM.txt'
go
BACKUP LOG Mock8 TO Thurs6 WITH INIT
Thanks
Hari
MCDBA
"mike" <mike@.discussions.microsoft.com> wrote in message
news:85586673-2350-4BC0-A64D-4B2664703C92@.microsoft.com...
> I'm trying to create a job to backup to a network drive. The following SQL
does not execute successfully:
> USE master
> EXEC sp_addumpdevice 'disk', 'Thurs6',
'\\servername\DATA\SQL\Backup\Thursday 6 PM.txt'
> BACKUP LOG Mock8 TO Thurs6 WITH INIT
> However, if I change the destination file to one located on the SQL
server, it executes fine. I've also tried this using a mapped drive letter,
and that doesn't work either. Any thoughts?

Backup to NAS - Permissions

I am trying to backup my database to a NAS device. I have added a dump device
successfully:
[USE master
EXEC sp_addumpdevice 'disk', 'mydb_bu_nas', '\\nas1\dbbackups\mydb_bu.BAK']
...but when I try to run the backup:
[use mydb
BACKUP DATABASE mydb TO mydb_bu_nas]
...I get the error:
[Cannot open backup device 'digitaldraw_bu_nas_2'. Device error or device
off-line. See the SQL Server error log for more details.]
The event log shows the following details:
[18204 :
BackupDiskFile::CreateMedia: Backup device '\\nas1\dbbackups\mydb_bu.BAK'
failed to create. Operating system error = 5(Access is denied.).]
The MSSQLSERVER Service is running under the local system account. I assume
that this is the user that would need permissions to write to the NAS. If I
change the MSSQLSERVER Service to run as a Domain User are there any other
implications that I should be aware of?
Backups are always done under the account that SQL Server service uses and
must have rights to the share on the NAS. You should use a Domain account
that has the minimum permissions to do the things you need done and no more.
Andrew J. Kelly SQL MVP
"Dan" <Dan@.discussions.microsoft.com> wrote in message
news:6BE37CF7-54A1-4DE4-A71B-DE5F58A991FD@.microsoft.com...
>I am trying to backup my database to a NAS device. I have added a dump
>device
> successfully:
> [USE master
> EXEC sp_addumpdevice 'disk', 'mydb_bu_nas',
> '\\nas1\dbbackups\mydb_bu.BAK']
> ..but when I try to run the backup:
> [use mydb
> BACKUP DATABASE mydb TO mydb_bu_nas]
> ..I get the error:
> [Cannot open backup device 'digitaldraw_bu_nas_2'. Device error or device
> off-line. See the SQL Server error log for more details.]
> The event log shows the following details:
> [18204 :
> BackupDiskFile::CreateMedia: Backup device '\\nas1\dbbackups\mydb_bu.BAK'
> failed to create. Operating system error = 5(Access is denied.).]
> The MSSQLSERVER Service is running under the local system account. I
> assume
> that this is the user that would need permissions to write to the NAS. If
> I
> change the MSSQLSERVER Service to run as a Domain User are there any other
> implications that I should be aware of?
>
|||HowTo: Backup to UNC name using Database Maintenance Wizard
http://support.microsoft.com/default...b;en-us;555128
The requirements are the same whether you are backing up to a NAS device or
a Windows file share.
Geoff N. Hiten
Senior Database Administrator
Microsoft SQL Server MVP
"Dan" <Dan@.discussions.microsoft.com> wrote in message
news:6BE37CF7-54A1-4DE4-A71B-DE5F58A991FD@.microsoft.com...
>I am trying to backup my database to a NAS device. I have added a dump
>device
> successfully:
> [USE master
> EXEC sp_addumpdevice 'disk', 'mydb_bu_nas',
> '\\nas1\dbbackups\mydb_bu.BAK']
> ..but when I try to run the backup:
> [use mydb
> BACKUP DATABASE mydb TO mydb_bu_nas]
> ..I get the error:
> [Cannot open backup device 'digitaldraw_bu_nas_2'. Device error or device
> off-line. See the SQL Server error log for more details.]
> The event log shows the following details:
> [18204 :
> BackupDiskFile::CreateMedia: Backup device '\\nas1\dbbackups\mydb_bu.BAK'
> failed to create. Operating system error = 5(Access is denied.).]
> The MSSQLSERVER Service is running under the local system account. I
> assume
> that this is the user that would need permissions to write to the NAS. If
> I
> change the MSSQLSERVER Service to run as a Domain User are there any other
> implications that I should be aware of?
>

Backup to NAS - Permissions

I am trying to backup my database to a NAS device. I have added a dump devic
e
successfully:
[USE master
EXEC sp_addumpdevice 'disk', 'mydb_bu_nas', '\\nas1\dbbackups\mydb_bu.BAK']
..but when I try to run the backup:
[use mydb
BACKUP DATABASE mydb TO mydb_bu_nas]
..I get the error:
[Cannot open backup device 'digitaldraw_bu_nas_2'. Device error or devic
e
off-line. See the SQL Server error log for more details.]
The event log shows the following details:
[18204 :
BackupDiskFile::CreateMedia: Backup device '\\nas1\dbbackups\mydb_bu.BAK'
failed to create. Operating system error = 5(Access is denied.).]
The MSSQLSERVER Service is running under the local system account. I assume
that this is the user that would need permissions to write to the NAS. If I
change the MSSQLSERVER Service to run as a Domain User are there any other
implications that I should be aware of?Backups are always done under the account that SQL Server service uses and
must have rights to the share on the NAS. You should use a Domain account
that has the minimum permissions to do the things you need done and no more.
Andrew J. Kelly SQL MVP
"Dan" <Dan@.discussions.microsoft.com> wrote in message
news:6BE37CF7-54A1-4DE4-A71B-DE5F58A991FD@.microsoft.com...
>I am trying to backup my database to a NAS device. I have added a dump
>device
> successfully:
> [USE master
> EXEC sp_addumpdevice 'disk', 'mydb_bu_nas',
> '\\nas1\dbbackups\mydb_bu.BAK']
> ..but when I try to run the backup:
> [use mydb
> BACKUP DATABASE mydb TO mydb_bu_nas]
> ..I get the error:
> [Cannot open backup device 'digitaldraw_bu_nas_2'. Device error or dev
ice
> off-line. See the SQL Server error log for more details.]
> The event log shows the following details:
> [18204 :
> BackupDiskFile::CreateMedia: Backup device '\\nas1\dbbackups\mydb_bu.BAK'
> failed to create. Operating system error = 5(Access is denied.).]
> The MSSQLSERVER Service is running under the local system account. I
> assume
> that this is the user that would need permissions to write to the NAS. If
> I
> change the MSSQLSERVER Service to run as a Domain User are there any other
> implications that I should be aware of?
>|||HowTo: Backup to UNC name using Database Maintenance Wizard
http://support.microsoft.com/defaul...kb;en-us;555128
The requirements are the same whether you are backing up to a NAS device or
a Windows file share.
Geoff N. Hiten
Senior Database Administrator
Microsoft SQL Server MVP
"Dan" <Dan@.discussions.microsoft.com> wrote in message
news:6BE37CF7-54A1-4DE4-A71B-DE5F58A991FD@.microsoft.com...
>I am trying to backup my database to a NAS device. I have added a dump
>device
> successfully:
> [USE master
> EXEC sp_addumpdevice 'disk', 'mydb_bu_nas',
> '\\nas1\dbbackups\mydb_bu.BAK']
> ..but when I try to run the backup:
> [use mydb
> BACKUP DATABASE mydb TO mydb_bu_nas]
> ..I get the error:
> [Cannot open backup device 'digitaldraw_bu_nas_2'. Device error or dev
ice
> off-line. See the SQL Server error log for more details.]
> The event log shows the following details:
> [18204 :
> BackupDiskFile::CreateMedia: Backup device '\\nas1\dbbackups\mydb_bu.BAK'
> failed to create. Operating system error = 5(Access is denied.).]
> The MSSQLSERVER Service is running under the local system account. I
> assume
> that this is the user that would need permissions to write to the NAS. If
> I
> change the MSSQLSERVER Service to run as a Domain User are there any other
> implications that I should be aware of?
>