User read access to an archived database

  • How would I give users access to an archived database? I don't think it's good practice to allow them sysadmin, and I can't add the user to the security, but the database is archived (read-only).

  • I'd wait for a maint window then make the DB read/write, add the user and then reset to read-only.

    USE [master]

    GO

    ALTER DATABASE [SomeDB] SET READ_WRITE WITH NO_WAIT

    GO

    CREATE USER [SomeUser] FOR LOGIN [SomeDomain\SomeUser]

    GO

    USE [SomeDB]

    GO

    GRANT SELECT ON SCHEMA::[dbo] TO [SomeUser]

    GO

    ALTER DATABASE [SomeDB] SET READ_ONLY WITH NO_WAIT

    GO

    _____________________________________________________________________
    - Nate

    @nate_hughes
  • Thank you for your response!

Viewing 3 posts - 1 through 2 (of 2 total)

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