How to select from pdbs with a cdb user? I have several store procedures, which analyze oracle logs using log miner. These procedures run on CDB user C##ADMIN which created for this manner.
Now I want to compare the logged values to the live values, so I need to be able to access each pdb from the CDB.
After several searches, I came across database link which looks like a possible answer. but when I'm trying to create a database link it says ORA-02011: duplicate database link name. and when I'm trying to drop it I'm getting ORA-65230: internal database link cannot be altered or dropped.
I'm tried to run the following queries, but it failed: (even when connected as: / as sysdba)
SELECT * FROM ALL_TABLES@testpdb; 

ORA-12541: TNS:no listener
*Cause: The connection request could not be completed because the listener 
      is not running.
*Action: Ensure that the supplied destination address matches one of 
      the addresses used by the listener - compare the TNSNAMES.ORA entry with 
      the appropriate LISTENER.ORA file (or TNSNAV.ORA if the connection is to 
      go by way of an Interchange). Start the listener on the remote machine.

SELECT * FROM test.TABLE1@testpdb;   

ORA-12541: TNS:no listener
*Cause: The connection request could not be completed because the listener 
      is not running.
*Action: Ensure that the supplied destination address matches one of 
      the addresses used by the listener - compare the TNSNAMES.ORA entry with 
      the appropriate LISTENER.ORA file (or TNSNAV.ORA if the connection is to 
      go by way of an Interchange). Start the listener on the remote machine.

So my questions are:

Is using database links is it the correct way?
If it is, how to configure it?
How can I use it?
Do I have any alternative to achieve my goal?
That error means your listener is not running. Start your listener.
This just works normally without doing anything:
SQL&gt; create user c##myadmin identified by password;

User created.

SQL&gt; grant dba to c##myadmin container=all;

Grant succeeded.

SQL&gt; alter user c##myadmin set container_data=all container=current;

User altered.

SQL&gt; conn c##myadmin/password
Connected.
SQL&gt; select con_id, name from v$containers;

    CON_ID NAME
---------- ----------
         1 CDB$ROOT
         2 PDB$SEED
         3 PDB1
         4 PDB2

SQL&gt; select count(*) from dba_users@pdb1;

  COUNT(*)
----------
        37

SQL&gt; select count(*) from dba_users@pdb2;

  COUNT(*)
----------
        37

SQL&gt; select db_link from dba_db_links;

DB_LINK
--------------------------------------------------------------------------------
SYS_HUB

An alternative is the CONTAINERS clause, but that has some serious limitations (queried object must exist in all containers).