- 錯誤現象
- 解決步驟
一、錯誤現象
使用SQL*Loader向scott用戶的bonus表導入數據時,提示插入了數據
$ sqlldr scott/tiger control=ldr_case.ctl
SQL*Loader: Release 11.2.0.1.0 - Production on Mon Sep 30 16:06:18 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Commit point reached - logical record count 4
查看bonus表是否插入成功
$ sqlplus scott/tiger
SQL*Plus: Release 11.2.0.1.0 Production on Mon Sep 30 16:08:22 2013
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> SELECT * FROM BONUS;
no rows selected
於是查看log文件,見到如下報錯
Record 1: Rejected - Error on table BONUS.
ORA-01950: no privileges on tablespace 'USERS'
Record 2: Rejected - Error on table BONUS.
ORA-01950: no privileges on tablespace 'USERS'
Record 3: Rejected - Error on table BONUS.
ORA-01950: no privileges on tablespace 'USERS'
Record 4: Rejected - Error on table BONUS.
ORA-01950: no privileges on tablespace 'USERS'
二、解決步驟
使用GRANT RESOURCE TO "user";
$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Mon Sep 30 16:27:36 2013
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> grant resource to scott;
Grant succeeded.
再次導入後查看bonus表
$ sqlldr scott/tiger control=ldr_case.ctl
SQL*Loader: Release 11.2.0.1.0 - Production on Mon Sep 30 16:28:06 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Commit point reached - logical record count 4
$ sqlplus scott/tiger
SQL*Plus: Release 11.2.0.1.0 Production on Mon Sep 30 16:28:10 2013
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select * from bonus;
ENAME JOB SAL COMM
---------- --------- ---------- ----------
SMITH CLEAK 3904
ALLEN SALESMAN 2891
WARD SALESMAN 3128
KING PRESIDENT 2523