exp ogi/ogi@192.168.2.99 file=c:/ogi owner=ogi //导出数据库
sqlplus system/sys as sysdba
drop user ogi;
create user ogi //创建用户ogi
identified by ogi //设置密码ogi
default tablespace SYSTEM //默认表空间
temporary tablespace TEMP;
grant dba to ogi;
host;
imp ogi/ogi@orcl full=y file= c:/ogi ignore=y ; //导入数据库
racle新建表空间,并给新用户授权 (2010-10-15 10:39:05)
标签: oracle表空间 oracle新用户 orcle orcle用户授权 分类: oracle
Oracle创建数据库:
用'Database Configuration Assistant'向导来创建数据库。
我使用数据库是安装时创建的orcl。习惯使用系统用户system,但要想把数据库开放给其他人使用,就要
先创建一个新用户,并且为该用户指定表空间。
下面是创建数据库用户的具体过程:
1.确定你的数据库目录:‘D:/oracle/product/10.2.0/oradata/orcl’(注:我的Oracle10g安装在
D:/oracle下)。
2.创建表空间:
格式: create tablespace 表空间名 datafile '数据文件名' size 表空间大小;
例:
SQL> create tablespace jcfx_tablespace datafile 'D:/oracle/product/10.2.0
/oradata/orcl/jcfx.dbf’size 256M;
其中:
jcfx_tablespace是你自定义的表空间名称,可以任意取名;
D:/oracle/product/10.2.0/oradata/orcl/jcfx.dbf是数据文件的存放位置;
jcfx.dbf文件名也是任意取;
size 256M是指定该数据文件的大小,也就是表空间的大小。
3.创建用户:
格式: create user 用户名 identified by 密码 default tablespace 表空间名称;
例:
SQL> create user jcfx identified by jcfx default tablespace jcfx_tablespace;
4.给新用户授权:
把 connect,resource权限授予新用户
SQL> grant connect,resource to jcfx;
把 dba权限授予给新用户
SQL> grant dba to testone;
SQL> grant create session to jcfx;//创建session的权限,即登陆权限
SQL> grant unlimited session to jcfx;//使用表空间的权限
SQL> grant create table to jcfx;//建表的权限
SQL> grante drop table to jcfx;//删除表的权限
SQL> grant insert table to jcfx;//插入表的权限
SQL> grant update table to jcfx;//修改表的权限
SQL> grant all to public;//这条比较重要,授予所有权限(all)给所有用户(public)
可以根据需要授权。
授权成功。