1, 表空间创建
-- 删除表空间
drop tablespace EVPBDMGIS including contents and datafiles;
-- 删除用户
drop user EVPBDMGIS cascade;
-- 创建表空间
create tablespace EVPBDMGIS datafile 'D:\app\Administrator\oradata\orcl\EVPBDMGIS.DBF' size 500m reuse autoextend on next 16m maxsize unlimited logging extent management local segment space management auto;
-- 创建用户设置默认表空间
- create user EVPBDMGIS identified by EVPBDMGIS
- default tablespace EVPBDMGIS
- temporary tablespace temp;
-- 设置用户权限
grant connect,resource,exp_full_database,imp_full_database to EVPBDMGIS ;
-- 查询当前连接用户
--select username,sid,serial# from v$session
-- 清除连接用户
--alter system kill session '223,50256'
2, 导入, 导出
-- 导出表结构
exp sjcg/[email protected] owner=sjcg file=D:\sjcg0727schema.dmp rows=n compress=n
-- 导出命令: exp 用户名 / 密码 @数据库 owner = 用户名 file = 文件存储路径 (如: F:\abcd.dmp)
exp sjcg/[email protected] file=D:\sjcg_ev_20190124.dmp owner=sjcg
-- 导入命令: imp 用户名 / 密码 @数据库 fromuser = 用户名 touser = 用户名 file=d:\cu.dmp ignore=y
imp hzuhvproj/[email protected] fromuser=hzuhvproj touser=hzuhvproj file=D:\Temp.dmp ignore=y
-- 导入指定表
imp sjcg/[email protected] tables=(ev_t_bc_lineproperty,ev_t_bc_mapobject,ev_t_bc_mapobjectproperty,ev_t_bc_station) file=D:\Temp\SJCG0122schema.dmp
cu/[email protected]: 导入的数据库登陆 (用户名 / 密码 @数据库)
fromuser: 文件的指定用户
touser: 指定导入到当前登录的数据库某个用户
file: 需要导入的数据文件
ignore: 是否忽略创建错误
-- 登录不区分大小写
alter system set sec_case_sensitive_logon=false
-- 解锁用户
ALTER USER username ACCOUNT UNLOCK;
来源: http://www.bubuko.com/infodetail-3149868.html