ORACLE创建用户及导入、导出

默认用户:
system/manager
scott/tiger

--创建空间
create tablespace schedule_115 datafile 'D:\oracle\product\10.2.0\oradata\orcl\schedule_115.dbf'
size 50M default storage (initial 500K Next 500K minextents 1 maxextents unlimited pctincrease 0);
--创建用户
create user schedule identified by tisson default tablespace schedule_115;--temporary tablespace temp;
--将空间分配给用户
--alter user "schedule" default tablespace "schedule_115";
--删除用户
--drop user "schedule" cascade; 
--修改用户密码
alter user schedule identified by tisson;
--给用户授权
grant dba to schedule;--授予DBA权限
grant connect to schedule;
grant resource to schedule;
grant unlimited tablespace to schedule;--授予不限定的表空间
grant select any table to schedule;--授予查询任何表
grant select any dictionary to schedule;--授予查询任何字典
grant create session to schedule;--授予用户创建session的权限,即登陆权限
grant create table to schedule;--授予创建表的权限

--create user 用户名 identified by 密码;--创建新用户
--create tablespace 表空间名 datafile '表空间存储位置d:\data.dbf' size 表空间大小m;--创建表空间
--alter user 用户名 default tablespace 表空间名;--将空间分配给用户
--grant create session,create table,unlimited tablespace to 用户名;--给用户授权
--删除表空间
--drop tablespace "schedule_115" including contents and datafiles;
--删除用户
--drop user "schedule" cascade;
--修改表空间
--alter table t_bap_topic move tablespace CSRS_DATA
--增加表空间
--alter tablespace chinawater add datafile 'D:\oracle\product\10.2.0\oradata\schedule\ADDCHINAWATER.dbf' size 200M

--导入一个完整数据库
--imp system/manager file=bible_db log=dible_db full=y ignore=y
--导入一个或一组指定用户所属的全部表、索引和其他对象
--imp system/manager file=seapark log=seapark fromuser=seapark
--imp system/manager file=seapark log=seapark fromuser=(seapark,amy,amyc,harold)
--将一个用户所属的数据导入另一个用户
--imp system/manager file=tank log=tank fromuser=seapark touser=seapark_copy
--imp system/manager file=tank log=tank fromuser=(seapark,amy) touser=(seapark1, amy1)
--导出表
exp 登录名/密码@数据库 file=E:\oracle.dmp owner=所属用户
--导入表
Imp 登录名/密码@数据库 file=E:\oracle.dmp fromuser=导出数据用户 touser=被导入数据用户
--导出指定表
exp 登录名/密码@数据库 file=E:\table1.dmp tables=(table1,table2,table3)
--导入指定表
imp 登录名/密码@数据库 file=E:\table1.dmp tables=(table1,table2,table3)
--只导出表结构
exp 登录名/密码@数据库 file=E:\oracle.dmp rows=n owner=用户

猜你喜欢

转载自jchen.iteye.com/blog/1397390