怎样建立DBLink

解决方案 »

  1.   

    The following statement defines a fixed-user database link named sales.hq.acme.com: CREATE DATABASE LINK sales.hq.acme.com 
       CONNECT TO hr IDENTIFIED BY hr
       USING 'sales';
      

  2.   

    http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/statements_56a.htm#SQLRF01205
      

  3.   

    beckhambobo(beckham) 
    你给的链接进不去,要用户名和密码,能不能给我考过来,多谢啦!!
      

  4.   

    Examples
    CURRENT_USER Example
    The following statement defines a current-user database link using the demo database: CREATE DATABASE LINK sales.hq.acme.com
       CONNECT TO CURRENT_USER
       USING 'sales';Fixed User Example
    The following statement defines a fixed-user database link named sales.hq.acme.com: CREATE DATABASE LINK sales.hq.acme.com 
       CONNECT TO hr IDENTIFIED BY hr
       USING 'sales';
    Once this database link is created, you can query tables in the schema scott on the remote database in this manner: SELECT * FROM [email protected];
    You can also use DML statements to modify data on the remote database: INSERT INTO [email protected]
       (customer_id, order_id, order_total)
       VALUES (5001, 1235, 2000);UPDATE [email protected] 
       SET order_total = order_total + 500;DELETE FROM [email protected] 
       WHERE order_id = 2443;
    You can also access tables owned by other users on the same database. This statement assumes that the current user has SELECT privileges on the hr.departments table: SELECT *
       FROM [email protected];
    The previous statement connects to the user scott on the remote database and then queries Adam's dept table. You can create a synonym to hide the fact that the departments table is on a remote database. The following statement causes all future references to dept to access a remote departments table owned by hr: CREATE SYNONYM dept 
       FOR [email protected];PUBLIC Database Link Example
    The following statement defines a shared public fixed user database link named sales.hq.acme.com that refers to user scott with password tiger on the database specified by the string service name 'sales': CREATE SHARED PUBLIC DATABASE LINK sales.hq.acme.com 
       CONNECT TO hr IDENTIFIED BY hr 
       AUTHENTICATED BY anupam IDENTIFIED BY bhide
       USING 'sales'; 
      

  5.   

    建DB_Link很簡單基本語法如下﹕
       CREATE DATABASE LINK db_link_name
       CONNECT TO usename IDENTIFIED BY password
       USING 'other_database_name';(你所要連的那個數據庫的別名)
    但在建的過程中必須注意几點﹕
       首先﹐配置要連的那台服務器的本機服務
       其次﹐看INIT文件中的global_names參數的值﹐如果其值為false 則other_database_name用你本機配置的別名﹐如果其值為true則other_database_name用其database在創建時所用的全局名稱。一般我們都把global_names修改為false.