Operating System - HP-UX
1827807 Members
2943 Online
109969 Solutions
New Discussion

Re: oracle tempspace full

 
SOLVED
Go to solution
Ignacio Rodríguez Arrós
Frequent Advisor

oracle tempspace full

I had a tempspace with a 2 Gb file autoextend, someone made a process that made this file grow till 5 Gb and made the disk full (lvol at 100%). I added another 2 Gb file to the tempspace, but now i want to reduce the original file to 2 Gb again, so the lvol return to have free space. I use the enterprise manager console, but i don´t know if i can do it with people working.
My idea is to put the 5Gb file offline, reduce it and then put it online again, but i am not sure if this could made the BD fail or be damaged
22 REPLIES 22
renarios
Trusted Contributor

Re: oracle tempspace full

Hi ignacio,

For a workaround:
Create a second temporary tablespace (i.e. temp2), write a little script to alter all users temporary tablespace is temp2.
If the users reconnect, their new tablespace will be temp2.
Drop temporary tablespace temp, create it again, alter all users back to temporary tablespace is temp.
Now drop tempspace temp2.
Don't forget removing the O.S. files manualy for db versions <10g.

Cheerio,

Renarios
Nothing is more successfull as failure
Ignacio Rodríguez Arrós
Frequent Advisor

Re: oracle tempspace full

In the enterpries manager there is a tick that say Define as default tempspace, if i create anothe tempspace and mark this tick would it be enaugh.
Instead of that, can´t i put offline the file of 5 Gb and resize it meanwhile, the new 2 Gb file i had created in the same tempspace is online ??
Indira Aramandla
Honored Contributor

Re: oracle tempspace full

Hi Iqnacio,

Temporary tablespace is used by a sort process. As your temporary tablespace is setup as autoextend, and a huge sort process mush had increased the temporary tablespace to grow. Normally when the process is completed the space should be released. But the file size will still remain in the extended size.

When you login to enterprise manager console and look at the storage----tablespaces--- and on the right-hand pane you will see the tablespaces listsing with sizes (used and used percentage). If the used percentage is 0.008 then you can reduce the file size of the temporary tablespace.

This is how you do. Right-click on the tablespace name and ------View/Edit Details----- and this will open the Edit tablespace window and you can see the tablespace size. All you need to do is to reduce to the size you want and specify in KB or MB. Then apply the chnages and Ok.

You can reduce the temporary tablespace size using the commnad as well.

SQL> ALTER DATABASE DATAFILE '/path/name of temporary tablespace.dbf' RESIZE 99 MB;

Note: You can do this if the temporary tablespace used space has been released.

If your database is not 24x 7 and you can shutdown in the evening or at any time for few minutes maintenance, then then best thing will be to shutdown the database. And if the temporary tablespace is not yet released, then SMON will take some time to clean up this space. Once the database is brought back up, then the temporary space is relased, and you can reduce the size either by Enterprice GUI or command line.

Or you can follow Renariosâ s suggestion as well.

Indir
Never give up, Keep Trying
Eric Antunes
Honored Contributor

Re: oracle tempspace full

Hi Ignacio,

Do it with a cron job!

Create a job.sh file (executable for the bd user at least) with:

ORA_ENVFILE="//[/.../].env"

DB_NAME=""

svrmgrl << EOT

connect / as sysdba;

alter database datafile '/.../temp.dbf' resize 2048000K;

quit
EOT

exit_code=$?


Regards,

Eric Antunes
Each and every day is a good day to learn.
renarios
Trusted Contributor

Re: oracle tempspace full

Hi Ignacio,

It is not possible to resize a datafile offline.
You can resize the dafiles of a tablespace, but you can't drop a file of a tablespace.
So, if you resize the datafile (in OEM or sqlplus), there will remain two datafiles. Of you like to keep 2 GB of tempspace, resize both datafiles (tempfiles) to 1 GB each (1+1=2). The other way, if you want to keep just one data(temp)file of 2GB, do it the way I explained above.
Maybe Oracle Metalink is a good place to find more resources. A link for this issue is explaind at this URL:http://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=111316.1

Cheerio,

Renarios
Nothing is more successfull as failure
Ignacio Rodríguez Arrós
Frequent Advisor

Re: oracle tempspace full

Hi Indira, all nigths i shutdown the database, so yesterday nigth i did it, but when i start up the BD again, the file in the tempspace it´s still full, in the enterprise manager i see %used 99,98, althougth i know that it is not true. How can i do to change this (empty the file) and resize to 2
renarios
Trusted Contributor

Re: oracle tempspace full

Hi Ignacio,

In the OEM (Oracle Enterprise Manager) you click to , , storage, Tablespaces, Temp.
Now you see size: 5000 MB. If you change that to 2000 MB (or 2048 MB), the datafile will be altered to 2GB.
Please do it on a quit moment (performance issues)

Cheerio,

Renarios
Nothing is more successfull as failure
Eric Antunes
Honored Contributor

Re: oracle tempspace full

Ignacio,

This is normaly caused by a "bad SQL" Oracle process, you must identify it! OEM helps you to do that: enter in the Oracle TopSessions and the first session should be the one causing this!!

Best Regards,

Eric Antunes
Each and every day is a good day to learn.
Ignacio Rodríguez Arrós
Frequent Advisor

Re: oracle tempspace full

Where is oracle topsessions in oem, mine is in spanish
Eric Antunes
Honored Contributor

Re: oracle tempspace full

Yes (see picture)!
Each and every day is a good day to learn.
Ignacio Rodríguez Arrós
Frequent Advisor

Re: oracle tempspace full

I can´t resize the file because it is full, at 99,98% but it can´t be true because at night i shutdown the bd to do the backup, and after that i startup it, but the file in the tempspace didn,t empty... Haw can i force to empty the file to resize
Yogeeraj_1
Honored Contributor
Solution

Re: oracle tempspace full

hi,

i would suggest that you create a "new" temporary tablespace,

create TEMPORARY TABLESPACE TEMP2 tempfile .....

than change the temporarry tablespace parameter for all users to TEMP2,

spool reset_user.sql
select 'alter user '||username||' temporary tablespace temp2;' from dba_users;
spool off;
@reset_user.sql

Tomorrow morning, it should be OK. You can drop the old temp tablespace.

hope this helps!

regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Eric Antunes
Honored Contributor

Re: oracle tempspace full

Inacio,

This must be due to a very heavy session. Execute the following to see witch is the problematic one:


select s.username "User Name",
s.osuser "OS User",
s.status "Status",
lockwait "Lock Wait",
s.program "Program",
s.machine "Machine",
s.logon_time "Connect Time",
p.program "P Program",
si.physical_reads "Physical Reads",
si.block_gets "Block Gets",
si.consistent_gets "Consistent Gets",
si.block_changes "Block Changes",
si.consistent_changes "Consistent Changes",
s.process "Process",
p.spid, p.pid, s.serial#, si.sid
from sys.v_$sess_io si, sys.v_$session s, sys.v_$process p
where s.username is not null and
si.sid(+)=s.sid
and p.addr(+)=s.paddr
order by status,si.consistent_gets+si.block_gets desc

Best Regards,

Eric Antunes
Each and every day is a good day to learn.
Ignacio Rodríguez Arrós
Frequent Advisor

Re: oracle tempspace full

I know who was the guilty, and she will be "punished", but now i am going to solve the problem making another temp and deleting the old one.
Eric Antunes
Honored Contributor

Re: oracle tempspace full

Hi Ignacio,

Don't "punish" anybody because of me, ok? :)

Cheers,

Eric
Each and every day is a good day to learn.
Ignacio Rodríguez Arrós
Frequent Advisor

Re: oracle tempspace full

Dont worry Eric, it will be a "symbolic punish" ;-)
Ignacio Rodríguez Arrós
Frequent Advisor

Re: oracle tempspace full

Done, everything is allrigth, thanks to all...and sorry for my english..
Volker Borowski
Honored Contributor

Re: oracle tempspace full

No,
not all fine, but two things to check !

Looks like your "old" TEMP-TS was in fact a data-tablespace of type "permanent" (concluded from the fact, that a re-cycle of the DB did not reset the allocated space).
If you followed the procedure described above (which is fine !), you now have changed your "old-style" temp-space to a real temporary tablespace.
So you need to check:

a) Depending on your backup type, you might need to extend your documentation how to recreate the tempfiles if they are not part of your backup, or change your backup to include the tempfiles.
I think RMAN takes care of everything, but if you use filesystem/script based backups something has changed now, which "might" lead to additional steps needed in case of recovery.

b) A tempfile is a sparse file by default. So your freespacemonitoring needs adjustment, or you need to convert the files.
http://www.unixguide.net/unix/sparse_file.shtml

Volker
Ignacio Rodríguez Arrós
Frequent Advisor

Re: oracle tempspace full

Hi Vloker, i make every nigth a full backup of all the system (/), previous to this backup, i shutdown baan and oracle.

About the type of tempspace, do you mean that if i put it like permanent, if it rise, by example, 1Gb it will never be smaller than that (it will not srink automatic), but if i define it like temporary then it will grow and srink automatic.
Volker Borowski
Honored Contributor

Re: oracle tempspace full

Hi,

your backup procedure is fine, if the DB is shut down prior the backup (and of course, if the data containers are not in raw-devices :-) -> OK

No, datafiles and tempfiles do not shrink as needed! But if you allocate a datafile of 1000M, the space will be taken from the filesystem. If you allocate a tempfile, the system will show it as a file of 1000M in size, but it will just allocate some K from the filesystem and grow as needed.
Check the link I provided. It has a good example of spase effects. Search this forum in addition for "sparse", you sure will find interesting stuff.

Volker
Yogeeraj_1
Honored Contributor

Re: oracle tempspace full

hi,

Attached an extract from Thomas Kyte's forthcoming book: "expert one on one Oracle" 2nd edition

this inline with what Volker describes above.

hope this helps too!
regards
Yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Yogeeraj_1
Honored Contributor

Re: oracle tempspace full

attachment
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)