一、创建用户
select * from dba_users;
select * from all_users;
select * from user_users;
create user test1 identified by test1;
指定缺省表空间:
create user test2 identified by test2 default tablespace testtbs;
指定配额:
create user test4 identified by test4 default tablespace testtbs quota 1m on users quota unlimited on testtbs;
指定临时表空间
create
1、默认情况不指定的话用户默认表空间为users临时表空间为temp,这是由database属性决定:
select * from database_properties;
PROPERTY_NAME PROPERTY_VALUE DESCRIPTION
1 DICT.BASE 2 dictionary base tables version #
2 DEFAULT_TEMP_TABLESPACE TEMP Name of default temporary tablespace
3 DEFAULT_PERMANENT_TABLESPACE USERS Name of default permanent tablespace
4 DEFAULT_TBS_TYPE SMALLFILE Default tablespace type
5 NLS_LANGUAGE AMERICAN Language
6 NLS_TERRITORY AMERICA Territory
7 NLS_CURRENCY $ Local currency
8 NLS_ISO_CURRENCY AMERICA ISO currency
9 NLS_NUMERIC_CHARACTERS ., Numeric characters
10 NLS_CHARACTERSET ZHS16GBK Character set
11 NLS_CALENDAR GREGORIAN Calendar system
12 NLS_DATE_FORMAT DD-MON-RR Date format
13 NLS_DATE_LANGUAGE AMERICAN Date language
14 NLS_SORT BINARY Linguistic definition
修改用户创建时数据库缺省指定的表空间及临时表空间:(把users改为testtbs)
这样可以删除users表空间(确保以前用户没有用users);
alter database default tablespace testtbs;
这样以前用户默认表空间为users也变为testtbs;
但对象仍在users上;
select tablespace_name from dba_extents where segment_name='T3';
2、改变用户的默认表空间
alter user test1 default tablespace testtbs;
3、创建用户后分配了create table的权限后,仍然无法创建表提示:
SQL> create table t4(id number);
create table t4(id number)
*
第 1 行出现错误:
ORA-01950: 对表空间 'TESTTBS' 无权限
这是由于没有给用户在表空间上分配配额:
alter user test3 quota 1m on testtbs;就可以了,或者在创建用户时指定配额;
4、口令过期
create user test6 identified by test6 default tablespace testtbs temporary tablespace temp1 password expire;
当下次test6登录时会提示更改密码。
默认用户刚创建后没有任何权限;
select * from dba_sys_privs where grantee='TEST1';
查看所有系统权限:
select * from system_privilege_map;
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/28813052/viewspace-758989/
,如需转载,请注明出处,否则将追究法律责任。