Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

cant get backup on drive C:\ Expand / Collapse
Author
Message
Posted Wednesday, May 9, 2012 2:20 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Thursday, February 6, 2014 6:12 AM
Points: 53, Visits: 165
I write this query for getting backup of DB.when i want to save it on Drive c or desktop it give me error but on other drive it complete succefully.what is the reason?
the query:
USE [MohitZistDB]
GO
/****** Object: StoredProcedure [dbo].[DB_Backup] Script Date: 05/09/2012 11:09:09 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER procedure [dbo].[DB_Backup]
@path nvarchar(255),
@Name nvarchar(255)
as
begin
BACKUP DATABASE [MohitZistDB]
TO DISK = @path
WITH NOFORMAT, INIT, NAME =@Name
end

this the error:

Msg 3201, Level 16, State 1, Procedure DB_Backup, Line 6
Cannot open backup device 'c:\\backup.bak'. Operating system error 5(failed to retrieve text for this error. Reason: 15105).
Msg 3013, Level 16, State 1, Procedure DB_Backup, Line 6
BACKUP DATABASE is terminating abnormally.
Post #1296957
Posted Wednesday, May 9, 2012 2:24 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Today @ 4:22 AM
Points: 1,312, Visits: 2,488
vahid.arr (5/9/2012)
I write this query for getting backup of DB.when i want to save it on Drive c or desktop it give me error but on other drive it complete succefully.what is the reason?
the query:
USE [MohitZistDB]
GO
/****** Object: StoredProcedure [dbo].[DB_Backup] Script Date: 05/09/2012 11:09:09 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER procedure [dbo].[DB_Backup]
@path nvarchar(255),
@Name nvarchar(255)
as
begin
BACKUP DATABASE [MohitZistDB]
TO DISK = @path
WITH NOFORMAT, INIT, NAME =@Name
end

this the error:

Msg 3201, Level 16, State 1, Procedure DB_Backup, Line 6
Cannot open backup device 'c:\\backup.bak'. Operating system error 5(failed to retrieve text for this error. Reason: 15105).
Msg 3013, Level 16, State 1, Procedure DB_Backup, Line 6
BACKUP DATABASE is terminating abnormally.


Have you tried creating a directory in C:\ drive & then taking the backup on that?

What about this:

BACKUP DATABASE YourDatabaseName TO DISK = 'C:\BackupDirectory\YourDatabaseName.BAK'
WITH STATS=1

See if this works fine.



Sujeet Singh
Post #1296960
Posted Wednesday, May 9, 2012 2:26 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Yesterday @ 3:46 PM
Points: 42,462, Visits: 35,525
Windows has some restrictions about files in the root of a drive, especially C drive. Rather create a folder and write the backup into that. Make sure that the SQL Server service has full control over whatever folder you use. Operating system error 5 is Access Denied.


Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1296961
Posted Wednesday, May 9, 2012 3:17 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Thursday, February 6, 2014 6:12 AM
Points: 53, Visits: 165
i want to create backup on desktop.i test it give that error and i check c drive it give me error.i want to exactly put file in desktop.what can i do?
Post #1296982
Posted Wednesday, May 9, 2012 3:23 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 4:32 AM
Points: 5,142, Visits: 4,936
ensure that the account which is running the SQL service has the nessesary rights to write a file into the locations you wish for it to go.



Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1 & Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger

Post #1296984
Posted Wednesday, May 9, 2012 3:24 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Yesterday @ 3:46 PM
Points: 42,462, Visits: 35,525
The desktop is not C:\.

The desktop is a folder C:\Users\<logged in user>\Desktop. So that's where you need to write the backup, and you need to ensure that the SQL Server service has full control of that folder (and that there are no other security restrictions from windows)

Why does it have to be the desktop?



Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1296985
Posted Wednesday, May 9, 2012 4:18 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Thursday, February 6, 2014 6:12 AM
Points: 53, Visits: 165
where can i check this?and change this?i want both of this:
on win 7 and win XP service pack2
Post #1296999
Posted Wednesday, May 9, 2012 4:25 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 4:32 AM
Points: 5,142, Visits: 4,936
is the database stored on many different computers or is it on one central server?

if its on a server and you want it to backup to a users workstation you will have to use UNC paths and start sharing folders and assign the nessesary rights.

if its many different db copies on many different machines, then you need to go into services.msc, find the account running SQL SERVER, and then ensure that account has the correct access to the folders which you can do by right clicking the folder then looking at the security tab.




Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1 & Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger

Post #1297001
Posted Saturday, October 6, 2012 11:18 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Thursday, February 6, 2014 6:12 AM
Points: 53, Visits: 165
yes the database is central and is in the server but i cant Find Sql Account on security tab.where exactly is that?
Post #1369498
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse