Forum Stats

  • 3,824,848 Users
  • 2,260,430 Discussions
  • 7,896,330 Comments

Discussions

Oracle SQL Developer Option to run script on multiple PDB's

Emad Al-Mousa
Emad Al-Mousa Member Posts: 716 Bronze Trophy
edited Aug 30, 2020 12:37PM in Database Ideas - Ideas

it will be great if Oracle SQL Developer can enable us to execute the same set of SQL statements or scripts against specific multiple PDB's in a container.....currently i don't see this feature available !

Regards,

0 votes

Active · Last Updated

Comments

  • Sven W.
    Sven W. Member Posts: 10,535 Gold Crown

    I usually do this by opening the script in a sql dev worksheet and then switch the worksheet from one connection to the next using the list in the upper right corner.

    pastedImage_0.png

    As long as you have a connection defined for each of your PDBs this should be fine.


    I don't see the need to automate it more that this. Maybe you can elaborate a bit, why you think that this would be usefull

  • Luís Gustavo Lira
    Luís Gustavo Lira Member Posts: 119 Silver Badge

    Hi, check the Doc bellow, maybe it helps:

    "When you are executing PL/SQL code in a container in a CDB, and you want to execute one or more SQL statements in a different container, use the DBMS_SQL package to switch containers."

    "In a CDB, the catcon.pl script is the best way to run SQL scripts and SQL statements.

    An Oracle Database installation includes several SQL scripts. These scripts perform operations such as creating data dictionary views and installing options.

    The catcon.pl script can run scripts in the root and in specified PDBs in the correct order, and it generates log files that you can view to confirm that the SQL script or SQL statement did not generate unexpected errors. It also starts multiple processes and assigns new scripts to them as they finish running scripts previously assigned to them."

    https://docs.oracle.com/database/121/ADMIN/cdb_admin.htm#ADMIN14072

    Example 40-8 Performing Identical Actions in More Than One Container

    Sven W.