[20180211]current_schema与dblink.txt

简介: [20180211]current_schema与dblink.txt --//有时候调优sql语句,经常在回话设在alter session set current_schema=scott,然后执行sql语句.

[20180211]current_schema与dblink.txt

--//有时候调优sql语句,经常在回话设在alter session set current_schema=scott,然后执行sql语句.
--//如果使用dblink是private,存在问题,做一个记录:

1.环境:

SCOTT@book> @ &r/ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

CREATE PUBLIC DATABASE LINK LOOPBACK
CONNECT TO SCOTT
IDENTIFIED BY <PWD>
USING 'localhost:1521/book:DEDICATED';

CREATE DATABASE LINK LOOP
CONNECT TO SCOTT
IDENTIFIED BY <PWD>
USING 'localhost:1521/book:DEDICATED';

2.测试:
SYS@book> show user;
USER is "SYS"

SYS@book> alter session set current_schema=scott;
Session altered.

SYS@book> select * from dept@loopback ;
    DEPTNO DNAME          LOC
---------- -------------- -------------
        10 ACCOUNTING     NEW YORK
        20 RESEARCH       DALLAS
        30 SALES          CHICAGO
        40 OPERATIONS     BOSTON

SYS@book> select * from dept@loop ;
select * from dept@loop
                   *
ERROR at line 1:
ORA-02019: connection description for remote database not found

$ oerr ora 2019
02019, 00000, "connection description for remote database not found"
// *Cause:
// *Action:

--//使用alter session时,私有的DBLINK依然不能使用,必须使用public DBLINK.如何使用呢?

目录
相关文章
|
SQL 存储 关系型数据库
MySQL中count(*)和information_schema.tables中的table_rows值不相同
MySQL中count(*)和information_schema.tables中的table_rows值不相同
459 0
|
关系型数据库 MySQL 容器
连接mysql报错Table ‘performance_schema.session_variables’
常规的方法是运行mysql时,提示Table ‘performance_schema.session_variables’ doesn’t exist解决的方法是:第一步:在管理员命令中输入: mysql_upgrade -u root -p --force 第二步:重新启动mysql的服务: n...
6514 0
|
SQL 关系型数据库 MySQL
关于mysql中information_schema.tables
项目中出现这样一个SQL语句,现记录如下: @Select("select table_name tableName, engine, table_comment tableComment, create_time createTime from information_schema.
1848 0
|
C++
[odb-users] Create schema error (unknown database schema &#39;&#39;)
Boris Kolpackov boris at codesynthesis.com Fri May 31 11:13:02 EDT 2013   Previous message: [odb-users] Create schema error (unknown database schem...
1457 0
|
C++ 数据库管理 vr&ar
Create schema error (unknown database schema &#39;&#39;)
Andrey Devyatka 4 years ago Permalink Raw Message Hi,Please tell me, can I use the static library in the following case:library.
1450 0