ALTER SESSION SET CURRENT_SCHEMA causes ORA-2019 (Doc ID 793693.1)

Last updated on APRIL 16, 2017

Applies to:

Oracle Database - Enterprise Edition - Version 9.2.0.8 and later
Information in this document applies to any platform.

Symptoms

Alter session set current schema errors with  ORA-02019 with Database links.

The following scenario will explain the problem :

1. There are 2 instances: "A' and "B"

2. On instance "B" are defined 2 schemas: USER1, USER2

On instance "A" also both schema are defined: USER1, USER2.

On instance "A" USER3 is defined who is a owner of TABLE1. USER1 and USER2 on instance "A" have access (select) to objects on schema USER3.

Privileges on instances "A" and B" are the same for USER1 and USER2.

On instance "B" there is defined private DB link "BOP.world" for connection to "A" .


SELECT * FROM ALL_DB_LINKS on instance "B":

OWNER DB_LINK USERNAME HOST
------------ ------------------------------ --------------- -----------------
USER1 LINKA.WORLD USER2 A.world

USER2 LINKA.WORLD USER2 A.world

3. When logging to instance "B" as USER2, connection to "A" (which uses private database link  example in this case LINKA.WORLD) works fine and query

SQL> SELECT * FROM TABLE@LINKA.WORLD; 

is working OK. TABLE1 is object on USER3 schema. 

4. On the same session when executing statement:

SQL> ALTER SESSION SET CURRENT_SCHEMA = USER1 ; -- (on instance "B") 

Then executing statement: 
SQL> SELECT * FROM TABLE1@LINKA.WORLD ; --(via db link to "A") 

errormessage is generated: "ORA-02019: connection description for remote database not found" 

TABLE1 is object on USER3 schema. 

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms