0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

SQLメモ

Posted at

1.リストアしたらユーザマッピングが消えた件
多分DBに登録されているSIDが書き換わったから
・サーバ単位のSID確認

SELECT 
    name AS サーバーログイン名,sid AS サーバSID,type_desc AS ユーザータイプ 
FROM 
    sys.server_principals
WHERE 
    type IN ('S', 'U')

・DB単位のSID確認

USE [SampleDB];
SELECT name AS ユーザー名, sid AS SID
FROM sys.database_principals
WHERE type IN ('S', 'U')

2.readonlyのユーザだけど一部のストアドプロシージャは実行したい件
・ロールの作り方

Use [SampleDB];
Create ROLE SPExecutorRole;

・ロールの確認方法

Use [SampleDB];
select name, type_desc
from sys.database_principals
where type = 'R';

・ロールにストアドの実行権限付与

調べてる

・ロールをグループorユーザにアタッチ

調べてる
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?