自己犯了个错误。在A用户下,更新B用户的表时,首先B用户要拥有该表所在的表空间权限。折腾自己老半天,原因是我一直在GRANT A用户权限,确没有GRANT B 用户
SQL> conn / as sysdba;
已连接。
SQL> grant create any procedure to hr;
授权成功。
SQL> conn hr/hr;
已连接。
SQL> CREATE OR REPLACE PROCEDURE logexecution
2 AUTHID DEFINER
3 IS
4 BEGIN
5 INSERT INTO logtable (userid, logdate) VALUES (USER, SYSDATE);
6 END;
7 /
过程已创建。
SQL> grant execute logexecution to public;
grant execute logexecution to public
*
第 1 行出现错误:
ORA-00990: 权限缺失或无效
SQL> conn / as sysdba;
已连接。
SQL> grant execute any procedure to hr;
授权成功。
SQL> conn hr/hr;
已连接。
SQL> grant execute logexecution to public;
grant execute logexecution to public
*
第 1 行出现错误:
ORA-00990: 权限缺失或无效
SQL> grant execute on logexecution to public;
授权成功。
SQL> conn testuser1/userpwd1;
已连接。
SQL> insert into hr.logtable(user,sysdate);
insert into hr.logtable(user,sysdate)
*
第 1 行出现错误:
ORA-00928: 缺失 SELECT 关键字
SQL> insert into hr.logtable values(user,sysdate);
insert into hr.logtable values(user,sysdate)
*
第 1 行出现错误:
ORA-00942: 表或视图不存在
SQL> select * from hr.logtable;
select * from hr.logtable
*
第 1 行出现错误:
ORA-00942: 表或视图不存在
SQL> conn / as sysdba
已连接。
SQL> grant select any table to testuser1;
授权成功。
SQL> conn testuser1/pwduser1;
ERROR:
ORA-01017: 用户名/口令无效; 登录被拒绝
警告: 您不再连接到 ORACLE。
SQL> conn testuser1/userpwd1;
已连接。
SQL> select * from hr.logtable;
未选定行
SQL> conn hr/hr;
已连接。
SQL> grant select ,update,insert on logtable to testuser1;
授权成功。
SQL> conn testuser1/userpwd1;
已连接。
SQL> insert into logtable values(user,sysdate);
insert into logtable values(user,sysdate)
*
第 1 行出现错误:
ORA-00942: 表或视图不存在
SQL> insert into hr.logtable values(user,sysdate);
insert into hr.logtable values(user,sysdate)
*
第 1 行出现错误:
ORA-01950: 对表空间 'USERS' 无权限
SQL> grant unlimited tablespace to testuser1;
grant unlimited tablespace to testuser1
*
第 1 行出现错误:
ORA-01031: 权限不足
SQL> conn / as sysdba;
已连接。
SQL> grant unlimited tablespace to testuser1;
授权成功。
SQL> conn testuser1/userpwd1;
已连接。
SQL> insert into hr.logtable values(user,sysdate);
insert into hr.logtable values(user,sysdate)
*
第 1 行出现错误:
ORA-01950: 对表空间 'USERS' 无权限
SQL> conn / as sysdba;
已连接。
SQL> alter testuser1 quota unlimited to users;
alter testuser1 quota unlimited to users
*
第 1 行出现错误:
ORA-00940: 无效的 ALTER 命令
SQL> alter user testuser1 quota unlimited to users;
alter user testuser1 quota unlimited to users
*
第 1 行出现错误:
ORA-00969: 缺失 ON 关键字
SQL> alter user testuser1 quota unlimited on users;
用户已更改。
SQL> conn testuser1/userpwd1;
已连接。
SQL> insert into hr.logtable values(user,sysdate);
insert into hr.logtable values(user,sysdate)
*
第 1 行出现错误:
ORA-01950: 对表空间 'USERS' 无权限
SQL> desc user_user;
ERROR:
ORA-04043: 对象 user_user 不存在
SQL> desc user_users;
名称 是否为空? 类型
----------------------------------------- -------- ----------------------------
USERNAME NOT NULL VARCHAR2(30)
USER_ID NOT NULL NUMBER
ACCOUNT_STATUS NOT NULL VARCHAR2(32)
LOCK_DATE DATE
EXPIRY_DATE DATE
DEFAULT_TABLESPACE NOT NULL VARCHAR2(30)
TEMPORARY_TABLESPACE NOT NULL VARCHAR2(30)
CREATED NOT NULL DATE
INITIAL_RSRC_CONSUMER_GROUP VARCHAR2(30)
EXTERNAL_NAME VARCHAR2(4000)
SQL> select username,default_tablespace from user_user;
select username,default_tablespace from user_user
*
第 1 行出现错误:
ORA-00942: 表或视图不存在
SQL> select username,default_tablespace from user_users;
USERNAME DEFAULT_TABLESPACE
------------------------------ ------------------------------
TESTUSER1 USERS
SQL> select username,default_tablespace from dba_users;
select username,default_tablespace from dba_users
*
第 1 行出现错误:
ORA-00942: 表或视图不存在
SQL> conn / as sysdba
已连接。
SQL> grant resource to testuser1;
授权成功。
SQL> conn testuser1/userpwd1;
已连接。
SQL> insert into hr.logtable values(user,sysdate);
insert into hr.logtable values(user,sysdate)
*
第 1 行出现错误:
ORA-01950: 对表空间 'USERS' 无权限
SQL> shutdown immediate;
ORA-01031: 权限不足
SQL> conn / as sysdba;
已连接。
SQL> shutdown immediate;
数据库已经关闭。
已经卸载数据库。
ORACLE 例程已经关闭。
SQL> startup
ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance
ORACLE 例程已经启动。
Total System Global Area 640286720 bytes
Fixed Size 1376492 bytes
Variable Size 272633620 bytes
Database Buffers 360710144 bytes
Redo Buffers 5566464 bytes
数据库装载完毕。
数据库已经打开。
SQL> conn testuser1/userpwd1;
已连接。
SQL> insert into hr.logtable values(user,sysdate);
insert into hr.logtable values(user,sysdate)
*
第 1 行出现错误:
ORA-01950: 对表空间 'USERS' 无权限
SQL> conn hr/hr;
已连接。
SQL> insert into hr.logtable values(user,sysdate);
insert into hr.logtable values(user,sysdate)
*
第 1 行出现错误:
ORA-01950: 对表空间 'USERS' 无权限
SQL> alter user hr quota unlimit to users;
alter user hr quota unlimit to users
*
第 1 行出现错误:
ORA-02187: 无效的限额说明
SQL> alter user hr quota unlimited to users;
alter user hr quota unlimited to users
*
第 1 行出现错误:
ORA-00969: 缺失 ON 关键字
SQL> alter user hr quota unlimited on users;
alter user hr quota unlimited on users
*
第 1 行出现错误:
ORA-01031: 权限不足
SQL> conn / as sysdba;
已连接。
SQL> alter user hr quota unlimited on users;
用户已更改。
SQL> conn hr/hr;
已连接。
SQL> insert into hr.logtable values(user,sysdate);
已创建 1 行。
SQL> rollback;
回退已完成。
SQL> conn testuser1/userpwd1;
已连接。
SQL> insert into hr.logtable values(user,sysdate);
已创建 1 行。
SQL>
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/21861353/viewspace-758029/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/21861353/viewspace-758029/