日期:2014-05-16  浏览次数:20506 次

ORACLE常用操作语句(创建用户,表空间,备份表空间)

sqlplus操作:

查看所有表空间及其所在位置
select tablespace_name,file_name from dba_data_files;

?

删除表空间和数据文件:
drop tablespace tablespacename incuding contents and datafiles;

?

删除用户
drop user test cascade;

?

备份和恢复操作

1.首先,创建(新)用户:
?? create user username identified by password;
?? username:新用户名的用户名
?? password: 新用户的密码
?? 也可以不创建新用户,而仍然用以前的用户,如:继续利用scott用户


2.创建表空间:
?? create tablespace tablespacename datafile 'd:\data.dbf'?size xxxm;
?? tablespacename:表空间的名字
?? d:\data.dbf':表空间的存储位置??

?? xxx表空间的大小,m单位为兆(M)


3.将空间分配给用户:
?? alter user username default tablespace tablespacename;
?? 将名字为tablespacename的表空间分配给username


4.给用户授权:
?? grant create session,create table,create view,create sequence,resource,unlimited tablespace to username

?

?? grant create table,create view,create sequence,resource to 用户


5.必须commit;
6.然后就可以用自己创建的用户登录查看了。
conn username/password;

?

数据导出导入

在dos下导入导出
exp?用户名/密码@服务器/数据库 file=备份文件

imp 用户名/密码@服务器/数据库 file=备份文件 full=y ignore=y;

可视化操作:

http://127.0.0.1:1158/em/网页登陆地址

?