2,sqlplus 登录 / sqlplus 命令登录
在安装 Oracle 时,你需要记住设置的 "全局数据库名"(默认为 orcl) 和 口令,在以两种方式登录时:
用户名: sys(超级用户 ==sysdba) / system(管理员用户 和 sys 想比区别在于 system 不能创建表空间)...
口 令:sqlplus / as sysdba;
3,创建临时表空间 / 表空间 / 创建用户 / 授权
1:创建临时表空间
2:创建数据表空间
create temporary tablespace user_temp
tempfile 'Q:\oracle\product\10.2.0\oradata\Test\xyrj_temp.dbf'
size 50m
autoextend on
next 50m maxsize 20480m
extent management local;
segment space management auto;
create tablespace user_data
datafile 'Q:\oracle\product\10.2.0\oradata\Test\xyrj_data.dbf'
size 50m
autoextend on
next 50m maxsize unlimited
extent management local
第3步:创建用户并指定表空间
第4步:给用户授予权限
create user username identified by password
default tablespace user_data
temporary tablespace user_temp;
grant connect,resource,dba to username;
二,删除用户及表空间
删除 user
drop user ×× cascade
说明: 删除了 user,只是删除了该 user 下的 schema objects,是不会删除相应的 tablespace 的.
删除 tablespace
drop tablespace tablespace_name including contents and datafiles;
SQL code-- 删除空的表空间,但是不包含物理文件
drop tablespace tablespace_name;
-- 删除非空表空间,但是不包含物理文件
drop tablespace tablespace_name including contents;
-- 删除空表空间,包含物理文件
drop tablespace tablespace_name including datafiles;
-- 删除非空表空间,包含物理文件
drop tablespace tablespace_name including contents and datafiles;
-- 如果其他表空间中的表有外键等约束关联到了本表空间中的表的字段,就要加上 CASCADE CONSTRAINTS
drop tablespace tablespace_name including contents and datafiles cascade constraints;
--- 转载 ---
http://www.cnblogs.com/xmaomao/p/3273102.html
来源: http://www.bubuko.com/infodetail-2454932.html