Reputation: 65
Is it possible to connect to a specfic DB connection in SQL Developer from a script ?
The idea is: I need to extend same table on 20 different DB Connections. So the command is the same alter table xxx and it needs to be executed 20 times.
So far I can only open connection by hand and execute the script.
Note: I do not have sqlplus..
Upvotes: 0
Views: 1541
Reputation: 22427
Yes, use the CONNECT command
conn hr/oracle@server:1521/db
create table x (a integer);
conn hr/oracle@server:1521/db2
create table x (a integer);
...
At the end of your script, you'll be 'disconnected' from the 'remote' systems and placed back into the database your Worksheet was opened on.
Execute the script with F5, or the 2nd execute button on the SQL Worksheet toolbar.
Upvotes: 1
Reputation: 35900
You can use the dblink
to execute the DDL as follows:
dbms_utility.exec_ddl_statement@db_link('ALTER TABLE ...');
First, you need to create the 20 dblinks
.
Note: Ideally, You should avoid DDL over dblink
.
Upvotes: 0