0

i have a database that i use in my application.

the operation i want to prevent is if i stop sql server and take the database files to another location then start the sql server and make some operations then stop the sql server services and replace the database files with the old one and start the sql server: i want now sql server say error and don't open the database

how can i make this situation using sql server 2012?

  • I'm not completely understanding your question, but why would you do it that way? Why not just backup the database, restore it to the second server, and leave the first server alone? – joeqwerty Nov 25 '14 at 19:46
  • you don't understand my question i want to prevent the user of my application to stop sql service , save database files, then start the sql service and make any operation to my database then stop sql then return the database to the old files as his operation not done – امير طارق Nov 25 '14 at 19:53
  • OK, then don't give them Administrator access to the server or SA access to SQL. – joeqwerty Nov 25 '14 at 19:56
  • So... You want to encrypt your database, then? – HopelessN00b Nov 25 '14 at 21:01

1 Answers1

3

If I understand your question, it sounds like you're looking for something like Transparent Data Encryption, in hopes of preventing a user detaching the database, attaching it to their own server, making changes, and re-attaching it to the original server. Transparent Data Encryption would require the user to have a certificate and a private key in order to attach or restore the database to a different server.

This requires Enterprise (or Developer or Evaluation, neither of which is licensed for production use), and I'm not convinced it's 100% foolproof if the user has administrative access to the server. You'd need to prevent the user from having access to export the certificate, for example.

Unfortunately, joeqwerty is correct that you'll need to not give the user Administrative access to the server or SA access to SQL, and will have to block the user's NTFS permissions to the SQL directories, etc.

Katherine Villyard
  • 18,550
  • 4
  • 37
  • 59