create user test1 identified by test1;
grant connect,create table to test1;
conn cyts_cc/cyts_cc@orcl2000;
create table(
id int)
tablespace user;
ERROR 位于第 1 行:
ORA-01950: 表空间'USERS'中无权限
conn cyts_cc/cyts_cc@orcl2000;
alter user test1 quota 1M on users;
create tab
(id int);
success
alter user test1 account lock;
conn test1/test1@orcl2000;
ERROR:
ORA-28000: the account is locked
1 Database Schema
a schema is a named collection of objects
b user is created and a corresponding schema is created
c user can be associated only with one schema
d username and schema are often userd interchangely.
2 Checklist for creating users
a idntfigy tablespaces in which the usr nedds to store objects
b decide on quotas for each tablespace
c assign a default tablespace and temporary tablespace.if you do not specify at the time of create user,system tablespace will be the defalut tablespace and temporary.it will affect the performance of the oralce.
d create user
e grant privileges and roles to user
desc dba_users;
select * from dba_users;
3 Creating a new user:
Database Authentiacation
set the initial password
create user aaron
identified by soccer
default tablespace data
temporary tablespace temp
guota 15m on data
password expire;
alter database default temporary tablespace temp;
4 Creating a new user operating System Authentication
os_authent_prefix initialllization parameter specifies the format of the username
defauts to ops$
create user arron
identified externally
default tablespace users
temporary tablespace temp
quota 15m on data
password expire;
conn /
show parameter os
os_authent_prefix string OPS$
create user ops$test3
identified externally
default tablespace us
temporary tablespace
quota 10m on users
thee test2 is an user of os ,which the oracle is installed.
5 Changing user quota on tablespace
alter user test3 quota 4m on users;
you cann't grant quota on temp and undotbs.
alter quota 0 on uers -- means that no new table space can be allocated and cannot change the exist object in the tablespaces
6 drop user
you cannot drop user who has connected to oracle
drop user (cascade)
7 Obtaining User information
information about uers can be obtained by qerying the data dictionary
dba_users
名称
-----------------------------
USERNAME
USER_ID
PASSWORD
ACCOUNT_STATUS
LOCK_DATE
EXPIRY_DATE
DEFAULT_TABLESPACE
TEMPORARY_TABLESPACE
CREATED
PROFILE
INITIAL_RSRC_CONSUMER_GROUP
EXTERNAL_NAME
dba_ts_quotas
名称
---------------
TABLESPACE_NAME
USERNAME
BYTES
MAX_BYTES
BLOCKS
MAX_BLOCKS