Ezaz
Ezaz

Reputation: 183

SQL Server database backup error

I am trying to solve a backup problem for SQL Server 2012 for some time now.

The problem is I not able to make backup TO DISK, I think it is directory error

Query used:

BACKUP DATABASE [ProjectDatabase] 
TO DISK = 'C:\Users\AizazHussain\Dropbox\TestProjectBackup.bak';

OR

BACKUP DATABASE [ProjectDatabase] 
TO DISK ='C:\TestProjectBackup.bak';

Both attempts failed.

If I use the directory C:\BackupFolder\TestProjectBackup.bak, it works fine. Somewhere on Stack overflow there was a solution to create backup in a folder so I created BackupFolder in C:\ and it works fine.

Note: it worked fine for other partitions

e.g.

BACKUP DATABASE [ProjectDatabase] 
TO DISK ='D:\TestProjectBackup.bak';

BACKUP DATABASE [ProjectDatabase] 
TO DISK ='D:\Folder\TestProjectBackup.bak';

// It works but only for C:\

Pardon me if there are any grammatical mistake in my question

Upvotes: 1

Views: 328

Answers (1)

Serge
Serge

Reputation: 4036

SQL Server executes BACKUP DATABASE command under the context of the service account. This account is usually MSSQLSERVER. This account is configured in Services:

MSSQLSERVER service properties - logon tab

This account must have Modify permissions to the backup target directory:

SQL Server must be able to read and write to the device; the account under which the SQL Server service runs must have write permissions.

(Source: BACKUP (Transact-SQL))

Check your NTFS permissions.

Upvotes: 2

Related Questions