有A和B两个库 都有T用户A库中T用户下表C1的表结构 与 B库中T用户下的表C2表结构相同现在将C1中记录倒入C2(不经过中间状态如导成.dmp再倒入等等) 多谢帮忙小弟在线等

解决方案 »

  1.   

    1. 在B上建dblink来访问A。比如网络服务名为db,用户名为test,口令为t1,则建dblink应该是create public database link db_link connect to test identified by t1 using 'db';
    2. insert into c2 select * from c1@db_link
      

  2.   

    话这么说啊 不过今天试过了不好用 不是同一个网段 不指定ip只有个sid可以么?
    我好像没打public 是不是这个问题?
      

  3.   

    那你就建了private dblink, 别的用户就不能看到了,也没问题.现在问题是你的dblink建好没有?
      

  4.   

    对了,你最好把两个库的global_names全改成false,要不很麻烦的
      

  5.   

    可能没有建成 select * from tablename@oraname 这个命令提示错误
    我也不知道哪里写错了 应该没写错才对 只能明天去再看看了
    关键这么写跨网段没有问题么?用不用哪里写一下ip?
      

  6.   

    global_names现在已经不能改了 有一个是true
      

  7.   

    如果global_name = true,那么database link 的名字必须同远程机的实例名相同
      

  8.   

    贴一篇metalink文章
    PURPOSE
    -------
    To help troubleshoot database link (dblink) configurations.TROUBLESHOOTING DBLINKS
    -----------------------
    1) Determine whether GLOBAL_NAMES is set to true. To check this, look in the
    init<sid>.ora file located in ORACLE_HOME/dbs directory.If true, the dblink name MUST be the same as the DB_NAME of the target
    database.To unset GLOBAL_NAMES, use the following commands using SQL*Plus or Server
    Manager:SQL> ALTER SYSTEM SET GLOBAL_NAMES = FALSE; [instance level]
    SQL> ALTER SESSION SET GLOBAL_NAMES = FALSE; [session level](If changing GLOBAL_NAMES from TRUE to FALSE, you must restart the database)2) Verify the GLOBAL_NAME matches the DB_NAME.DB_DOMAIN (also in init<sid>.ora)
    To check the current value, issue either of the following commands using
    SQL*Plus and Server Manager:SQL> SELECT * from GLOBAL_NAME;The return value should match DB_NAME and DB_DOMAIN parameter values in
    init<sid>.ora file.If it does not, issue the following statement using SQL*Plus or Server Manager:SQL> ALTER DATABASE RENAME GLOBAL_NAME TO db_name.db_domain;3) Verify you can successfully connect to the database using SQL*Plus by issuing
    the following command at the Operating System prompt:sqlplus username/password@aliasExample:
    -------
    Assuming you have an alias called ORCL in the TNSNAMES.ORA file, and want to
    connect to that instance using SQL*Plus, issue the following at the Operating
    System prompt:sqlplus system/manager@ORCL4) Recreate the dblink.
    To drop an existing dblink, issue the following command using SQL*Plus or
    Server Manager:SQL> DROP DATABASE LINK <dblink name>;To create a new DBLINK, issue the following command using SQL*Plus or Server
    Manager:SQL> CREATE [PUBLIC] DATABASE LINK <dblink name>
    [CONNECT TO <remote database username> IDENTIFIED BY
    <remote database user password>] USING '<alias>';Note: Omitting KEYWORD PUBLIC will automatically create a PRIVATE dblink.If GLOBAL_NAMES is true, ensure the dblink name is the same as the DB_NAME.
    Also ensure the TNSNAMES.ORA file (by default in ORACLE_HOME/network/admin)
    contains an alias of the same name.Example:
    -------
    Assuming your database SID is ORCL, and GLOBAL_NAMES is true, create a dblink
    called ORCL and add the following entry to the TNSNAMES.ORA file:ORCL =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS =
    (PROTOCOL = TCP)
    (HOST = my_server_name OR IP_address)
    (PORT = 1521)
    )
    )
    (CONNECT_DATA=(SID=ORCL))
    )
      

  9.   

    "sidname.US.ORACLE.COM"是这么写么?
      

  10.   

    SQL> ALTER DATABASE RENAME GLOBAL_NAME TO db_name.db_domain;(db_name.db_domain!!!)
    你可以挨个试,总之如果改为false是最简单的.
      

  11.   


    DBLink是一个办法。另外,若数据库是 Oracle 10g 第2版,可以通过网络不产生dmp文件导入。
      

  12.   

    做数据迁移的工具有很多,当然dblink是最基本的
    其他还有很多ETL工具可以用,比如Sql server的DTS就很好用
    完全可以满足你的要求
      

  13.   

    有触发器生产的ID,能保证导过去ID相同么?