DDL及其数据泵导入导出(impdp/expdp)
Posted ThinkDifferent
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了DDL及其数据泵导入导出(impdp/expdp)相关的知识,希望对你有一定的参考价值。
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 session‘532,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)的主要内容,如果未能解决你的问题,请参考以下文章
Oracle impdp/expdpBig lesson from failure with impdp/expdp in 12c