一.导入exp导出的.dmp文件
Linux环境下导入oracle备份数据.dmp文件
- 切换至oracle用户下。
2.[oracle@mophee ~]$ imp
- Import: Release 11.2.0.1.0 - Production on Fri Jun 29 22:47:10 2018
- Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
- Username: INDBADMIN //输入用户名和密码
- Password:
- Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
- With the Partitioning, OLAP, Data Mining and Real Application Testing options
- Import data only (yes/no): no > no //是否只导入数据,建议选no
- Import file: expdat.dmp > /var/app/finall_dmp/indbadmin.dmp //数据备份文件路径
- Enter insert buffer size (minimum is 8192) 30720> //回车即可
- Export file created by EXPORT:V11.02.00 via conventional path
- import done in US7ASCII character set and UTF8 NCHAR character set
- import server uses AL32UTF8 character set (possible charset conversion)
- export client uses ZHS16GBK character set (possible charset conversion)
- export server uses AL16UTF16 NCHAR character set (possible ncharset conversion)
- List contents of import file only (yes/no): no > no // 只列出倒入文件的内容
- Ignore create error due to object existence (yes/no): no > no //由于对象已存在,忽略创建错误
- Import grants (yes/no): yes > yes //导入权限
- Import table data (yes/no): yes > yes //导入表数据
- Import entire export file (yes/no): no > yes //导入整个导出文件
..........
二.导入expdp导出的.dmp文件
//创建oracle用户
create user gzTab identified by gzTab;
//创建表空间
create tablespace ACS_GZHS datafile '/opt/app/oradata/orcl/ACS_GZHS.dbf' size 5000m;
//分配表空间给指定用户
alter user gzTab default tablespace ACS_GZHS;
//创建目标目录
create directory data_dir as '/home/oracle/dmp/user';
//给用户授权
grant create session,create table,create view,create sequence,unlimited tablespace,read,write on directory data_dir to gzTab;
可分为两步
grant create session,create table,create view,create sequence,unlimited tablespace,read,write on directory data_dir to gzTab;
grant read,write on directory data_dir to gzTab;
//上传备份.dmp文件至目标目录,并修改红色部分
impdp gzTab/gzTab@10.10.90.54:1521/orcl EXCLUDE=STATISTICS transform=segment_attributes:n DIRECTORY=data_dir DUMPFILE=ACS_GZHS.DMP REMAP_SCHEMA=ACS_GZHS:gzTab full=y
//注意:ACS_GZHS:gzTab 是 表空间:用户名