我有一些問題連接到數據庫使用的用戶用戶創建我已經created.Firstly我創建的用戶是這樣的:錯誤我與我創建
create user util1 identified by user1;
create user util2 identified by user2;
create user util3 identified by user3;
create user util4 identified by user4;
create user util5 identified by user5;
create user util6 identified by user6;
create user util7 identified by user7;
create user util8 identified by user8;
grant dba to util1,util2,util3,util4,util5,util6,util7,util8;
select lpad(' ', 2*level) || granted_role "User, his roles and privileges"
from (select null grantee, username granted_role from dba_users where username like upper('%UTIL%')
union
select grantee, granted_role from dba_role_privs
union
select grantee, privilege from dba_sys_privs)
start with grantee is null
connect by grantee = prior granted_role;
這是工作fine.But當我嘗試創建一個表使用「util1」的權利。這是行不通的:
connect util1/user1 AS SYSDBA;
create table pr1(
cod_subansamblu number(4),
denumire varchar2(20) not null,
cantitate number(7,3),
UM varchar2(3),
pret_unitar number(9,2),
cod_ansamblu number(4),
cod_sectie number(4) not null,
constraint pr1_cod_subansamblu_pk primary key(cod_subansamblu),
constraint pr1_UM_chk check(UM in ('BUC','ML','MP','MC','SET'))
);
我真的不知道什麼錯誤。幫助將不勝感激。
我收到的錯誤消息是:
Last Execution Details
Results
Statistics Plan
ORA-00900: invalid SQL statement
你爲什麼連 「'作爲sysdba'」。這應該只用於維護工作。同時授予「普通」用戶的DBA也不是一個好主意。如果這是一個開發數據庫,只需授予這些用戶「連接」和「資源」。如果它是一個生產數據庫,則應該分別向這些用戶授予'connect'和'CREATE'特權。 – 2012-01-14 14:26:12
@a_horse_with_no_name - 甲骨文棄用在11g中RESOURCE(和CONNECT和DBA)。 http://docs.oracle.com/cd/B28359_01/network.111「Oracle建議您設計自己的數據庫安全角色,而不是靠這個角色。這個角色可能不會自動通過Oracle數據庫的未來版本創建」 /b28531/authorization.htm – APC 2012-01-14 23:03:00
@APC:是的,我知道。這就是爲什麼我說生產數據庫不應該使用角色。但對於開發數據庫來說,這非常方便。 – 2012-01-14 23:14:27