SQL Server Performance

automation job

Discussion in 'SQL Server 2008 General DBA Questions' started by srimkumarp, Mar 29, 2011.

  1. srimkumarp New Member

    Hi All,
    I want to write a code for the below requirement:-
    If any (SQL Server 2008)database is restored in last 2 hours,then it can read permisison from folder and apply to that particular DB only.
    In folder we are maintaining all DB level permissions, when ever we restore the DB manually copying the permission and applying on DB.
    So to avoid the manually work we are going to automate the task.
    Can any one please share the thoughts
  2. satya Moderator

    Your requirement is little vague to understand, do you mean to setup permissions for certain number of users once the database is restored.
    If you can explain further on FOLDER then it will be ideal to offer an alternative.
  3. srimkumarp New Member

    Hi Satya,
    Thanks for reply,
    Before restore the DB from Prod to Test.We will take the login permission using thrid party tool and will place in one share folder.When ever restoration is happened on test database we will take script and run manually.Now we have to do this task in only one test server through automation.
    Now my question is in all Test server we have to apply permissions to databases.
    For example-
    Database name- ABC and the corresponding ABC login file is T10_ABC.sql
    T10 is the server name.The same way we are maintaining all servers.
    T11_XYZ.sql--> T11 is server name and XYZ is the DB name.
  4. satya Moderator

    If you are already obtaining the permission script from the tool, then club them into a TSQL script and schedule a job on the servers to execute the steps as a job.
    You may need to get around of TSQL to run these scripts on the basis of conditions of restore database.

Share This Page