Oracle impdp导入数据临时表空间与undo表空间爆满解决实例
Oracle impdp导入数据临时表空间与undo表空间爆满解决实例
[日期:2018-01-24] | 来源:Linux社区 作者:rangle | [字体:大 中 小] |
针对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
(2)数据字典查看
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; (2)查看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; (3)查看归档日志切换情况
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'),'00',1,0)) "h0",
SUM(decode(to_char(first_time, 'hh24'),'01',1,0)) "h1",
SUM(decode(to_char(first_time, 'hh24'),'02',1,0)) "h2",
SUM(decode(to_char(first_time, 'hh24'),'03',1,0)) "h3",
SUM(decode(to_char(first_time, 'hh24'),'04',1,0)) "h4",
SUM(decode(to_char(first_time, 'hh24'),'05',1,0)) "h5",
SUM(decode(to_char(first_time, 'hh24'),'06',1,0)) "h6",
SUM(decode(to_char(first_time, 'hh24'),'07',1,0)) "h7",
SUM(decode(to_char(first_time, 'hh24'),'08',1,0)) "h8",
SUM(decode(to_char(first_time, 'hh24'),'09',1,0)) "h9",
SUM(decode(to_char(first_time, 'hh24'),'10',1,0)) "h10",
SUM(decode(to_char(first_time, 'hh24'),'11',1,0)) "h11",
SUM(decode(to_char(first_time, 'hh24'),'12',1,0)) "h12",
SUM(decode(to_char(first_time, 'hh24'),'13',1,0)) "h13",
SUM(decode(to_char(first_time, 'hh24'),'14',1,0)) "h14",
SUM(decode(to_char(first_time, 'hh24'),'15',1,0)) "h15",
SUM(decode(to_char(first_time, 'hh24'),'16',1,0)) "h16",
SUM(decode(to_char(first_time, 'hh24'),'17',1,0)) "h17",
SUM(decode(to_char(first_time, 'hh24'),'18',1,0)) "h18",
SUM(decode(to_char(first_time, 'hh24'),'19',1,0)) "h19",
SUM(decode(to_char(first_time, 'hh24'),'20',1,0)) "h20",
SUM(decode(to_char(first_time, 'hh24'),'21',1,0)) "h21",
SUM(decode(to_char(first_time, 'hh24'),'22',1,0)) "h22",
SUM(decode(to_char(first_time, 'hh24'),'23',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
(4)查看相关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; (4)增加表空间数据文件
alter undo tablespace undotbs1 add datafile '/home/U01/oracle/oradata/test/UNDOTBS1a.dbf' size 100m reuse autoextend on next 100M;
(5)改变默认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表空间爆满解决实例的更多相关文章
- Oracle IMPDP导入数据案例之注意事项(undo/temp)
针对Oracle数据迁移,我们可能会用到expdp/impdp的方式,有时候需要大表.lob字段等可能会消耗过大的临时表空间和undo表空间,所以一般我们根据导出日志,在导入前适当调整表空间大小.否则 ...
- Oracle 基础 导入数据库 删除用户、删除表空间、删除表空间下所有表
导入数据库 在cmd下用 imp导入 格式: imp userName/passWord file=bmp文件路径 ignore = y (忽略创建错误)full=y(导入文件中全部内容); 例: ...
- ORACLE impdp 导入数据
1 table_exists_action参数说明 使用imp进行数据导入时,若表已经存在,要先drop掉表,再进行导入. 而使用impdp完成数据库导入时,若表已经存在,有四种的处理方式: 1) ...
- oracle表空间查询维护命令大全之二(undo表空间)
--undo表空间汇总 --查看全部的表空间名字 select name from v$tablespace; --创建新的UNDO表空间,并设置自己主动扩展參数; create undo table ...
- [Oracle]理解undo表空间
一.回退段介绍 在Oracle数据库中,当某个事物对数据进行修改时,Oracle首先将数据的原始值保存到一个回退段中.一个事物只能将它的回退信息保存到一个回退段中,而多个并行事物可以使用同一个回退段. ...
- 监控和管理Oracle UNDO表空间的使用
对Oracle数据库UNDO表空间的监控和管理是我们日常最重要的工作之一,UNDO表空间通常都是Oracle自动化管理(通过undo_management初始化参数确定):UNDO表空间是用于存储DM ...
- Oracle undo 表空间管理 (摘DAVID)
Oracle 的Undo有两种方式: 一是使用undo 表空间,二是使用回滚段. 我们通过 undo_management 参数来控制使用哪种方式,如果设为auto,就使用UNDO 表空间,这时必须要 ...
- Oracle 释放过度使用的Undo表空间
故障现象:UNDO表空间越来越大,长此下去最终数据因为磁盘空间不足而崩溃: 问题分析:产生问题的原因主要以下两点: 1. 有较大的事务量让Oracle Undo自动扩展,产生过度占用磁盘空间的情况: ...
- 【Oracle】重做undo表空间
重做undo表空间 场景: alert日志,报了如下错误: [oraprod@arpinfo bdump]$ tail -f alert_PROD.log Errors in file /ora115 ...
随机推荐
- springcloud Config 入门,带视频
疯狂创客圈 Java 高并发[ 亿级流量聊天室实战]实战系列 [博客园总入口 ] 架构师成长+面试必备之 高并发基础书籍 [Netty Zookeeper Redis 高并发实战 ] 前言 Crazy ...
- IT兄弟连 HTML5教程 CSS3属性特效 弹性盒模型
CSS3引入了新的盒模型——弹性盒模型,该模型决定一个盒子在其他盒子中的分布方式以及如何处理可用的空间.使用该模型,可以很轻松的创建自适应浏览器窗口的流动布局或自适应字体大小的弹性布局.弹性盒模型看起 ...
- C++双指针滑动和利用Vector实现无重复字符的最长子串—力扣算法
题目: 力扣原题链接:https://leetcode-cn.com/problems/longest-substring-without-repeating-characters/ 给定一个字符串, ...
- Key Management: Hardcoded Encryption key 密钥管理:硬编码加密密钥
- Java继承之方法重写
目录 Java继承之方法重写 代码体现 概念 注意事项 "两同两小一大" 其他注意点 重写与重载 @Override注解 Java继承之方法重写 在Java继承中,子类可以获得父类 ...
- WPF无边框可拖动窗体
下面主要记录下创建无边框窗体,并且可以拖动.这种窗体主要用于弹出小窗体时. <Window x:Class="WpfApplication1.MainWindow" xmln ...
- springboot 打包jar 运行找资源文件
使用如下方式读取文件:ClassPathResource cpr = new ClassPathResource("static/ok.png");byte[] bdata = F ...
- SpringMVC框架之第二篇
6.参数绑定(重点) Springmvc作为表现层框架,是连接页面和service层的桥梁,它负责所有请求的中转.怎么从请求中接收参数是重点,这也体现了我们刚开始说的Springmvc的第一个作用:“ ...
- js-03-if条件判断
一.swich case判断语句eg <script> swich( exp){ case 值1: 执行的代码段: break; case 值2: 执行的代码段: break; ..... ...
- 打包vue文件,上传到服务器
主要步骤: 1. npm run build生成dist文件夹 2. 将dist文件夹上传到服务器上 3. 服务器上配置nginx,访问路径指向dist文件夹下的index.html,这样当访问ngi ...