码迷,mamicode.com
首页 > 其他好文 > 详细

DDL及其数据泵导入导出(impdp/expdp)

时间:2017-05-26 00:51:06      阅读:203      评论:0      收藏:0      [点我收藏+]

标签:select   files   赋权   rac   dump   constrain   schema   blog   ons   

create tablespace ybp_dev datafile G:\app\Administrator\oradata\health\ybp_dev1.dbf size 10m autoextend on;

create user 用户名 default tablespace 表空间名 identified by 用户密码;

grant connect,resource to 用户;

测试连接 conn mpi/1234


删除表空间
drop tablespace XX including contents and datafiles cascade constraints;
//including contents 删除表空间的内容
//cascade constraints同时删除
tablespace中表的外键参照



删除用户
drop user USERNAME CASCADE;
如提示ora-01940 无法删除已经连接会话的用户
select username,sid,serial# from v$session where username like HIP4
找到要删除用户的sid,和serial,并删除
alter system kill session532,4562


-------------------------------------------
su - oracle   -切换oracle用户
sqlpus / as sysdba   -本地登录sqlplus
select * from dba_directories;  -查询路径
drop directory dp_dir;   -删除目录
create directory dp_dir as /backup/dp_dir;  -创建目录
grant read,write on directory dp_dir to public;  -赋权目录
expdp xx/xx directory=dp_dir dumpfile=xxx.dmp schemas=xxx  --导出


例  expdp "/as sysdba" directory=dp_dir dumpfile=xx1207.dmp schemas=xx
impdp "/as sysdba" directory=dp_dir dumpfile=1112mdbyl.dmp   --导入.注意此处不加封 封号!!!!

impdp "/as sysdba" directory=dp_dir dumpfile=1112mdbyl.dmp remap_schema=mdbyl:mdbyl3   --导入改名


select file_name,tablespace_name from dba_data_files; --查询数据文件路径


select username,default_tablespace from dba_users where username like X%;  --模糊查询x开头的用户

SELECT * FROM V$SESSION WHERE USERNAME=PINGTAI;

alter system kill session 3406,1671;
drop user PINGTAI cascade;
---------------------------------------------------
SELECT t.table_name,
       t.colUMN_NAME,
       t.DATA_TYPE || ( || t.DATA_LENGTH || ),
       t1.COMMENTS
  FROM User_Tab_Cols t, User_Col_Comments t1
WHERE t.table_name = t1.table_name
    AND t.column_name = t1.column_name(+);

 

DDL及其数据泵导入导出(impdp/expdp)

标签:select   files   赋权   rac   dump   constrain   schema   blog   ons   

原文地址:http://www.cnblogs.com/littlewu/p/6906541.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!