Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Errormessage while action succeeds?

Status
Not open for further replies.

Hansje

Programmer
Dec 3, 2003
16
NL
Hi there,

I'm running this script:

declare @v_filename varchar(100),
@vbackupdevice varchar(100),
@v_error int,
@p_database varchar(100),
@p_dest1 varchar (1000)

set @p_dest1 = 'd:\dbbackup\NW\'
set @p_database = 'Northwind'
set @v_filename = @p_dest1 + '\Northwind' +
convert(varchar(20),getdate(), 112) + '_' + convert(varchar(20),
getdate(), 108)
+ '_full'
set @vbackupdevice = @v_filename

select @v_filename
select @vbackupdevice

if exists (select 'x' from master..sysdevices where name =
@vbackupdevice)
exec sp_dropdevice @vbackupdevice

EXEC @v_error = master..sp_addumpdevice 'disk', @vbackupdevice,
@v_filename

BACKUP DATABASE @p_database TO @vbackupdevice WITH INIT, NAME =
@p_database, NOSKIP , STATS = 10, DESCRIPTION = @v_filename, NOFORMAT

After I run this script I receive the following message:

'Disk' device added.
Server: Msg 3201, Level 16, State 1, Line 22
Cannot open backup device
'd:\dbbackup\NW\\Northwind20031203_17:05:11_full'. Device error or
device off-line. See the SQL Server error log for more details.
Server: Msg 3013, Level 16, State 1, Line 22

Consequently the backup fails. However, when I look at the
Backupdevices, there it is, exactly as printed in the errormessage. What
could be the cause of this? Should I end the CREATEDEVICE with a GO?
Which poses other problems, for this script is supposed to be part of a
SP.

Any comments welcome.
Tnx,

Hans Brouwer
 
Some new development here: when I execute a query in QA:

declare @v_error int
EXEC @v_error = master..sp_addumpdevice 'disk', 'NewDevice', 'c:\temp'

I receive a message 'Disk' device added. The tabel SYSDEVICES has a new entry and in EM under BACKUPDEVICES the new device is visible. However, when I check with Windows Explorer location C:\temp no device is visible.. Obviously backupoperation to this device fail.

How can this be?

Tnx,
Hans Brouwer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top