6
4

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 3 years have passed since last update.

ORA-01045: user username lacks CREATE SESSION privilegeとなった時の対応方法

Posted at
  • 環境
    • Windows10 Pro 64bit
    • SQL*Plus: Release 12.2.0.1.0 Production
    • (AWSのRDS)Oracle Database 12c Standard Edition Release 12.2.0.1.0 - 64bit Production

事象 : ユーザを作成してログインしようとしたらログインできなかった

$ sqlplus username/password@hoge.pon.ap-northeast-1.rds.amazonaws.com:1521/sid

SQL*Plus: Release 12.2.0.1.0 Production on  1 31 17:28:36 2020

Copyright (c) 1982, 2017, Oracle.  All rights reserved.

ERROR:
ORA-01045: user username lacks CREATE SESSION privilege; logon denied


ユーザー名を入力してください: username
パスワードを入力してください: password
ERROR:
ORA-12560: TNS:protocol adapter error


ユーザー名を入力してください:

原因 : 「CREATE SESSION」権限がないので接続できない

初心者王道の失敗です。
ORA-01045: user xxx lacks CREATE SESSION privilege; logon denied - 小さい頃はエラ呼吸
新規ユーザー作成時に最低限割り当てるべき権限 | 技術情報 | 株式会社コーソル

対応 : 権限を付与する

-- 権限のある人でログイン
$ sqlplus ponsuke/tarou@hoge.pon.ap-northeast-1.rds.amazonaws.com:1521/sid

SQL*Plus: Release 12.2.0.1.0 Production on  1 31 17:42:04 2020

Copyright (c) 1982, 2017, Oracle.  All rights reserved.

最終正常ログイン時間:  1  31 2020 17:41:38 +09:00


Oracle Database 12c Standard Edition Release 12.2.0.1.0 - 64bit Production
に接続されました。
-- 接続して使えるようにいろいろ権限を付与
SQL> grant create session,create table,create view,create sequence,create trigger,create synonym,unlimited tablespace to username;

権限付与が成功しました。
-- もう一度作ったユーザでログインする
$ sqlplus username/password@hoge.pon.ap-northeast-1.rds.amazonaws.com:1521/sid

SQL*Plus: Release 12.2.0.1.0 Production on  1 31 17:42:33 2020

Copyright (c) 1982, 2017, Oracle.  All rights reserved.



Oracle Database 12c Standard Edition Release 12.2.0.1.0 - 64bit Production
に接続されました。
SQL>
6
4
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
6
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?