create user ng_zj identified by ng_zj
default tablespace tbs_test
temporary tablespace tbs_test_tmp;
grant connect to ng_zj;
grant resource to ng_zj;
grant create table to ng_zj;
grant create sequence to ng_zj;
grant create session to ng_zj;
grant create synonym to ng_zj;
grant create view to ng_zj;
grant select any table to ng_zj;
grant create procedure to ng_zj;
grant debug connect session to ng_zj;
INDENTIFIED 拼錯了。 應該是:IDENTIFIED
順便多說幾句,當你創建用戶時,應該定義它的表空間(default tablespace)。否則,它會使用系統表空間(system tablespace)。這是應該避免的。
這是常用的創建用戶的一個例子:
CREATE USER XXXXX IDENTIFIED BY xxxxx
PROFILE DEFAULT
DEFAULT TABLESPACE USERS
TEMPORARY TABLESPACE TEMPTS01
ACCOUNT UNLOCK;
請注意,你首先要確認你的數據庫裡是否有這二個表空間:USERS和TEMPTS01。如果沒有,你先要創建表空間USERS及TEMPTS01,然後再創建用戶。
在CRT中進入oracle --連接sqlplus
按照下面寫完代碼直接復制進去回車就行了
---建立用戶代碼為:CREATE USER "用戶名字" PROFILE "DEFAULT" IDENTIFIED BY "密碼" DEFAULT TABLESPACE "指定表空間名字" TEMPORARY TABLESPACE "臨時表空間" ACCOUNT UNLOCK;
---賦權
begin
EXECUTE IMMEDIATE 'GRANT SELECT ANY DICTIONARY TO 用戶名';
EXECUTE IMMEDIATE 'GRANT ALTER ANY TABLE TO 用戶名';
EXECUTE IMMEDIATE 'GRANT ALTER SYSTEM TO 用戶名';
EXECUTE IMMEDIATE 'GRANT ALTER ANY PROCEDURE TO 用戶名';
EXECUTE IMMEDIATE 'GRANT CONNECT TO 用戶名';
EXECUTE IMMEDIATE 'GRANT CREATE ANY PROCEDURE TO 用戶名';
EXECUTE IMMEDIATE 'GRANT CREATE ANY TABLE TO 用戶名';
EXECUTE IMMEDIATE 'GRANT CREATE ANY INDEX TO 用戶名';
EXECUTE IMMEDIATE 'GRANT CREATE DATABASE LINK TO 用戶名';
EXECUTE IMMEDIATE 'GRANT CREATE PUBLIC DATABASE LINK TO 用戶名';
EXECUTE IMMEDIATE 'GRANT CREATE ANY VIEW TO 用戶名';
EXECUTE IMMEDIATE 'GRANT CREATE PUBLIC SYNONYM TO 用戶名';
EXECUTE IMMEDIATE 'GRANT CREATE TABLE TO 用戶名';
EXECUTE IMMEDIATE 'GRANT DELETE ANY TABLE TO 用戶名';
EXECUTE IMMEDIATE 'GRANT DROP PUBLIC DATABASE LINK TO 用戶名';
EXECUTE IMMEDIATE 'GRANT DROP ANY TRIGGER TO 用戶名';
EXECUTE IMMEDIATE 'GRANT DROP ANY INDEX TO 用戶名';
EXECUTE IMMEDIATE 'GRANT DROP ANY PROCEDURE TO 用戶名';
EXECUTE IMMEDIATE 'GRANT DROP ANY TABLE TO 用戶名';
EXECUTE IMMEDIATE 'GRANT DROP ANY VIEW TO 用戶名';
EXECUTE IM......余下全文>>