ORA-16000 when trying to perform select on read only Oracle database My application's SQL encounters an ORA-16000 error when trying to access a read only Oracle database.

ORA-16000: database open for read-only access ORA-06512: at "SYS.XMLTYPE", 
line 272 ORA-06512: at line 1 ### The error may exist in com/xyz/report/dao/Transaction001Mapper.xml


This is the query that involves the XMLTYPE, the INTERFACE_CONTENT is a CLOB column: 

SELECT CONTENTS FROM ERRCODES WHERE 
       CODE=(SELECT xmltype(INTERFACE_CONTENT).extract('/Message/PaymentStatus/ps:FIToFIPmtStsRpt/ps:TxInfAndSts/ps:StsRsnInf/ps:Rsn/ps:Prtry/text()','xmlns="urn:abcde" xmlns:head="urn:iso:std:iso:20022:tech:xsd:head.001.001.01" xmlns:ps="urn:iso:std:iso:20022:tech:xsd:pacs.002.001.03"').getstringval() APP_CODE
FROM MESSAGE_EXTERNAL_INTERACTION MEI WHERE MEI.MSG_TYPE='Pacs_002'
    AND MEI.MID='MY_ID')


I also did a lot of EXTRACTVALUE() method on an XML field type.

The SQL is working perfectly if the database is not read only (read write).

What is the issue here? Is this related to some missing privileges/grants?
I am not aware of any specific privileges related to XMLType. There will be execute privs related to PL/SQL that works with it but your message is clear and sadly definitive. If you had a privs issue you wouldn't be getting this message...

XMLType can be funny to work with. Have you thought about retrieving it as a CLOB and then doing the XML parsing and extraction at the client end?