create user invest_zh identified by invest_zh;
grant dba to invest_zh;
-----创建临时表空间
create temporary tablespace temp_invest_zh
tempfile 'D:/app/Administrator/oradata/temp_invest_zh.dbf'
size 50m
autoextend on
next 50m maxsize 20480m
extent management local;
-----创建表空间
create tablespace data_invest_zh
logging
datafile 'D:/app/Administrator/oradata/data_invest_zh.dbf'
size 50m
autoextend on
next 50m maxsize 20480m
extent management local;
- -- 创建用户时未指定表空间的情况
- -- alter user joffice default tablespace joffice
oracle内部有两个建好的用户:system和sys。用户可直接登录到system用户以创建其他用户,因为system具有创建别 的用户的 权限。 在安装oracle时,用户或系统管理员首先可以为自己建立一个用户。例 如 :
-
Sql代码
create user user01 identified by u01;
该命令还可以用来设置其他权限,详细情况参见自学资料。要改变一个口令,可以使用alter user命令:
<span style="white-space: pre;"> alter user user01 identified by usr01;</span>
<span style="white-space: pre;"><span style="white-space: normal;"> </span> </span>
现在user01的口令已由“u01”改为“usr01”。
除了alter user命令以外,用户还可以使用password命令。如果使用password命令,用户输入的新口令将不在屏幕上显示。有dba特权的用户可以通过password命令改变任何其他用户的口令;其他用户只能改变自己的口令。
当用户输入password命令时,系统将提示用户输入旧口令和新口令,如下所示:
password
changing password for user01
old password:
new password:
retype new password:
当成功地修改了口令时,用户会得到如下的反馈:
password changed
创建后如果报错:ora-01045 :user system lacks create session privilege; logon denied
原因:该用户没有创建session会话的权限
在Google找到这段的说明:
What does “ORA-01045: user USERNAME lacks CREATE SESSION privilege;
logon denied” mean?
It means that the username and password with which you tried to login are known and accepted by the Oracle server, but that the username doesn’t have permission to create a session. If you think this username should have permission to create sessions send mail to acisdba.
解决办法:
使用系统用户登录后,使用如下sql语句给出错用户赋权限
grant create session to UserName;(UserName是登录出错的用户名)