Find the tablespace usage: In my case it was 99% full.
set linesize 200
select
df.tablespace_name as "Tablespace",
totalusedspace as "Used MB",
(df.totalspace - tu.totalusedspace) as "Free MB",
df.totalspace as "Total MB",
round(100 * ( (df.totalspace - tu.totalusedspace)/ df.totalspace)) as "Pct. Free",
(100-(round(100 * ( (df.totalspace - tu.totalusedspace)/ df.totalspace)))) as "Pct. Used"
from
(select
tablespace_name,
round(sum(bytes) / 1048576) TotalSpace
from
dba_data_files
group by tablespace_name) df,
(select
round(sum(bytes)/(1024*1024)) totalusedspace,
tablespace_name
from
dba_segments
group
by tablespace_name) tu
where
df.tablespace_name = tu.tablespace_name
and df.tablespace_name='&TABLESPACE_NAME'
order by 6 desc;
Find out the datafile of the tablespace in my case the user was procappuser and its datafile was as below.
7 7 +DATA/praap/datafile/procappuser_data.308.968301311
set linesize 200
select
df.tablespace_name as "Tablespace",
totalusedspace as "Used MB",
(df.totalspace - tu.totalusedspace) as "Free MB",
df.totalspace as "Total MB",
round(100 * ( (df.totalspace - tu.totalusedspace)/ df.totalspace)) as "Pct. Free",
(100-(round(100 * ( (df.totalspace - tu.totalusedspace)/ df.totalspace)))) as "Pct. Used"
from
(select
tablespace_name,
round(sum(bytes) / 1048576) TotalSpace
from
dba_data_files
group by tablespace_name) df,
(select
round(sum(bytes)/(1024*1024)) totalusedspace,
tablespace_name
from
dba_segments
group
by tablespace_name) tu
where
df.tablespace_name = tu.tablespace_name
and df.tablespace_name='&TABLESPACE_NAME'
order by 6 desc;
Tablespace Used MB Free MB Total MB Pct. Free Pct. Used
------------------------------ ---------- ---------- ---------- ---------- ----------
PROCAPPUSER_DATA 4689968 230352 4920320 1 99
set linesize 200
set pagesize 200
col name format a60
select TS#, File#, name from v$datafile order by 1;
set linesize 84
set pagesize 30
7 7 +DATA/praap/datafile/procappuser_data.308.968301311
Now resize the datafile.
For resize: This is how you increase tablespace actually increasing datafile size.
alter database datafile '+DATA/praap/datafile/procappuser_data.308.968301311' resize 4805G
To increase the maxsize:
alter database datafile '+DATA/praap/datafile/procappuser_data.308.968301311' autoextend on maxsize 33605g
No comments:
Post a Comment