4
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ある既存ユーザ持つ表全てに参照権限のみを付与

Posted at

アプリケーション側で「テーブル参照のみさせたい」ユーザを作成してくれという依頼が最近ありました。

大抵はselect any table 権限をつければ良いんですが、個別ユーザの全テーブルを参照させたい場合は各テーブル分、オブジェクト権限を付ける必要があります。

これが結構面倒臭い作業なので、以下の手順でSQL文を生成して実行してやります。

テーブル参照ユーザーにて下記SQLを実行
SQL> set pages 0
SQL> SELECT 'grant select on '||table_name|| ' to <参照させたいユーザ>;' FROM user_tables;

4
6
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
4
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?