db link中的 dblink_authentication
authenticated by .. identified by...是啥
莫非要两次密码?

解决方案 »

  1.   

    CREATE [ SHARED ] [ PUBLIC ] DATABASE LINK dblink
    [ CONNECT TO
        { CURRENT_USER
        | user IDENTIFIED BY password [ dblink_authentication ]
        }
    | dblink_authentication
    ]
        [ CONNECT TO
          { CURRENT_USER
          | user IDENTIFIED BY password [ dblink_authentication ]
          }
        | dblink_authentication
        ]...
    [ USING connect_string ] ;AUTHENTICATED BY user
    IDENTIFIED BY password对于AUTHENTICATED BY的方式,官方文档有这样的说明:dblink_authentication Specify the username and password on the target instance. This clause authenticates the user to the remote server and is required for security. The specified username and password must be a valid username and password on the remote instance. The username and password are used only for authentication. No other operations are performed on behalf of this user.You must specify this clause when you specify the SHARED clause. You cannot specify this clause unless you specify the SHARED clause.可见加authenticated by的方式是shared database link的专利,共享服务器模式现在用的不是很多。
      

  2.   

    SHARED 创建一个共享的数据库连接,同时要指定database link_authentication。
    使用shared方式的database link是数据库会限制到远程数据库的连接的数量,这样以避免过多的连接对远程数据库造成太大的压力。在使用shared database link的时候,到database link的连接会在连接以后与本地连接断开,为防止未授权的session使用此链接而要求在创建shared database link的时候必须要指定database link_authentication。
    (from Oracle document: A shared database link is a link between a local server process and the remote database. The link is shared because multiple client processes can use the same link simultaneously.)