我是Oracle数据库的新手。我已经安装Oracle Database 11g R2
了Oracle Linux 6
。我已经使用以下方法成功创建了一个新数据库dbca
并连接到该数据库:
$ sqlplus "/ as sysdba"
我成功创建了一个表,并插入了一些数据并执行了一些选择:
SQL> CREATE TABLE Instructors (
tid NUMBER(7) PRIMARY KEY,
fname VARCHAR2(32),
lname VARCHAR2(32),
tel NUMBER(16),
adrs VARCHAR2(128) );
Table created.
SQL> INSERT INTO Instructors (tid, fname, lname, tel, adrs)
VALUES (8431001, 'John', 'Smith', 654321, 'London');
1 row created.
SQL> SELECT count(*) FROM Instructors;
COUNT(*)
----------
1
然后,我创建了一个具有CONNECT特权的新用户:
SQL> CREATE USER teacher1 IDENTIFIED BY pass1;
User created.
SQL> GRANT CONNECT TO teacher1;
Grant succeeded.
然后,我创建了一个具有适当对象权限的新角色:
SQL> CREATE ROLE instructor;
Role created.
SQL> GRANT SELECT, UPDATE ON Instructors TO instructor;
Grant succeeded.
并授予用户角色:
SQL> GRANT instructor TO teacher1;
Grant succeeded.
接下来,我退出sqlplus exit;
并以新用户身份进行连接以对其进行测试。我使用以下命令成功登录到数据库:
$ sqlplus teacher1
SQL*Plus: Release 11.2.0.1.0 Production on Thu Jul 25 03:20:50 2013
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Enter password: *****
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>
但是当我尝试从表中选择时,它说:
SQL> SELECT * FROM Instructors;
SELECT * FROM Instructors
*
ERROR at line 1:
ORA-00942: table or view does not exist
我在这里想念的是什么?
dbadmin
具有DBA
特权的新用户,并使用该DBA用户创建所有表。然后,所有其他用户应从DBADMIN
架构访问表...对吗?