• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

解决临时表空间不足

武飞扬头像
刘工James
帮助1

第一种方法:

数据库服务器切换到 oracle的根目录执行: su oracle

[oracle@edzxbsdb ~]$ source .bash_profile

[oracle@edzxbsdb ~]$ sqlplus / as sysdba

进入sql

SQL> show user;

USER is "SYS"

SQL> create user kcasdba identified by 123456;

SQL> grant dba to kcasdba;

Grant succeeded.

二、

plsql登录kcasdba,密码123456,执行sql:

--1.

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

--2.

select * from dba_temp_files d;

三、

扩数据文件:

alter database tempfile ‘/u01/app/oracle/oradata/orcl/temp01.dbf‘ resize 4G;

新加数据文件(这两个其中一个路径):

alter tablespace KCAS_TEMP add tempfile '/data/kcas_temp06.dbf' size 30g autoextend off;

alter tablespace KCAS_TEMP add tempfile '/data/KCAS_TEMP/kcas_temp08.dbf' size 30g autoextend off;

四、重启oracle

1、 以oracle身份登录数据库,命令:su - oracle

2、 进入Sqlplus控制台,命令:sqlplus /nolog

3、 以系统管理员登录,命令:connect / as sysdba

  可以合并为:sqlplus sys/密码 as sysdba

4、 启动数据库,命令:startup

5、 如果是关闭数据库,命令:shutdown immediate(shutdown abort)

6、 退出sqlplus控制台,命令:exit

7、 进入监听器控制台,命令:lsnrctl

8、 停掉监听器 命令:stop

9、 启动监听器 命令:start

10、退出监听器控制台,命令:exit

11、重启数据库结束

12、查看数据库监听的状态 lsnrctl status

五、

解决跑批临时表空间不足,扩完后仍然报临时表空间不足问题:

1.链接数据库服务器

2.root用户下执行

free -m

3.内存写进磁盘,并手动释放内存

sync

echo 3 > /proc/sys/vm/drop_caches

4. 执行

free -m

六、将已经卡住的sql记录下来,将涉及的相关表给分析存储一下

将sql F5分析一下涉及的表然后执行:

analyze table table_name compute statistics;

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /boutique/detail/tanhggceif
系列文章
更多 icon
同类精品
更多 icon
继续加载