How to create a table from remote database using dblink
create table MYTABLE@DBLINK (name varchar2(20)));
*Cause: An attempt was made to use a DDL operation on a remote database. For example, "CREATE TABLE tablename@remotedbname ...".
*Action: To alter the remote database structure, you must connect to the remote database with the appropriate privileges.
Is this a privilege error or it is not possible to do with dblink?
If you managed to create a database link, you obviously have that user's credentials so the simplest option is to actually connect as remote user and create table in that schema directly.
If you want to do it from your schema, you can't do it using that syntax, but - there's a workaround:
dbms_utility.exec_ddl_statementHere's an example.
Database link first:
Does it work? Yes!
This is what you tried, and found out that it won't work:
Workaround I mentioned:
Testing (if table exists, I can insert a row over database link and select from that table):
[EDIT]
If you have several statements to run, you can do it one-by-one using
exec. Note that it won't work everywhere; it works in SQL*Plus, SQL Developer and perhaps some other tools. But, as it is short for aBEGIN-ENDblock, you could rather/better