有什么方法可以显示两个不同的 table 结构(比较两个 table),table 来自 oracle 中的两个不同数据库?

is there any way to display two different table structure (compare two table), table from two different database in oracle?

--这是在单个数据库表中进行比较的方法我如何比较不同的数据库表?

CREATE OR REPLACE PROCEDURE compareTwoTables is
BEGIN
  FOR i in (SELECT column_name
              FROM all_tab_columns
             WHERE table_name = 'table2'
            MINUS
            SELECT column_name
              FROM all_tab_columns
             WHERE table_name = 'table1') LOOP
    dbms_output.put_line(i.column_name);
  END LOOP;
END;

您需要为远程数据库创建一个 DB link。之后,您可以使用类似于以下的脚本:

DECLARE 
  l_table VARCHAR2(100) := &tbl;
  l_res   NUMBER;
BEGIN
  FOR col IN (SELECT column_name, ownder, data_type, data_length, data_precision, data_scale, nullable, column_id
                FROM all_tab_columns@<remote_server> --asuming you have created DB link
               WHERE table_name = l_table)
  LOOP
    
    BEGIN
      SELECT 1
        INTO l_res
        FROM all_tab_columns
       WHERE NVL(column_name   ,'x')       = NVL(col.column_name   ,'x')
             NVL(ownder        ,'x')       = NVL(col.ownder        ,'x')
             NVL(data_type     ,'x')       = NVL(col.data_type     ,'x')
             NVL(data_length   ,'x')       = NVL(col.data_length   ,'x')
             NVL(data_precision,'x')       = NVL(col.data_precision,'x')
             NVL(data_scale    ,'x')       = NVL(col.data_scale    ,'x')
             NVL(nullable      ,'x')       = NVL(col.nullable      ,'x')
             NVL(column_id     ,'x')       = NVL(col.column_id;    ,'x');
       
    EXCEPTION WHEN no_data_found THEN
      dbms_output.put_line(col.column_name);
    END; 
  END LOOP;
END;