RE: How to get permission to backup DB to \My Documents\ folder
- From: Ed White <ewhite@xxxxxxxxxxxxxxxxx>
- Date: Mon, 27 Nov 2006 20:11:02 -0800
I'm using VB 2005 with SQL Server 2005. I log onto Windows as the
administrator. I'm not sure/familiar about SQL Server, although since I am
the only one using this PC, I assume I am logged on as sysadmin.
If I use the SQL Server Mgt Studio to back up to My Docs folder, it works.
It's only when I do it programmatically as below do I get the exception.
I use a SqlCommand along with the ExecuteNonQuery command to backup my
database. When I back up the DB to a file in the Program Files/Microsoft SQL
Server/ folder, as shown below
Dim backupSQL As New SqlCommand("BACKUP DATABASE [Companies DB] TO
DISK='C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\Companies
DB.bak' WITH CHECKSUM")
, it works,
but when I try to back up to a file in the My Documents folder, as shown
below,
Dim backupSQL As New SqlCommand("BACKUP DATABASE [Companies DB] TO
DISK='C:\Documents and Settings\Ed\My Documents\Companies DB.bak' WITH
CHECKSUM")
it throws an exception:
SqlException was unhandled
Cannot open backup device 'C:\Documents and Settings\Ed\My
Documents\Companies DB.bak'. Operating system error 5(Access is denied.).
BACKUP DATABASE is terminating abnormally.
--
Ed
"Charles Wang[MSFT]" wrote:
Hi Ed,.
To let me better understand your issue, I would like to know:
1. How do you back up your database, programmatically or manually?
2. Was your Windows logon account a local administrator?
3. Was your SQL Server logon account a sysadmin?
4. What was the exact error message?
For checking if this issue is a permission issue, you can logon your
Windows with administrator account, assign the folder Read/Write
permissions to your current Windows logon account. Right click the My
Document folder which locates in C:\Documents and Settings\<your Windows
logon account>\My Documents by default, click Properties, switch to the
Security tab, click Add..., enter your Windows account name, assign Read
and Write permissions, and click OK. Try again.
If you have any other questions or concerns, please feel free to let me
know.
Charles Wang
Microsoft Online Community Support
- References:
- RE: How to obtain 'Last Database Backup' time from within VB
- From: Charles Wang[MSFT]
- RE: How to obtain 'Last Database Backup' time from within VB
- From: Charles Wang[MSFT]
- RE: How to obtain 'Last Database Backup' time from within VB
- From: Charles Wang[MSFT]
- RE: How to obtain 'Last Database Backup' time from within VB
- Prev by Date: Re: Setting On delete cascade on subscriber alone - Transactional Pull
- Next by Date: merge agent fails mostly but not always error 14262
- Previous by thread: RE: How to obtain 'Last Database Backup' time from within VB
- Next by thread: RE: How to obtain 'Last Database Backup' time from within VB
- Index(es):
Relevant Pages
|