Skip to content
Home » Oracle » How to Resolve ORA-16000: database or pluggable database open for read-only access

How to Resolve ORA-16000: database or pluggable database open for read-only access

ORA-16000

Tried to update some rows, but it failed with ORA-16000.

SQL> update employees set first_name = 'Scott' where last_name = 'Rowe';
update employees set first_name = 'Scott' where last_name = 'Rowe'
       *
ERROR at line 1:
ORA-16000: database or pluggable database open for read-only access

For 11g or earlier release, the error code is the same, but the message is a little different.

ORA-16000: database open for read-only access

ORA-16000 means that the database you want to perform data manipulation is in READ ONLY mode, you should notify DBA to open it to READ WRITE.

Let's see what state of the database currently is.

Database

For a container database (CDB) or a non-CDB, we can check the status like this:

SQL> select open_mode from v$database;

OPEN_MODE
--------------------
READ ONLY

Pluggable Database (PDB)

For a PDB, we can check the status like this:

SQL> select open_mode from v$pdbs where name = 'ORCLPDB';

OPEN_MODE
----------
READ ONLY

Solutions

In order to solve ORA-16000, we should open the database to READ WRITE. The way to open READ WRITE depends on what kind of database you are in.

For a normal database (non-CDB) or a root container (CDB), we should restart the database to READ WRITE, which means, shutdown then startup.

For a PDB, we don't have to restart it, just use OPEN FORCE to convert READ ONLY into READ WRITE through SYSDBA.

SQL> alter pluggable database orclpdb open force;

Pluggable database altered.

SQL> select open_mode from v$pdbs where name = 'ORCLPDB';

OPEN_MODE
----------
READ WRITE

We solved it.

Leave a Reply

Your email address will not be published. Required fields are marked *