Why I need to assign Grant/Deny Permission after every database restore ?

  • I need to restrict user which was achieved by grant and deny permissions using TSQL in sql server 2008 R2 successfully.

    Now i need to update database,For know ,I am using backup/restore for updation of database.

    But when ever i did it ,User grant/Deny were needed to assign .

    Is their any thing that i used to grant/deny permission and no need to assign then on every restore/backup ???

    Kindly let me know

  • maida_rh (1/30/2013)


    I need to restrict user which was achieved by grant and deny permissions using TSQL in sql server 2008 R2 successfully.

    Now i need to update database,For know ,I am using backup/restore for updation of database.

    But when ever i did it ,User grant/Deny were needed to assign .

    Is their any thing that i used to grant/deny permission and no need to assign then on every restore/backup ???

    Kindly let me know

    i think you are refering here orphan login fix . right ?

    IF you are using same copy of database again and again, then restore the backup , do the login fix and then take the backup and use it everytime.

    if you are using different and latest backup copy then you have to do the login fix everytime.

    -------Bhuvnesh----------
    I work only to learn Sql Server...though my company pays me for getting their stuff done;-)

  • I am using sql server authentication and user i assigned permission also have login id and pass,I googled the term "orphan login and got this :

    what do i need to do as i need the restore to commit the change to a single table structure + data .

    I tryed the import but got error:

    Violation of primary key constraints 'userid' .can not insert duplicate key in object 'usertb'

    Kindly let me know and thanks

  • maida_rh (1/31/2013)


    what do i need to do as i need the restore to commit the change to a single table structure + data .

    I tryed the import but got error:

    Violation of primary key constraints 'userid' .can not insert duplicate key in object 'usertb'

    How you are restoring ? through backup ?

    -------Bhuvnesh----------
    I work only to learn Sql Server...though my company pays me for getting their stuff done;-)

  • yes,through backup file

  • maida_rh (1/31/2013)


    yes,through backup file

    then how come PK violation ? restore backup do data copy of exact the content in backup , there cant be PK violation

    -------Bhuvnesh----------
    I work only to learn Sql Server...though my company pays me for getting their stuff done;-)

  • Pk_violation when i tried to import data from current updated source database to destination database.

    How can I resolve orphan login as ,already assiged a login password to that user ????

  • maida_rh (1/31/2013)


    Pk_violation when i tried to import data from current updated source database to

    destination database.

    still you are not clear here , are you populating tables on destination side which already contain data then there is possibilty of PK violation. if possible(Be very very careful) that you can afford then truncate the table at dest. side and then populate them.

    maida_rh (1/31/2013)


    How can I resolve orphan login as ,already assiged a login password to that user ????

    ALTER AUTHORIZATION ON DATABASE::YourDatabaseName TO sa

    GO

    see this http://msdn.microsoft.com/en-us/library/ms187359.aspx

    -------Bhuvnesh----------
    I work only to learn Sql Server...though my company pays me for getting their stuff done;-)

  • I tryed TRUNCATE on table but still the same error of PK violation during import/Export.

    What does AuTHORIZATION do ?If I assigned to sa ?

  • maida_rh (1/31/2013)


    I tryed TRUNCATE on table but still the same error of PK violation during import/Export.

    So it means your source table contains duplicate data ? do you have same PK on source table too as you have on dest table ?

    maida_rh (1/31/2013)


    What does AuTHORIZATION do ?If I assigned to sa ?

    See the link i posted above

    -------Bhuvnesh----------
    I work only to learn Sql Server...though my company pays me for getting their stuff done;-)

Viewing 10 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic. Login to reply