请教各位哥们,我这遇到这样一个问题:
公司里两套不同公司作的系统中间涉及到两个数据库,都是oracle8i的,两台机子的操作系统都是windows2000 server,需要在两个数据库之间建立数据库链路(database link),我查了些资料,也没有比较系统的方法,我从DBA Studio里试着建立数据库链路,但怎么都不行,都说是数据库链路处于未活动状态,反正就是配不成功,希望大家能给点意见和资料,争取早日解决这个问题,问题解决后我会系统的写一个文档,到时候发回csdn,好让以后的朋友们能少走些弯路.

解决方案 »

  1.   

    装个pl/sql developer,  左边的树型表里有Database links, 对它右键选New...  
    然后填写user password等信息就可以了.
      

  2.   

    配置好网络,是两台服务器之间通过sqlnet能互相访问,然后create database link就可以了
      

  3.   

    ExamplesThe examples that follow assume two databases, one with the database name local and the other with the database name remote. The examples use the Oracle Database domain. Your database domain will be different.
    Defining a Public Database Link: ExampleThe following statement defines a shared public database link named remote that refers to the database specified by the service name remote:CREATE PUBLIC DATABASE LINK remote 
       USING 'remote'; This database link allows user hr on the local database to update a table on the remote database (assuming hr has appropriate privileges):UPDATE employees@remote
       SET salary=salary*1.1
       WHERE last_name = 'Baer';Defining a Fixed-User Database Link: ExampleIn the following statement, user hr on the remote database defines a fixed-user database link named local to the hr schema on the local database:CREATE DATABASE LINK local 
       CONNECT TO hr IDENTIFIED BY hr
       USING 'local';Once this database link is created, hr can query tables in the schema hr on the local database in this manner:SELECT * FROM employees@local;User hr can also use DML statements to modify data on the local database:INSERT INTO employees@local
       (employee_id, last_name, email, hire_date, job_id)
       VALUES (999, 'Claus', '[email protected]', SYSDATE, 'SH_CLERK');UPDATE jobs@local SET min_salary = 3000
       WHERE job_id = 'SH_CLERK';DELETE FROM employees@local 
       WHERE employee_id = 999;Using this fixed database link, user hr on the remote database can also access tables owned by other users on the same database. This statement assumes that user hr has SELECT privileges on the oe.customers table. The statement connects to the user hr on the local database and then queries the oe.customers table:SELECT * FROM oe.customers@local;Defining a CURRENT_USER Database Link: ExampleThe following statement defines a current-user database link to the remote database, using the entire service name as the link name:CREATE DATABASE LINK remote.us.oracle.com
       CONNECT TO CURRENT_USER
       USING 'remote';The user who issues this statement must be a global user registered with the LDAP directory service.You can create a synonym to hide the fact that a particular table is on the remote database. The following statement causes all future references to emp_table to access the employees table owned by hr on the remote database:CREATE SYNONYM emp_table 
       FOR [email protected];
      

  4.   

    比如有A、B两个数据库。现在在A上建DBLINK,联结到B。
    语法(在A上):
    create public database link test 
    connect to "登陆B数据库的帐号"        
    identified by "登陆B数据库的密码"
    using 'B';
    ------------------
    注意的是:
    1。在A的tnsnames.ora要配置到B的连接描述;
    2。在A的参数globle_names要set为false。