oracledbeaver

How to add Single connection to Multiple DB's on the same oracle server in DBeaver?


I have many Databases on the same Oracle server and I am using Dbeaver as an IDE to connect to the databases. However I need to create connection for each database separately even though they are on the same server. Is there anyway we can create single connection and switch to the required DB just like we have it in SQL server ?

I tried to connect the multiple DB's on the same oracle server using DBeaver and I am not able to do So


Solution

  • SQL*Plus supports the CONNECT command:

    connect username@connect_identifier
    

    If DBeaver supports that SQL*Plus command then you should be able to use it in a script to change the connection from one user to another user (or from one database instance to another database instance if you specify the connect_identifier).

    Alternatively:

    1. Run the script which needs to connect to multiple users/databases in SQL*Plus (or SQL Developer) rather than DBeaver; or

    2. Connect to a user that has appropriate privileges to access all the users within the database instance that you need to access and ensure that your script prefixes all table identifiers with the user's schema identifier.

      I.e. change:

      CONNECT user1
      
      SELECT * FROM table1;
      
      CONNECT user2
      
      SELECT * FROM table2;
      

      to:

      SELECT * FROM user1.table1;
      
      SELECT * FROM user2.table2;
      

      And connect to a user than has been granted SELECT permissions to both user1.table1 and user2.table2.