Site icon Database Tutorials

Running DDL Command on Remote Database With Database Link

 

The DDL command cannot be executed directly with the database link on the remote database. If it is run, it will cause the error as follows.

ORA-02021: DDL operations are not allowed on a remote database.

The dbms_utility.exec_ddl_statement procedure must be used for this. With this procedure, any DDL command can be executed in the remote database. In this way, all operations can be done from a single point.

Sample use:

In the above example, DB_LINK specifies the database link. After that, the command is executed in parenthesis and single quotes.

Similarly it is also possible to create a table as follows.

In this way, it is possible to run DDL commands through the database link in the remote database.

Exit mobile version