oracle 如何使用不同于当前用户的模式?
oracle how to use schema different from current user?
我获得了一个 oracle 连接,SID=xcom,用户=sa。我使用 sqlplus 连接,但是当我执行 "describe table" 时它说它不存在:
SQL> describe equip_inst;
ERROR:
ORA-04043: object equip_inst does not exist
SQL>
我需要包含架构名称 "newpoc" 才能获取它:
SQL> describe newpoc.equip_inst;
Name Null? Type
所以,有什么窍门?我想为我的所有对象默认登录此架构名称 "newpoc"。
正如您在示例中描述的那样,所有权限均已相应授予,您可以执行
ALTER SESSION SET CURRENT_SCHEMA = <schema name>
在你的例子中,作为用户 "sa" 执行:
ALTER SESSION SET CURRENT_SCHEMA = NEWPOC ;
因此,在您的示例中:
SQL> show user
USER is "SA"
SQL>
SQL> desc equip_inst
ERROR:
ORA-04043: object equip_inst does not exist
SQL> alter session set current_schema = NEWPOC ;
Session altered.
SQL> desc equip_inst
Name Null? Type
----------------------------------------- -------- ----------------------------
NAME VARCHAR2(100)
SQL>
此致
我获得了一个 oracle 连接,SID=xcom,用户=sa。我使用 sqlplus 连接,但是当我执行 "describe table" 时它说它不存在:
SQL> describe equip_inst;
ERROR:
ORA-04043: object equip_inst does not exist
SQL>
我需要包含架构名称 "newpoc" 才能获取它:
SQL> describe newpoc.equip_inst;
Name Null? Type
所以,有什么窍门?我想为我的所有对象默认登录此架构名称 "newpoc"。
正如您在示例中描述的那样,所有权限均已相应授予,您可以执行
ALTER SESSION SET CURRENT_SCHEMA = <schema name>
在你的例子中,作为用户 "sa" 执行:
ALTER SESSION SET CURRENT_SCHEMA = NEWPOC ;
因此,在您的示例中:
SQL> show user
USER is "SA"
SQL>
SQL> desc equip_inst
ERROR:
ORA-04043: object equip_inst does not exist
SQL> alter session set current_schema = NEWPOC ;
Session altered.
SQL> desc equip_inst
Name Null? Type
----------------------------------------- -------- ----------------------------
NAME VARCHAR2(100)
SQL>
此致