锐单电子商城 , 一站式电子元器件采购平台!
  • 电话:400-990-0325

oracle导出dmp文件合集

时间:2023-11-23 09:07:02 300kn70sa3载荷传感器

Oracle导出dmp文件合集

  • 在用户下导出所有表
exp 用户名/用户密码@ORCL file=D:\dmp\DEMO_20220121.dmp owner=用户名 buffer=8192000 log=D:\dmp\DEMO_20220121_daochu.log 
  • 在指定表名下导出所有表
exp DEMO/DEMO@ORCL file=D:\dmp\DEMO_20220121_ep.dmp tables=表名,表名 buffer=8192000 log=D:\dmp\DEMO_20220121_ep_daochu.log 
  • 导出以**开头的表( 表示导出DEMO用户下DEMO_所有开头表 )
exp 用户名/用户密码@ORCL_MDPC file=D:\dmp\DEMO_20220307_demo.dmp tables=(用户名.DEMO_%) buffer=8192000 log=D:\dmp\DEMO_20220307_demo_daochu.log 

扩展:

full = y 全库导出
owner = (user1, user2) 指定用户导出

imp命令导入dmp文件到数据库

imp 用户名/密码@ORCL file=D:\dmp\DEMO_20220121.dmp full=y  

ORACLE 这些对象由 XXXX 导出, 而不是当前用户

imp sa3/123456 file=xxx full=y ingore=y 

EXP-00091: 有问题的统计信息正在导出。

问题产生原因为服务端oracle这个问题是由于字符编码与客户端的字符编码不一致造成的

解决办法

  • 登录sqlplus,查询客户端相关信息
select * from V$NLS_PARAMETERS 
  • 查询服务端编码
SELECT * FROM NLS_DATABASE_PARAMETERS; 

注意NLS_LANGUAGE(语言),NLS_TERRITORY(地区),NLS_CHARACTERSET(字符集);
环境变量设置的值格式为:语言_地区.字符集

检查相关字符集是否相同,请修改为一到

在这里插入图片描述

  • 修改方式
    • windows R—>输入regedit打开注册表
    • 查看以下路径–> HKEY_LOCAL_MACHINE–> SOFTWARE–> Wow6432Node—> ORACLxEKEY_Oracle_11g

问题解决

expdp进行dmp文件导出

expdp导出
确保数据备份路径已经创建,如果没有,则按照准备工作中的说明创建。(注:如果CPU强烈建议打开资源充足的平行参数,可以大大节省导出时间)
第一种:“full=y全量导出数据库:
expdp user/passwd@orcl dumpfile=expdp.dmp directory=data_dir full=y logfile=expdp.log;

第二种:schemas用户导出:
expdp user/passwd@orcl schemas=user dumpfile=expdp.dmp directory=data_dir logfile=expdp.log;
导出SCOTT用户下的emp和dept表
expdp scott/oracle directory=dump_dir dumpfile=scotttab.dmp tables=emp,dept

三:按表空间导出:
expdp sys/passwd@orcl tablespace=tbs1,tbs2 dumpfile=expdp.dmp directory=data_dir logfile=expdp.log;

第四:导出表:
expdp user/passwd@orcl tables=table1,table2 dumpfile=expdp.dmp directory=data_dir logfile=expdp.log;

第五:根据查询条件:
expdp user/passwd@orcl tables=table1=‘where number=1234’ dumpfile=expdp.dmp directory=data_dir logfile=expdp.log;

SQL 错误 [1940] [42000]: ORA-01940: 无法删除当前连接的用户

  • 查询用户的流程
select  username,sid,serial# from v$session; 

  • 杀死相关过程
alter system kill session '234,12' ;  
  • 删除用户
drop user ZCGL_V8_20220628 cascade; 

创建新用户和表空间

select name from v$datafile;  --查询表空间名称 CREATE TABLESPACE 名称 DATAFILE '路径+大写名称.DBF' SIZE 10M AUTOEXTEND ON NEXT 10M;
--创建表空间
create user 用户名 identified by 密码 default tablespace 表空间名称
--新用户授权
grant dba to 用户名;
grant connect, resource to 用户名;
grant select any table to 用户名;
grant update any table to 用户名;
grant create any table to 用户名;
grant delete any table to 用户名;

注意事项

nt update any table to 用户名;
grant create any table to 用户名;
grant delete any table to 用户名;


### 注意事项

























锐单商城拥有海量元器件数据手册IC替代型号,打造电子元器件IC百科大全!

相关文章