com.ibm.ejs.cm.portability.TableDoesNotExistException: ORA-00942: table or view

please refer below

   第一步,以sys用户登陆SQL并建立普通用户storm和penguin:

  $ sqlplus / as sysdba

  SQL> create user storm identified by storm;

  User created.

  SQL> create user penguin identified by penguin;

  User created.

  第二步,赋予一些基本的权限给新建的用户storm和penguin:

  SQL> grant connect,create table,resource to storm,penguin;

  Grant succeeded.

  第三步,以storm用户登陆,创建一张表并插入数据:

  SQL> conn storm/storm

  Connected.

  SQL> create table t (id int);

  Table created.

  SQL> insert into t values(1);

  1 row created.

  SQL> commit;

  Commit complete.

  第四步,以penguin用户登陆,看能否查询storm用户所建表里面的数据:

  SQL> conn penguin/penguin

  Connected.

  SQL> select table_name from user_tables;

  no rows selected

  SQL> show user;

  USER is "PENGUIN"

  SQL> select * from storm.t;

  select * from storm.t

  *

  ERROR at line 1:

  ORA-00942: table or view does not exist

  从以上结果可以看出,用户 penguin无法查看用户storm所建表里面的内容,甚至被告知没有这张表。

  第五步,修改当前schema为storm,并继续查询:

  SQL> alter session set current_schema=storm;

  Session altered.

  SQL> show user;

  USER is "PENGUIN"

  SQL> select * from storm.t;

  select * from storm.t

  *

  ERROR at line 1:

  ORA-00942: table or view does not exist

  仍然不能查看。

  第六步,以storm用户登陆,赋予penguin用户查看t表的权限:

  SQL> conn storm/storm

  Connected.

  SQL> grant select on t to penguin;

  Grant succeeded.

  第七步,以penguin用户登陆,查看storm用户的t表:

  SQL> conn penguin/penguin

  Connected.

  SQL> select * from storm.t;

  ID

  ----------

  1

  更简单的,将当前schema更改为storm,可以简化查询过程:

  SQL> alter session set current_schema=storm;

  Session altered.

  SQL> select * from t;

  ID

  ----------

  1

你可能感兴趣的:(exception)