Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Backup database with SQL

Author  Topic 

vknockaert
Starting Member

1 Post

Posted - 2012-03-15 : 05:01:46
Hi,
We want our software users to be able to click some button or select some menu-option in our application, that enables the user to take a backup from the SQL Server database and getting that BAK file local, without having to grant that user specific access to folders on the SQL Server backup directory.

A way to do this, is using the BACKUP DATABASE command. This creates the BAK file in the SQL Server Backup folder. (the client does not even need to have permissions on that folder)

With the OPENROWSET(BULK..SINGLE BLOB ) command, it's possible to insert that BAK file in a varbinary field in the database.

After that, with a simple SELECT statement, the client can read the entire backup from the varbinary field and write it locally.

For the OPENROWSET command, SQL Server demands that the requesting user has access to that backup folder. (due to security impersonation). That is, only when the user connects to SQL Server with Windows Authentication.
When the user uses a SQL Server user to login (which has Bulkadmin rights), the OPENROWSET bulk import works fine.

Problem : we only work with Windows Authentication.

Are there any other workarounds to get the BAK file at the client without having to grant him specific access rights ?

Thanks in advance,
Vincent

MaxOvrdrv
Starting Member

5 Posts

Posted - 2012-03-15 : 15:28:21
you could grant your software access to the location of the .BAK files, and when the user clicks the @get DB@ button, it runs the job to create the .BAK file at the DB level, and returns a value to the application once completed (like the filename), and then the application server gets the file from the server, and distributes it to the client?
Go to Top of Page
   

- Advertisement -