«

Oracle-impdp导入.dmp文件

指尖二进制 • 1 年前 • 833 次点击 • ORACLE


首先你要导入.dmp文件。那就必须要有一个.dmp文件才能够进行。(自己去找)

[root@www ~]# mkdir /backup
[root@www ~]# chmod -R 777 /backup
[root@www ~]# mv filename.dmp /backup/
[root@www ~]# chown oracle.oinstall /backup/
[root@www ~]# chown oracle.oinstall /backup/*
[root@www ~]# ll
[root@www ~]# ll /backup/
总用量 53360
-rwxrw-rw- 1 oracle oinstall 54640640 12月 30 2016 20161228.dmp

登录oracle

[root@www /]# su - oracle
[oracle@www ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Sat Mar 24 23:57:22 2018

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

创建用户

SQL> create user ami identified by ami;

User created.

赋予权限

SQL> grant connect,resource,dba to ami;

Grant succeeded.

查询用户表空间文件的绝对路径:

SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/prod/system01.dbf
/u01/app/oracle/oradata/prod/sysaux01.dbf
/u01/app/oracle/oradata/prod/undotbs01.dbf
/u01/app/oracle/oradata/prod/users01.dbf
/u01/app/oracle/oradata/prod/example01.db
--创建表空间
SQL> create tablespace BPAS datafile '/u01/app/oracle/oradata/prod/db1.dbf' size 100M autoextend on;

Tablespace created.

--查询临时表空间文件的绝对路径。如果需要的话,可以通过查询来写定绝对路径。一般用${ORACLE_HOME}就可以了
SQL> select name from v$tempfile;

NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/prod/temp01.dbf

--创建临时表空间
SQL> create temporary tablespace GROUP1 tempfile '/u01/app/oracle/oradata/prod/db2.dbf' size 500M autoextend on;

Tablespace created.

--将/backup目录转化成oracle数据库能够识别的目录。
SQL> create directory dump_dir as '/backup';

Directory created.

--授权
SQL> grant read,write on directory dump_dir to system;

Grant succeeded.

--退出
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

进行导入.dmp文件

[oracle@www ~]$ cd /backup/
[oracle@www backup]$ ls
filename.dmp
[oracle@www backup]$ impdp system/oracle directory=dump_dir dumpfile=filename.dmp logfile=impdp.log schemas=ami

登录oracle

[oracle@www backup]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Sun Mar 25 00:31:19 2018

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

--查看对象
SQL> select count (*) from dba_objects where owner='AMI';

  COUNT(*)
----------
     16730
还没收到回复