Close Menu
  • Home
  • Oracle
    • ASM
    • Data Guard
    • RAC
  • Performance
  • Tools
  • Troubleshooting
  • Python
  • Shell Script
Search

Oracle RAC 12.2 on VMware Workstation – Post 3: Grid Infrastructure Installation

2026-04-05 Oracle By Henrique

Oracle RAC 12.2 on VMware Workstation — Post 1: VMware Networking and Openfiler Setup

2026-04-05 Oracle By Henrique

Oracle RAC 12.2 on VMware Workstation – Post 2: Oracle Linux Configuration and iSCSI

2026-04-05 Oracle By Henrique
YouTube LinkedIn RSS
  • About
  • Contact
  • Legal
    • Cookie Policy
    • Disclaimer
    • Privacy Policy
    • Terms of Use
  • RSS
  • English
    • Portuguese (Brazil)
Execute StepExecute Step
YouTube LinkedIn RSS
  • Home
  • Oracle
    • ASM
    • Data Guard
    • RAC
  • Performance
  • Tools
  • Troubleshooting
  • Python
  • Shell Script
Execute StepExecute Step
Home » ORA-01031 — Insufficient Privileges When Creating an IDENTITY Column
Oracle

ORA-01031 — Insufficient Privileges When Creating an IDENTITY Column

HenriqueBy Henrique2026-04-03Updated:2026-04-034 Mins Read
Share
Facebook Twitter LinkedIn Pinterest Email Telegram WhatsApp

This post is also available in: Português (Portuguese (Brazil))

You try to create a table with an identity column and Oracle throws a privilege error — even though you have CREATE TABLE. Here’s why it happens and how to fix it.

SQL> CREATE TABLE orders (
  2    id   INT GENERATED BY DEFAULT AS IDENTITY,
  3    desc VARCHAR2(100)
  4  );
  id   INT GENERATED BY DEFAULT AS IDENTITY,
*
ERROR at line 2:
ORA-01031: insufficient privileges

The error appears even with CREATE TABLE granted. The culprit is a different privilege that’s easy to overlook.


Why It Happens

Identity columns were introduced in Oracle 12c as a shorthand for the classic sequence + default pattern. Under the hood, when Oracle creates an identity column, it automatically creates an implicit sequence tied to that column. That sequence is managed by the database, but it’s still a sequence — and creating one requires the CREATE SEQUENCE privilege.

Without it, CREATE TABLE fails with ORA-01031 before the table itself is even touched.


Diagnosis

Check the current user’s system privileges:

-- System privileges for the current session
SELECT privilege
FROM   session_privs
ORDER BY privilege;

If CREATE SEQUENCE is not in the list, that’s the issue.

To check a specific user (as DBA):

SELECT privilege
FROM   dba_sys_privs
WHERE  grantee = 'MY_USER'
ORDER BY privilege;

Solution

Grant the CREATE SEQUENCE privilege to the user:

-- Connected as DBA
GRANT CREATE SEQUENCE TO my_user;

After the grant, table creation works as expected:

SQL> CREATE TABLE orders (
  2    id   INT GENERATED BY DEFAULT AS IDENTITY,
  3    desc VARCHAR2(100)
  4  );

Table created.

All Three IDENTITY Variants Require CREATE SEQUENCE

The behavior is identical across all three identity column forms available since Oracle 12c:

VariantBehaviorAlso fails without CREATE SEQUENCE?
GENERATED ALWAYS AS IDENTITYOracle always generates the value; explicit INSERT into the column is blocked✅ Yes
GENERATED BY DEFAULT AS IDENTITYOracle generates the value by default; explicit INSERT is allowed✅ Yes
GENERATED BY DEFAULT ON NULL AS IDENTITYOracle generates the value when NULL is passed on INSERT✅ Yes

Regardless of which variant you choose, Oracle always creates an implicit sequence behind the scenes — and CREATE SEQUENCE is always required.


How to Reproduce in a Lab

-- 1. Create a test user (connected as DBA)
CREATE USER lab_identity IDENTIFIED BY lab123;
GRANT CREATE SESSION TO lab_identity;
GRANT CREATE TABLE    TO lab_identity;
-- Intentionally WITHOUT CREATE SEQUENCE

-- 2. Connect as lab_identity and reproduce the error
sqlplus lab_identity/lab123@ORCLPDB1

CREATE TABLE t_identity (
  id   INT GENERATED BY DEFAULT AS IDENTITY,
  name VARCHAR2(50)
);
-- Expected: ORA-01031: insufficient privileges

-- 3. Switch back to DBA and grant CREATE SEQUENCE
CONNECT / AS SYSDBA
GRANT CREATE SEQUENCE TO lab_identity;

-- 4. Reconnect as lab_identity and confirm the fix
sqlplus lab_identity/lab123@ORCLPDB1

CREATE TABLE t_identity (
  id   INT GENERATED BY DEFAULT AS IDENTITY,
  name VARCHAR2(50)
);
-- Expected: Table created.

-- 5. Confirm the implicit sequence created by Oracle
SELECT sequence_name, min_value, max_value, increment_by, cache_size
FROM   user_sequences;

-- Cleanup
DROP TABLE t_identity;

Quick Checklist

-- 1. Check session privileges
SELECT privilege FROM session_privs ORDER BY privilege;

-- 2. Grant CREATE SEQUENCE (as DBA)
GRANT CREATE SEQUENCE TO my_user;

-- 3. Re-run the table creation
CREATE TABLE my_table (
  id INT GENERATED BY DEFAULT AS IDENTITY,
  ...
);

References

  • Oracle Database SQL Language Reference — Identity Columns
  • Oracle Database Security Guide — System Privileges

create sequence identity column lab ora-01031 troubleshooting
Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
Previous ArticleORA-12547 — TNS:lost contact When Connecting with sqlplus
Next Article Oracle RAC 12.2 on VMware Workstation – Series Overview

Related Posts

Oracle

Oracle RAC 12.2 on VMware Workstation – Post 3: Grid Infrastructure Installation

2026-04-05
Read More
Oracle

Oracle RAC 12.2 on VMware Workstation — Post 1: VMware Networking and Openfiler Setup

2026-04-05
Read More
Oracle

Oracle RAC 12.2 on VMware Workstation – Post 2: Oracle Linux Configuration and iSCSI

2026-04-05
Read More
Add A Comment
Leave A Reply Cancel Reply

Demo
Follow Me
  • Email
  • GitHub
  • LinkedIn
  • RSS
  • YouTube

INS-06006 – Passwordless SSH Connectivity Not Set Up

2026-02-2614 Views

ORA-29548 — How to Fix “Java System Class Reported” in Oracle Database

2026-03-0510 Views

PRVG-2002 — How to Fix “Encountered Error in Copying File” in Oracle RAC

2026-03-078 Views
Demo
Tags
alter-sequence asm clusterware create sequence datapatch grid-infrastructure Grid Infrastructure how-to identity-column identity column ins-08101 installation inventory iSCSI lab listener opatch opatchauto Openfiler openssh ora-01031 ORA-12547 ora-12777 orabasetab oracle oracle oracle-database oracle-home oracle-linux oracle-rac Oracle Database Oracle Linux Oracle RAC out-of-place passwordless-ssh patching patching prvg-2002 RAC Installation redo-log runcluvfy scp tns troubleshooting VMware
Execute Step
YouTube LinkedIn RSS
  • Home
  • About
  • Contact
  • RSS
  • English
    • Português (Portuguese (Brazil))
© 2026 ExecuteStep. Designed by ThemeSphere.

Type above and press Enter to search. Press Esc to cancel.

Ad Blocker Enabled!
Ad Blocker Enabled!
Our website is made possible by displaying online advertisements to our visitors. Please support us by disabling your Ad Blocker.