dbal icon indicating copy to clipboard operation
dbal copied to clipboard

Schema introspection on Oracle is failing when user is 'system'

Open mondrake opened this issue 4 years ago • 5 comments

Bug Report

Q A
BC Break yes/no
Version 3.0.0

Summary

Schema introspection in Oracle failing

Current behaviour

When executing createSchema() on an Oracle database and the user is 'system', I get

Unknown database type aq$_subscribers requested, Doctrine\DBAL\Platforms\OraclePlatform may not support it.

How to reproduce

See above.

Expected behaviour

The method should not fail and an introspected schema object should be returned.

mondrake avatar Dec 16 '20 10:12 mondrake

@mondrake you'll need to provide a more specific way to reproduce this. I haven't seen this issue before.

morozov avatar Dec 17 '20 01:12 morozov

OK it was my mistake I was trying to introspect the "system" schema, I was not logging in the relevant user/schema. In any case I think a better error message should be thrown (e.g. "Introspecting the 'system' schema is not allowed").

Thanks

mondrake avatar Dec 17 '20 11:12 mondrake

@mondrake if you want this issue to be addressed, please provide the steps to reproduce.

morozov avatar Dec 18 '20 05:12 morozov

Steps to reproduce, just in case:

  1. in a test environment on GitHub using the oracle service with image wnameless/oracle-xe-11g-r2

  2. login to oracle with system user, $tmpConnection = DriverManager::getConnection(["url" => "oci8://system:[email protected]:1521/XE"]);

  3. invoke the createSchema method

$schemaManager = $tmpConnection->getSchemaManager();
$schema = $schemaManager->createSchema();

mondrake avatar Dec 18 '20 09:12 mondrake

Indeed, the data type of AQ$_QUEUES.SUBSCRIBERS is AQ$_SUBSCRIBERS:

SELECT dbms_metadata.get_ddl('TABLE', 'AQ$_QUEUES') FROM dual;

  CREATE TABLE "SYSTEM"."AQ$_QUEUES" 
   (	"OID" RAW(16), 
	"EVENTID" NUMBER NOT NULL ENABLE, 
	"NAME" VARCHAR2(30) NOT NULL ENABLE, 
	"TABLE_OBJNO" NUMBER NOT NULL ENABLE, 
	"USAGE" NUMBER NOT NULL ENABLE, 
	"ENABLE_FLAG" NUMBER NOT NULL ENABLE, 
	"MAX_RETRIES" NUMBER, 
	"RETRY_DELAY" NUMBER, 
	"PROPERTIES" NUMBER, 
	"RET_TIME" NUMBER, 
	"QUEUE_COMMENT" VARCHAR2(2000), 
	"SUBSCRIBERS" "SYS"."AQ$_SUBSCRIBERS" , 
	"MEMORY_THRESHOLD" NUMBER, 
	"SERVICE_NAME" VARCHAR2(64), 
	"NETWORK_NAME" VARCHAR2(256), 
	 CONSTRAINT "AQ$_QUEUES_PRIMARY" PRIMARY KEY ("OID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "SYSTEM"  ENABLE, 
	 CONSTRAINT "AQ$_QUEUES_CHECK" UNIQUE ("NAME", "TABLE_OBJNO")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "SYSTEM"  ENABLE
   ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "SYSTEM" 

Not sure what this type is and how to handle it otherwise.

morozov avatar Dec 19 '20 02:12 morozov