针对Oracle数据迁移,我们可能会用到expdp/impdp的方式,有时候需要大表、lob字段等可能会消耗过大的临时表空间和undo表空间,所以一般我们根据导出日志,在导入前适当调整表空间大小。否则我们可能会遇到以下问题:

1、临时表空间爆满,无法扩展

ORA-1652: unable to extend temp segment by 128 in tablespace TEMP

解决方案如下:

(1)临时表空间使用情况查看:
col file_name for a85;
set line 200;
select file_name, BYTES/1024/1024/1024 Size_GB, MAXBYTES/1024/1024/1024 Msize_GB, AUTOEXTENSIBLE from dba_temp_files; (2)使用临时段session查看:
SELECT se.username,
se.sid,
se.serial#,
se.machine,
se.program,
su.segtype,
su.contents
FROM v$session se,
v$sort_usage su
WHERE se.saddr=su.session_addr ; USERNAME SID SERIAL# MACHINE PROGRAM SEGTYPE CONTENTS
--------------- ---------- ---------- -------------------- ----------------------------------- --------- ---------
impdpuser 5 28002 test.localhost.com oracle@test.localhost.com (DW00) LOB_DATA TEMPORARY
impdpuser 5 28002 test.localhost.com oracle@test.localhost.com (DW00) SORT TEMPORARY
impdpuser 5 28002 test.localhost.com oracle@test.localhost.com (DW00) SORT TEMPORARY
impdpuser 5 28002 test.localhost.com oracle@test.localhost.com (DW00) SORT TEMPORARY (3)增加临时表空间数据文件:
alter tablespace temp add TEMPFILE '/home/U01/app/oracle/oradata/testdb/temp01.dbf ' size 50M autoextend on next 50M;

2、查看impdp进度情况

)登陆交互模式
impdp impdpuser/impdpuser@service_name directory=datadump_dir dumpfile=impdp.dmp logfile=impdp.log attach=SYS_IMPORT_FULL_01 使用status查看进度信息 Import> status Job: SYS_IMPORT_FULL_01
Operation: IMPORT
Mode: FULL
State: EXECUTING
Bytes Processed: 0
Current Parallelism: 1
Job Error Count: 0
Dump File: /home/oracle/data.dmp Worker 1 Status:
Instance ID: 1
Instance name: testdb
Host name: test.localhost.com
Process Name: DW00
State: EXECUTING
Object Schema: USERNAME01
Object Name: TABLE_T1
Object Type: SCHEMA_EXPORT/TABLE/TABLE_DATA
Completed Objects: 1
Total Objects: 34
Completed Rows: 816,282,438
Completed Bytes: 64,412,720,616
Percent Done: 99
Worker Parallelism: 1
()数据字典查看
select * from dba_datapump_jobs ;

3、undo表空间爆满

    ORA-30036: unable to extend segment by 8 in undo tablespace 'UNDOTBS1'

解决方案:

)查看undo表空间使用情况
col file_name for a85;
set line 200;
select file_name,bytes/1024/1024 from dba_data_files where tablespace_name like 'UNDOTBS%'; SELECT UPPER(F.TABLESPACE_NAME) AS "TABLESPACE_NAME",
ROUND(D.MAX_BYTES,2) AS "TBS_TOTAL_SIZE" ,
ROUND(D.AVAILB_BYTES ,2) AS "TABLESPACE_SIZE",
ROUND(D.MAX_BYTES - D.AVAILB_BYTES +USED_BYTES,2) AS "TBS_AVABLE_SIZE",
ROUND((D.AVAILB_BYTES - F.USED_BYTES),2) AS "TBS_USED_SIZE",
TO_CHAR(ROUND((D.AVAILB_BYTES - F.USED_BYTES) / D.AVAILB_BYTES * 100,2),'999.99') AS "USED_RATE(%)",
ROUND(F.USED_BYTES, 6) AS "FREE_SIZE(G)"
FROM (SELECT TABLESPACE_NAME,
ROUND(SUM(BYTES) / (1024 * 1024 * 1024), 6) USED_BYTES,
ROUND(MAX(BYTES) / (1024 * 1024 * 1024), 6) MAX_BYTES
FROM DBA_FREE_SPACE
GROUP BY TABLESPACE_NAME) F,
(SELECT DD.TABLESPACE_NAME,
ROUND(SUM(DD.BYTES) / (1024 * 1024 * 1024), 6) AVAILB_BYTES,
ROUND(SUM(DECODE(DD.MAXBYTES, 0, DD.BYTES, DD.MAXBYTES))/(1024*1024*1024),6) MAX_BYTES
FROM DBA_DATA_FILES DD
GROUP BY DD.TABLESPACE_NAME) D
WHERE D.TABLESPACE_NAME = F.TABLESPACE_NAME
AND D.TABLESPACE_NAME=&UNDO_TABLESPACE_NAME
ORDER BY 5 DESC; )查看undo段使用情况
select s.username, u.name from v$transaction t,v$rollstat r, v$rollname u,v$session s
where s.taddr=t.addr and t.xidusn=r.usn and r.usn=u.usn order by s.username; select usn,xacts,rssize/1024/1024/1024,hwmsize/1024/1024/1024,shrinks
from v$rollstat order by rssize; )查看归档日志切换情况
SELECT to_char(trunc(first_time),'DD-Mon-YY') "Date",
to_char(first_time, 'Dy') "Day",
'|' separator,
count(1) Total,
'|' separator,
SUM(decode(to_char(first_time, 'hh24'),'',1,0)) "h0",
SUM(decode(to_char(first_time, 'hh24'),'',1,0)) "h1",
SUM(decode(to_char(first_time, 'hh24'),'',1,0)) "h2",
SUM(decode(to_char(first_time, 'hh24'),'',1,0)) "h3",
SUM(decode(to_char(first_time, 'hh24'),'',1,0)) "h4",
SUM(decode(to_char(first_time, 'hh24'),'',1,0)) "h5",
SUM(decode(to_char(first_time, 'hh24'),'',1,0)) "h6",
SUM(decode(to_char(first_time, 'hh24'),'',1,0)) "h7",
SUM(decode(to_char(first_time, 'hh24'),'',1,0)) "h8",
SUM(decode(to_char(first_time, 'hh24'),'',1,0)) "h9",
SUM(decode(to_char(first_time, 'hh24'),'',1,0)) "h10",
SUM(decode(to_char(first_time, 'hh24'),'',1,0)) "h11",
SUM(decode(to_char(first_time, 'hh24'),'',1,0)) "h12",
SUM(decode(to_char(first_time, 'hh24'),'',1,0)) "h13",
SUM(decode(to_char(first_time, 'hh24'),'',1,0)) "h14",
SUM(decode(to_char(first_time, 'hh24'),'',1,0)) "h15",
SUM(decode(to_char(first_time, 'hh24'),'',1,0)) "h16",
SUM(decode(to_char(first_time, 'hh24'),'',1,0)) "h17",
SUM(decode(to_char(first_time, 'hh24'),'',1,0)) "h18",
SUM(decode(to_char(first_time, 'hh24'),'',1,0)) "h19",
SUM(decode(to_char(first_time, 'hh24'),'',1,0)) "h20",
SUM(decode(to_char(first_time, 'hh24'),'',1,0)) "h21",
SUM(decode(to_char(first_time, 'hh24'),'',1,0)) "h22",
SUM(decode(to_char(first_time, 'hh24'),'',1,0)) "h23"
from v$log_history
-- where standby_dest = 'NO'
-- and CREATOR IN ('ARCH' , 'FGRD')
group by trunc(first_time), to_char(first_time, 'Dy')
order by trunc(first_time);
--logswitchfreq.sql

()查看相关SQL
set line 200;
set pagesize 20000;
col sql_text for a45;
col elapsed_rank for 999; select *
from (select v.sql_id,
v.sql_text,
v.elapsed_time/1000000 elapsed_time ,
v.cpu_time/1000000 cpu_time,
v.disk_reads,
v.executions,
rank() over(order by v.disk_reads desc) elapsed_rank
from v$sqlarea v) a
where elapsed_rank <= 10; ()增加表空间数据文件
alter undo tablespace undotbs1 add datafile '/home/U01/oracle/oradata/test/UNDOTBS1a.dbf' size 100m reuse autoextend on next 100M;
()改变默认undo表空间
create undo tablespace undotbs2 datafile '/home/U01/oracle/oradata/test/UNDOTBS2.dbf' size 100m reuse autoextend on next 100m;
alter system set undo_tablespace=undotbs2 scope=both;

Oracle IMPDP导入数据案例之注意事项(undo/temp)的更多相关文章

  1. Oracle impdp导入数据临时表空间与undo表空间爆满解决实例

    Oracle impdp导入数据临时表空间与undo表空间爆满解决实例 [日期:2018-01-24] 来源:Linux社区  作者:rangle [字体:大 中 小]   针对Oracle数据迁移, ...

  2. ORACLE impdp 导入数据

    1 table_exists_action参数说明 使用imp进行数据导入时,若表已经存在,要先drop掉表,再进行导入. 而使用impdp完成数据库导入时,若表已经存在,有四种的处理方式: 1)  ...

  3. Oracle逻辑导入数据(IMP/IMPDP)

    使用IMPDP导入数据的前提是数据是使用EMPDP导出的,同样也是在DOS窗口下直接输入IMPDP和登录数据库的用户名,即可导人数据. impdp导到指定用户下: impdp student/1234 ...

  4. Oracle使用——impdp导入数据时数据表已经存在

    背景 在做数据迁移时,需要将不同地方的dmp文件整合到一个数据库中,在导入时,目标表已经存在,该如何把数据追加进入目标表中 方法介绍 当使用IMPDP完成数据库导入时,如遇到表已存在时,Oracle提 ...

  5. oracle impdp导入时 提示“ORA-39002: 操作无效 ORA-39070: 无法打开日志文件 ”

    第一步:首先使用DBA权限的用户创建directory,我使用system ,可以在服务器本地创建,也可以远程连接sqlplus进行创建,使用的将是服务器上面的路径.要确保创建directory时,操 ...

  6. oracle impdp 导入

    用imp语法导入dmp文件: imp mdm/mdm@SYSWARE  file= ‪E:\Product\9y5s\5.MDM\20161024.DMP  full=y 报错 IMP-00002:无 ...

  7. Oracle Sqlload 导入数据

    sqlload导入数据具有快,简单,无需校验等方便,多说无益 1 首先,oracle数据库要有这么个表,用来接收数据.我这里这个uuid是序列生成的,当然也可以sqlload导入时候分配uuid -- ...

  8. Oracle快速导入数据工具

    sqlldr是oracle自带的快速导入批量数据的工具,常用于性能测试.考虑手工构造控制文件较为繁琐,因此使用脚本完成批量数据的自动导入. 基本知识 sqlldr命令语法 sqlldr dbname/ ...

  9. Oracle导出导入数据

    Oracle数据导入导出imp/exp就相当与oracle数据还原与备份, 利用这个功能你可以构建俩个相同的数据库,一个用来测试,一个用来正式使用. 可以在SQLPLUS.EXE或者DOS(命令行)中 ...

随机推荐

  1. 推荐-Everything搜索工具

    简介: windows操作系统下极其强大的文件搜索工具. 下载: https://www.voidtools.com/downloads/ 推荐理由: 速度之快难以想象,日常工作必备工具之一. 发现的 ...

  2. CentOS7 wget 安装Redis,开机启动配置

      安装 GCC yum install gcc yum install tcl 安装wget yum install wget 1. 下载Redis wget http://download.red ...

  3. HTTP 状态代码之汇总+理解

    这里有百度百科的介绍,还挺全的. 下面是在开发过程中遇到过的各种码,自己的问题自己的原因,同码不同错,贱笑贱笑. HTTP 406 Not Acceptable 这个错误的原因,是由于框架使用了`Sp ...

  4. unity Socket TCP连接案例(一)

    非常清晰的demo 服务端 using System; using System.Collections; using System.Collections.Generic; using System ...

  5. C 标准库 - string.h之memchr使用

    memchr Locate character in block of memory,Searches within the first num bytes of the block of memor ...

  6. net 记录controller Action耗时

    可能有些时候需要记录Action的执行时间来优化系统功能,这时可以用过滤器来实现 第1个例子 using System; using System.Diagnostics; using System. ...

  7. sql语句将数字转为汉字展示

    select [表字段Name] , ( case [表字段OrderState] when 1 then '已核销' when 2 then '确认前的移动端取消'when 3 then '已完成' ...

  8. (Forward)5 Public Speaking Tips That'll Prepare You for Any Interview

    Landing a job interview is incredibly exciting –- and often terrifying. But fear not. There are clev ...

  9. SQL执行一次INSERT INTO查询,插入多行记录

    那如果我们想插入多行记录呢?可能你会想到多次运行INSERT语句即可,就像下面的php代码示例: INSERT INTO tbl_name (col1,col2) VALUES (,); 那如果我们想 ...

  10. VirtualBox使用Centos7与主机共享文件夹

    最近使用VitrtualBox安装Centos7学习,liunx脚本和一些命令,经过一些研究完成了虚拟机与 主机共享文件夹,虚拟机链接外部网络,主机与虚拟机互相通信.在其中遇到一些我解决的技术问题记录 ...