dmp文件导入oracle

命令行运行:sqlplus登录

1. 创建目录
create or replace directory dump_oracle_db as 'F:\oracle_db';
--说明:
--dump_oracle_db--目录名
--F:\oracle_db--目录指向的文件夹
2. 查看创建的目录
select * from dba_directories;
3. 把dmp文件放到这个文件夹下
4. 创建用户
create user zfpt40 identified by oracle;
--说明:
--zfpt40--用户名(相当于数据库名)
5. 授权
grant dba to zfpt40;
grant read,write on directory dump_oracle_db to zfpt40;
6. 退出
exit;
7. 执行导入
impdp zfpt40/oracle@orcl dumpfile=ZFPT40_20181129_060716.DMP directory=DUMP_ORACLE_DB
--说明
--zfpt40/oracle--zfpt40是上面新建的用户名,oracle是给这个用户名设置的密码
--ZFPT40_20181129_060716.DMP--dmp文件名
--DUMP_ORACLE_DB--上面新建的目录


附:
扩充表空间:
ALTER TABLESPACE USERS ADD DATAFILE 'D:\APP\ZHAOYU\ORADATA\ORCL\USERS02.DBF' SIZE 30720M ;
alter tablespace temp add tempfile 'D:\APP\ZHAOYU\ORADATA\ORCL\temp03.dbf' size 5120m;

查询表空间利用情况:
select * from (
Select a.tablespace_name,
to_char(a.bytes/1024/1024,'99,999.999') total_bytes,
to_char(b.bytes/1024/1024,'99,999.999') free_bytes,
to_char(a.bytes/1024/1024 - b.bytes/1024/1024,'99,999.999') use_bytes,
to_char((1 - b.bytes/a.bytes)*100,'99.99') || '%'use
from (select tablespace_name,
sum(bytes) bytes
from dba_data_files
group by tablespace_name) a,
(select tablespace_name,
sum(bytes) bytes
from dba_free_space
group by tablespace_name) b
where a.tablespace_name = b.tablespace_name
union all
select c.tablespace_name,
to_char(c.bytes/1024/1024,'99,999.999') total_bytes,
to_char( (c.bytes-d.bytes_used)/1024/1024,'99,999.999') free_bytes,
to_char(d.bytes_used/1024/1024,'99,999.999') use_bytes,
to_char(d.bytes_used*100/c.bytes,'99.99') || '%'use
from
(select tablespace_name,sum(bytes) bytes
from dba_temp_files group by tablespace_name) c,
(select tablespace_name,sum(bytes_cached) bytes_used
from v$temp_extent_pool group by tablespace_name) d
where c.tablespace_name = d.tablespace_name
)
order by tablespace_name

 

 

 

 

 

你可能感兴趣的:(数据库)