VBS script + scheduled task to backup MSSQL database

I was looking around since too long, without finding anything, so badly I decided to ask here my problem, all by myself :-P

So here it is.

I work with a certain software, which use a MSSQL DB.
I'm at a point where I'd like to scheduled a task to backup certains files AND a precise DB on the MSSQL server.

first problem is that the user logged in, don't have any access granted on the DB to backup it. Each time a get the message

Msg 916, Level 14, State 1, Server XXXXX\XXXXX, Line 1 The server principal "domain\username" is not able to access the database "XXXX" under the current security context. Msg 3013, Level 16, State 1, Server XXXXX\XXXXX, Line 1 BACKUP DATABASE is terminating abnormally.

  • from the commandline

    C:\sqlcmd -E -S XXXXX\XXXXX-Q "BACKUP DATABASE XXXX TO DISK='C:\TEMP\toto.bak'"

second problem is that I even don't have any access to the DB... so I cannot GRANT acess at all, to anybody...

somebody knows a workaround I could use to achieve what I'm trying to do ?

Replay

From BOL:

BACKUP DATABASE and BACKUP LOG permissions default to members of the sysadmin fixed server role and the db_owner and db_backupoperator fixed database roles

The user account you are using needs to have, at a minimum, one of those permissions. db_backupoperator being the least intrusive as far as security. db_owner means you can do anything to the DB, including dropping it. Sysadmin gives you, well, control to everything on the SQL server (and more than likely the underlying server itself via xp_cmdshell, etc)

Category: sql server Time: 2016-07-29 Views: 3
Tags: sql server dba

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.307 (s). 12 q(s)