【DBLINK】不可使用 DBLINK在远程数据库上执行DDL类SQL

很少使用dblink在远程数据库中创建表,今天偶尔尝试,收获的是“ORA-02021”错误。错误本身提示的信息已经非常的明显:在远程数据库不可以执行DDL类型的SQL语句。

简单记录一下,供参考。

1.尝试使用dblink在远程数据库创建表
sec@ora10g> create table t@dblink_to_ora10 as select * from t;
create table t@dblink_to_ora10 as select * from t
              *
ERROR at line 1:
ORA-02021: DDL operations are not allowed on a remote database

此处的错误信息已经非常的明显。

2.使用oerr工具可以查询到如下的解释
ora10g@secDB/home/oracle$ oerr ora 2021
02021, 00000, "DDL operations are not allowed on a remote database"
// *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.

3.MOS中的[ID 19304.1]文章也有同样的描述
Error:  ORA 2021
Text:   DDL operations are not allowed on a remote database
-------------------------------------------------------------------------------
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.

4.小结
尝试--> 遇到问题 --> 根据提示信息分析问题 --> 总结问题 --> 提高。

Good luck.

secooler
10.04.11

-- The End --

请使用浏览器的分享功能分享到微信等