Freespace in Tablespaces
Dear all,
We are getting red alert message on Database administration in EWA report ,
Kindly check below logs :
We checked your system for tablespaces that may overflow in the near future.
10.2.1 Tablespaces - Autoextend Limit
Tablespace Size (KB) Free (KB) Avg. Chg/Week (KB) %-Used AutoExt %-Used after AutoExt
PSAPSR3 200028160 316992 5557700 99 204.800.000 98
PSAPSR3700 72826880 3591936 8429 95 174.080.000 40
SYSAUX 430080 31616 12596 92 10.240.000 4
You have set the 'autoextend' option for some tablespaces to a limited value. More than 95% of the limited size is already used.
Recommendation: Increase the values for the limits as soon as possible, or use SAPDBA to add new data files to the tablespaces of the table above.
Implementation: To determine the size required, consider the tablespaces' history of storage usage. Once you have added a data file, back up the extended tablespace. This ensures that the new state of the database can be recovered.
Kindly advise to resovle the above issues ..
Dear Shroff,
Pls check the show table space details through BRtools
BR1001I BRSPACE 7.00 (49)
BR1002I Start of BRSPACE processing: seerdask.dbw 2010-11-29 11.30.06
BR0101I Parameters
Name Value
oracle_sid IRP
oracle_home /oracle/IRP/102_64
oracle_profile /oracle/IRP/102_64/dbs/initIRP.ora
sapdata_home /oracle/IRP
sap_profile /oracle/IRP/102_64/dbs/initIRP.sap
space_function dbshow
space_copy_dir /oracle/IRP/sapreorg
scroll_lines 20
system_info orairp/orairp PRODORADB AIX 3 5 00018B6AD400
oracle_info IRP 10.2.0.4.0 8192 51738 758307642 PRODORADB
sap_info 700 SAPSR3 0002LK0003IRP0011D11604089540015Mainte
nance_ORA
make_info rs6000_64 OCI_102 Aug 2 2010
command_line /usr/sap/IRP/SYS/exe/run/brspace -p initIRP.sap -
s 20 -l E -U -f dbshow -c tsinfo
BR0280I BRSPACE time stamp: 2010-11-29 11.30.11
BR1009I Name of database instance: IRP
BR1010I BRSPACE action ID: seerdask
BR1011I BRSPACE function ID: dbw
BR1012I BRSPACE function: dbshow
BR1036I Class of information to be shown: tsinfo
BR0280I BRSPACE time stamp: 2010-11-29 11.30.14
BR0659I List menu 259 + you can select one or more entries
List of database tablespaces
Pos. Tablespace Type Status ExtMan. SegMan. Backup Files/AuExt.
Total[KB] Used[%] Free[KB] MaxSize[KB] ExtSize[KB] FreeExt. Lar
gest[KB]
1 - PSAPSR3 DATA ONLINE LOCAL AUTO NO 20/20
200192000 99.84 327168 204800000 4608000 21 79
8720:655360:614400:593920:593920+
2 - PSAPSR3700 DATA ONLINE LOCAL AUTO NO 17/17
72826880 95.07 3591936 174080000 101253120 17 612
3520:6123520:6103040:6082560:6082560+
3 - PSAPSR3USR DATA ONLINE LOCAL AUTO NO 1/1
20480 90.00 2048 10240000 10219520 1 1021
9520+:2048:0:0:0
4 - PSAPTEMP TEMP ONLINE LOCAL MANUAL NO 1/1
4362240 0.00 4362240 10240000 5877760 0 587
7760+:0:0:0:0
5 - PSAPUNDO UNDO ONLINE LOCAL MANUAL NO 1/1
10240000 0.16 10223552 10240000 0 585 280
1664:1372160:1024128:851968:474112
6 - SYSAUX DATA ONLINE LOCAL AUTO NO 1/1
430080 94.23 24832 10240000 9809920 22 980
9920+:17344:1728:704:576
7 - SYSTEM DATA ONLINE LOCAL MANUAL NO 1/1
901120 99.38 5568 10240000 9338880 3 933
8880+:5056:448:64:0
Standard keys: c - cont, b - back, s - stop, r - refr, h - help
BR0662I Enter your selection:
Kindly advise for resolving the above issue .
Similar Messages
-
Hi brother,
i would like to check the sinagle tablespace on Oracle 10g DB, where can I found the script?
ThanksI've used script from asktom, that's great....
set linesize 130
set pages 1000
-- Thank AskTom
-- This SQL Plus script lists freespace by tablespace
column dummy noprint
column pct_used format 999.9 heading "%|Used"
column name format a19 heading "Tablespace Name"
column Kbytes format 999,999,999 heading "KBytes"
column used format 999,999,999 heading "Used"
column free format 999,999,999 heading "Free"
column largest format 999,999,999 heading "Largest"
column max_size format 999,999,999 heading "MaxPoss|Kbytes"
column pct_max_used format 999.9 heading "%|Max|Used"
break on report
compute sum of kbytes on report
compute sum of free on report
compute sum of used on report
select (select decode(extent_management,'LOCAL','*',' ') ||
decode(segment_space_management,'AUTO','a ','m ')
from dba_tablespaces where tablespace_name = b.tablespace_name) ||
nvl(b.tablespace_name,
nvl(a.tablespace_name,'UNKOWN')) name,
kbytes_alloc kbytes,
kbytes_alloc-nvl(kbytes_free,0) used,
nvl(kbytes_free,0) free,
((kbytes_alloc-nvl(kbytes_free,0))/
kbytes_alloc)*100 pct_used,
nvl(largest,0) largest,
nvl(kbytes_max,kbytes_alloc) Max_Size,
decode( kbytes_max, 0, 0, (kbytes_alloc/kbytes_max)*100) pct_max_used
from ( select sum(bytes)/1024 Kbytes_free,
max(bytes)/1024 largest,
tablespace_name
from sys.dba_free_space
group by tablespace_name ) a,
( select sum(bytes)/1024 Kbytes_alloc,
sum(maxbytes)/1024 Kbytes_max,
tablespace_name
from sys.dba_data_files
group by tablespace_name
union all
select sum(bytes)/1024 Kbytes_alloc,
sum(maxbytes)/1024 Kbytes_max,
sum(maxbytes)/1024 Kbytes_max,
tablespace_name
from sys.dba_temp_files
group by tablespace_name )b
where a.tablespace_name ( + ) = b.tablespace_name;
Enjoy! -
Flawed script for finding free tablespace space
Currently i am using the below mentioned script to see the freespace in tablespace. But the Freespace shown in this report is mistakenly shown smaller than the actual freespace in the datafiles.
For example i ran the below mentioned script and found that the tablespace CUSTDATA has only 4634 MB free. So i added another datafile with 2GB space using the following syntax.
ALTER TABLESPACE CUSTDATA
ADD DATAFILE '/u04/oradata/ora145/ora145_CUSTDATA20.dbf' SIZE 500M AUTOEXTEND ON NEXT 20M MAXSIZE 2000M;
After the addition of this datafile, the freespace should be 6634 MB. But my script's resut is showing only 5134.75 MB.
Why is this happening?
My tablespace free space report script
select ddf.tablespace_name,total ttlSize,
(total-nvl(freespace,0))/1024 used, freespace
from (select tablespace_name,sum(bytes/1024/1024)
total from dba_data_files group by tablespace_name) ddf,
(select tablespace_name,sum(bytes/1024/1024)
freespace from dba_free_space group by tablespace_name) dfs where ddf.tablespace_name=dfs.tablespace_name(+); Message was edited by:
for_good_reasonThe MAXSIZE (2000M) is the actual size of the
datafile and not SIZE 500M . Right?No, at least when you create the datafile. Actual size is identified by BYTES column, which you use in your query. Example :
SYS@db102 > select file_name,bytes, maxbytes
2 from dba_data_files
3 where tablespace_name = 'USERS';
FILE_NAME BYTES MAXBYTES
/home/oracle/base/oradata/db102/users01.dbf 104857600 34359721984
SYS@db102 > select tablespace_name,sum(bytes) from dba_free_space
2 where tablespace_name = 'USERS'
3 group by tablespace_name;
TABLESPACE_NAME SUM(BYTES)
USERS 61341696
SYS@db102 > alter tablespace users add datafile
2 '/home/oracle/base/oradata/db102/users02.dbf'
3 size 100M autoextend on next 10M maxsize 500M;
Tablespace altered.
SYS@db102 > select file_name,bytes, maxbytes
2 from dba_data_files
3 where tablespace_name = 'USERS';
FILE_NAME BYTES MAXBYTES
/home/oracle/base/oradata/db102/users01.dbf 104857600 34359721984
/home/oracle/base/oradata/db102/users02.dbf 104857600 524288000
SYS@db102 > select tablespace_name,sum(bytes) from dba_free_space
2 where tablespace_name = 'USERS'
3 group by tablespace_name;
TABLESPACE_NAME SUM(BYTES)
USERS 166133760
SYS@db102 > -
Best Way to monitor standby, primary databases, including alert logs, etc.
Hi, Guys, I finally cutover the new environment to the new linux redhat and everything working great so far (the primary/standby).
Now I would like to setup monitoring scripts to monitor it automatically so I can let it run by itself.
What is the best way?
I talked to another dba friend outside of the company and he told me his shop not use any cron jobs to monitor, they use grid control.
We have no grid control. I would like to see what is the best option here? should we setup grid control?
And also for the meantime, I would appreciate any good ideas of any cronjob scripts.
ThanksHello;
I came up with this which I run on the Primary daily, Since its SQL you can add any extras you need.
SPOOL OFF
CLEAR SCREEN
SPOOL /tmp/quickaudit.lst
PROMPT
PROMPT -----------------------------------------------------------------------|
PROMPT
SET TERMOUT ON
SET VERIFY OFF
SET FEEDBACK ON
PROMPT
PROMPT Checking database name and archive mode
PROMPT
column NAME format A9
column LOG_MODE format A12
SELECT NAME,CREATED, LOG_MODE FROM V$DATABASE;
PROMPT
PROMPT -----------------------------------------------------------------------|
PROMPT
PROMPT
PROMPT Checking Tablespace name and status
PROMPT
column TABLESPACE_NAME format a30
column STATUS format a10
set pagesize 400
SELECT TABLESPACE_NAME, STATUS FROM DBA_TABLESPACES;
PROMPT
PROMPT ------------------------------------------------------------------------|
PROMPT
PROMPT
PROMPT Checking free space in tablespaces
PROMPT
column tablespace_name format a30
SELECT tablespace_name ,sum(bytes)/1024/1024 "MB Free" FROM dba_free_space WHERE
tablespace_name <>'TEMP' GROUP BY tablespace_name;
PROMPT
PROMPT ------------------------------------------------------------------------|
PROMPT
PROMPT
PROMPT Checking freespace by tablespace
PROMPT
column dummy noprint
column pct_used format 999.9 heading "%|Used"
column name format a16 heading "Tablespace Name"
column bytes format 9,999,999,999,999 heading "Total Bytes"
column used format 99,999,999,999 heading "Used"
column free format 999,999,999,999 heading "Free"
break on report
compute sum of bytes on report
compute sum of free on report
compute sum of used on report
set linesize 132
set termout off
select a.tablespace_name name,
b.tablespace_name dummy,
sum(b.bytes)/count( distinct a.file_id||'.'||a.block_id ) bytes,
sum(b.bytes)/count( distinct a.file_id||'.'||a.block_id ) -
sum(a.bytes)/count( distinct b.file_id ) used,
sum(a.bytes)/count( distinct b.file_id ) free,
100 * ( (sum(b.bytes)/count( distinct a.file_id||'.'||a.block_id )) -
(sum(a.bytes)/count( distinct b.file_id ) )) /
(sum(b.bytes)/count( distinct a.file_id||'.'||a.block_id )) pct_used
from sys.dba_free_space a, sys.dba_data_files b
where a.tablespace_name = b.tablespace_name
group by a.tablespace_name, b.tablespace_name;
PROMPT
PROMPT ------------------------------------------------------------------------|
PROMPT
PROMPT
PROMPT Checking Size and usage in GB of Flash Recovery Area
PROMPT
SELECT
ROUND((A.SPACE_LIMIT / 1024 / 1024 / 1024), 2) AS FLASH_IN_GB,
ROUND((A.SPACE_USED / 1024 / 1024 / 1024), 2) AS FLASH_USED_IN_GB,
ROUND((A.SPACE_RECLAIMABLE / 1024 / 1024 / 1024), 2) AS FLASH_RECLAIMABLE_GB,
SUM(B.PERCENT_SPACE_USED) AS PERCENT_OF_SPACE_USED
FROM
V$RECOVERY_FILE_DEST A,
V$FLASH_RECOVERY_AREA_USAGE B
GROUP BY
SPACE_LIMIT,
SPACE_USED ,
SPACE_RECLAIMABLE ;
PROMPT
PROMPT ------------------------------------------------------------------------|
PROMPT
PROMPT
PROMPT Checking free space In Flash Recovery Area
PROMPT
column FILE_TYPE format a20
select * from v$flash_recovery_area_usage;
PROMPT
PROMPT ------------------------------------------------------------------------|
PROMPT
PROMPT
PROMPT ------------------------------------------------------------------------|
PROMPT
PROMPT
PROMPT Checking last sequence in v$archived_log
PROMPT
clear screen
set linesize 100
column STANDBY format a20
column applied format a10
--select max(sequence#), applied from v$archived_log where applied = 'YES' group by applied;
SELECT name as STANDBY, SEQUENCE#, applied, completion_time from v$archived_log WHERE DEST_ID = 2 AND NEXT_TIME > SYSDATE -1;
prompt
prompt----------------Last log on Primary--------------------------------------|
prompt
select max(sequence#) from v$archived_log where NEXT_TIME > sysdate -1;
PROMPT
PROMPT ------------------------------------------------------------------------|
PROMPT
PROMPT
PROMPT Checking switchover status
PROMPT
select switchover_status from v$database;I run it from a shell script and email myself quickaudit.lst
Alert logs are great source of information when you have an issue or just want to check something.
Best Regards
mseberg -
Question - changing the NEXT extend size manually
Hi Guys,
I would like to get clarification on the subjected topic. During DB reorg, we have an option to change the next extend size manulay. If I want to change the next extend size , which is the best practise to follow on deciding the next extend size? Is there any method to calculate the best next extend size?
Also, I would like to know , after a DB reorg - how continuous freespace in a tablespace changes...(i.e) DB02 --> Freespace statistics --> Tablespace --> freespace analysis
Does the continuous freespace has any direct relation with the next extend size that we choos during the DB reorg?
Please also share the link if there is any literature on this topic.
Best regards,
Vinodh.Hi Vinod,
With New Versions of Oracle like 9i onwards DB reorg can be online and has featute of LMTS ( Locally managed Tablespaces) which eliminates the earlier limitaion of MAXEXTENTS and NEXT_EXTENT parameters.
However if you are operating on earlier oracle version then you need to decide on the value of NEXT_EXTENT depending on the MAXEXTENTS value. If MAXEXTENTS limit is reaching rapidly then you can set NEXT_EXTENT to higher value but with disadvantage of incompletely filled blocks and hence wasteage of space.
Freespace released doesnot hv any direct relation with next extent size. Freelists parameter will decide whether particular block is available or not.
Hope this is helpful
Regards
Umesh -
Reg alter table move statement
Hi friends,
I am having a table with 10GB. i moved the table to the same tablespace using "alter table move" statement.
previously my tablespace had 6 GB freespace. To move the table i resized datafile to increase freespace in tablespace.
after moving, my table size reduced to 8GB. now i want to reduce the datafile size to 6GB again. but its throwing error
ORA-03297: file contains used data beyond requested RESIZE value
Can't i reduce the datafile size to 6GB again?
thanks in advanceresize will not released space below the high water mark.
The simpliest way how to proceed in this case is to move all tables to the new tablespace and drop the original including datafiles. And rename new tablespace back to the old ones name if You want.
You can read some more discussions here:
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:766625833673 -
Hello,
Cold anyone please provide me with a step by step procedure for client copy within Netweaver 2004s?
Furthermore I need guidance concerning the rest of the basic setup as well. The actual Netweaver/BI-system is installed. Now the client needs to be created and furthermore settings for RFC etc. needs to be done.
Does anyone have a good description for this?
Thanks,
F C
nullhi FC,
try to set the active client ?
se16, table RSADMIN, field BWMANDT = 1 e.g
following is bit old oss note, valid for bw 3.x, not sure for nw2004s
Copying productive client 000 in the BW System
SAP Note Number: 116432
Symptom
BW is being productively operated in client 000 and is to be moved into
another client.
Additional key words
Cause and prerequisites
Solution
The copy of the productive client 000 is executed in several steps:
a) Locking the system
During the copy procedure, production in client 000 must not be
active.
Restart the BW System and lock it so that no logon can take place,
the same way as for an upgrade.
b) Maintenance of table T000
- Note the entry of 'logical System' for client 000.
- Delete the entry 'logical System' for the client 000. When
saving, the warning which results from this can be ignored.
- Now create the new BW production client.
Enter the exact contents that you previously deleted from client
000 in the 'logical System' field.
Save the entry.
c) Check of tablespace PSAPCLUD (depending on database)
Please check the number of records of table EDI40 using transaction
SE16.
Afterwards determine the freespace in tablespace PSAPCLUD using
transaction DB02.
Increase tablespace PSAPCLUD so that table EDI40 may be copied.
d) Client copy
- Log on to the target client as user SAP*
- Go to the client copy via either transaction SCCL or via
Tools -> Administration -> Administration ->
Client Administration -> Client copy -> Local copy
Use the profile "SAP_ALL".
Make sure that all entries are active in the profile in the area
'Data selection' und 'Copy mode'.
(only then are number range counters copied)
- Choose in each case client 000 as 'source client' and as 'source
client for user master record'.
- Now start the copy procedure in the background.
After completion of the copy procedure:
e) Set the production client
Enter the chosen production client in the instance profile or
DEFAULT.PFL as logon client. Maintain the parameter
login/system_client
for this.
Once production has been initiated, the client may not be altered
any further.
In all OLTP systems:
f) Maintain the RFC connection in the OLTP systems
Logon to all connected OLTP systems and maintain the RFC connection
to the BW system.
For this purpose choose transaction SM59; expand the section
'R/3 connections'. Below you'll find a destination named
<SID>CLNT<client>
where <SID> is the name of the BW system and <client> is your
old production client in the BW system.
Choose 'Change' for maintenance.
Replace 'Client' by the new production client; save the entry.
Check the connection using 'Test connection' and 'Remote login'.
In BW system only:
g) Unlock and restart your system. -
Auto-Generate mail for database performace reporting.
Hello,
i have many server to keep an eye on for maintenance but, now the number for it is growing day by day. Its difficult for me to keep a watch on each in detail. So I have an idea to implement.
I want to make a script which will auto generate a mail from the server & send it to my email id with all the details of database. Basically performance related details.+
Is it possible to do so ???? I know how to send a mail with attachment, the code i will use is given below.+
please suggest me how can i attach my performance tuning queries output & get those things in my mail on a daily basis......
thanks in advance .....
DECLARE
v_From VARCHAR2(80) := '[email protected]';
v_Recipient VARCHAR2(80) := '[email protected]';
v_Subject VARCHAR2(80) := 'test subject';
v_Mail_Host VARCHAR2(30) := 'mail.mycompany.com';
v_Mail_Conn utl_smtp.Connection;
crlf VARCHAR2(2) := chr(13)||chr(10);
BEGIN
v_Mail_Conn := utl_smtp.Open_Connection(v_Mail_Host, 25);
utl_smtp.Helo(v_Mail_Conn, v_Mail_Host);
utl_smtp.Mail(v_Mail_Conn, v_From);
utl_smtp.Rcpt(v_Mail_Conn, v_Recipient);
utl_smtp.Data(v_Mail_Conn,
'Date: ' || to_char(sysdate, 'Dy, DD Mon YYYY hh24:mi:ss') || crlf ||
'From: ' || v_From || crlf ||
'Subject: '|| v_Subject || crlf ||
'To: ' || v_Recipient || crlf ||
'MIME-Version: 1.0'|| crlf || -- Use MIME mail standard
'Content-Type: multipart/mixed;'|| crlf ||
' boundary="-----SECBOUND"'|| crlf ||
crlf ||
'-------SECBOUND'|| crlf ||
'Content-Type: text/plain;'|| crlf ||
'Content-Transfer_Encoding: 7bit'|| crlf ||
crlf ||
'some message text'|| crlf || -- Message body
'more message text'|| crlf ||
crlf ||
'-------SECBOUND'|| crlf ||
'Content-Type: text/plain;'|| crlf ||
' name="excel.csv"'|| crlf ||
'Content-Transfer_Encoding: 8bit'|| crlf ||
'Content-Disposition: attachment;'|| crlf ||
' filename="excel.csv"'|| crlf ||
crlf ||
'CSV,file,attachement'|| crlf || -- Content of attachment
crlf ||
'-------SECBOUND--' -- End MIME mail
utl_smtp.Quit(v_mail_conn);
EXCEPTION
WHEN utl_smtp.Transient_Error OR utl_smtp.Permanent_Error then
raise_application_error(-20000, 'Unable to send mail: '||sqlerrm);
END;
/I like your script idea.
You can spool output to a file and mail the file to yourself.
What OS are you running?
On linux a simple starter script would look like this:
#!/bin/bash
echo `date`
# Set the Environmental variable for TESTDB instance
. /u01/app/oracle/dba_tool/env/TESTDB.env
$ORACLE_HOME/bin/sqlplus -s system/<PASSWORD> <<EOF
@/u01/app/oracle/dba_tool/TESTDB/quickaudit
EOF
echo `date`
mailx -s "Check database on TESTDB" [email protected] < /tmp/quickaudit.lst
----------------------sample ENV file--------------------------------------
ORACLE_BASE=/u01/app/oracle
ULIMIT=unlimited
ORACLE_SID=TESTDB
export ORACLE_TERM=xterm
ORACLE_HOME=$ORACLE_BASE/product/11.2.0
ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
LIBPATH=$LD_LIBRARY_PATH:/usr/lib
TNS_ADMIN=$ORACLE_HOME/network/admin
PATH=$ORACLE_HOME/bin:$ORACLE_BASE/dba_tool/bin:/bin:/usr/bin:/usr/ccs/bin:/etc:/usr/sbin:/usr/ucb:$HOME/bin:/usr/bin/X11:/sbin:/usr/lbin:/GNU/bin/make:/u01/app/oracle/dba_tool/bin:/home/oracle/utils/SCRIPTS:/usr/local/bin:
export ORACLE_BASE ORACLE_SID ORACLE_TERM ULIMIT
export ORACLE_HOME
export LIBPATH LD_LIBRARY_PATH ORA_NLS33
export TNS_ADMIN
export PATH
--------------------Starter reporting script--------------------------------------------------
SET ECHO OFF
SET TERMOUT OFF
REM Revisions:
REM Date ID Version Description
REM -------- -- ------- ----------------------------------------------------|
REM 10/07/05 1.0 Script to check for database issues
SPOOL /tmp/quickaudit.lst
SELECT SYSDATE FROM DUAL;
SHOW USER
SET TERMOUT ON
SET VERIFY OFF
SET FEEDBACK ON
PROMPT
PROMPT Checking database name and archive mode
PROMPT
column NAME format A9
column LOG_MODE format A12
SELECT NAME,CREATED, LOG_MODE FROM V$DATABASE;
PROMPT
PROMPT ------------------------------------------------------------------------|
PROMPT
PROMPT
PROMPT Checking database versions
PROMPT
column BANNER format A64
select * from v$version;
PROMPT
PROMPT ------------------------------------------------------------------------|
PROMPT
PROMPT
PROMPT Checking control file(s)
PROMPT
column STATUS format a7
column NAME format a68
column IS_RECOVERY_DEST_FILE format a3
set linesize 110
SELECT * FROM V$CONTROLFILE;
PROMPT
PROMPT ------------------------------------------------------------------------|
PROMPT
PROMPT
PROMPT Checking redo logs and group(s)
PROMPT
column member format a70
set linesize 110
set pagesize 30
SELECT group#, member FROM v$logfile;
PROMPT
PROMPT -----------------------------------------------------------------------|
PROMPT
PROMPT
PROMPT ------------------------------------------------------------------------|
PROMPT
PROMPT
PROMPT Checking freespace by tablespace
PROMPT
column dummy noprint
column pct_used format 999.9 heading "%|Used"
column name format a16 heading "Tablespace Name"
column bytes format 9,999,999,999,999 heading "Total Bytes"
column used format 99,999,999,999 heading "Used"
column free format 999,999,999,999 heading "Free"
break on report
compute sum of bytes on report
compute sum of free on report
compute sum of used on report
set termout off
set pagesize 40
select a.tablespace_name name,
b.tablespace_name dummy,
sum(b.bytes)/count( distinct a.file_id||'.'||a.block_id ) bytes,
sum(b.bytes)/count( distinct a.file_id||'.'||a.block_id ) -
sum(a.bytes)/count( distinct b.file_id ) used,
sum(a.bytes)/count( distinct b.file_id ) free,
100 * ( (sum(b.bytes)/count( distinct a.file_id||'.'||a.block_id )) -
(sum(a.bytes)/count( distinct b.file_id ) )) /
(sum(b.bytes)/count( distinct a.file_id||'.'||a.block_id )) pct_used
from sys.dba_free_space a, sys.dba_data_files b
where a.tablespace_name = b.tablespace_name
group by a.tablespace_name, b.tablespace_name;
PROMPT
PROMPT ------------------------------------------------------------------------|
PROMPT
PROMPT
PROMPT Checking for invalid objects
PROMPT -
I get the error of "ORA-1652: unable to extend temp segment by 64 in tablespace TEMP" sometimes though it's over 4GB.
So I need the SQL statements to get:
1. Temporary tablespace usage percent?
2. what size does each active user use in Temporary tablespace?
Your help would be greatly appreciated.
db version:9iHere is the free.sql script:
-- free.sql
-- This SQL Plus script lists freespace by tablespace
column dummy noprint
column pct_used format 999.9 heading "%|Used"
column name format a16 heading "Tablespace Name"
column Kbytes format 999,999,999 heading "KBytes"
column used format 999,999,999 heading "Used"
column free format 999,999,999 heading "Free"
column largest format 999,999,999 heading "Largest"
break on report
compute sum of kbytes on report
compute sum of free on report
compute sum of used on report
select nvl(b.tablespace_name,
nvl(a.tablespace_name,'UNKOWN')) name,
kbytes_alloc kbytes,
kbytes_alloc-nvl(kbytes_free,0) used,
nvl(kbytes_free,0) free,
((kbytes_alloc-nvl(kbytes_free,0))/
kbytes_alloc)*100 pct_used,
nvl(largest,0) largest
from ( select sum(bytes)/1024 Kbytes_free,
max(bytes)/1024 largest,
tablespace_name
from sys.dba_free_space
group by tablespace_name ) a,
( select sum(bytes)/1024 Kbytes_alloc,
tablespace_name
from sys.dba_data_files
group by tablespace_name )b
where a.tablespace_name (+) = b.tablespace_name
order by &1
script by Mr TOMKYTE
check this out to see the usage -
Hi All,
11.2.0.1
I got this script that produces "database freespace" report. I found this at google and it is very cool as it helps me identify when tablespace is running out of space or in "critical" condition.
Obvoiusly this is for 9i since it does not include TEMP. My problem is it does not include the TEMP tablespace if is currently running out of space on its current TS allocation. How do I include TEMP in this script?
Thanks,
pK
==========================
set pages 0
set lines 120
set feedback off
set term off
set echo off
set verify off
col total for 999999999999999
col used for 999999999999999
col free for 999999999999999
spool freespc.lst
select sysdate,tbs.tablespace_name,
tot.bytes total,
tot.bytes-sum(nvl(fre.bytes,0)) used,
sum(nvl(fre.bytes,0)) free,
round((1-sum(nvl(fre.bytes,0))/tot.bytes)*100,2) pct,
decode(
greatest((1-sum(nvl(fre.bytes,0))/tot.bytes)*100, 90),
90, '', '*'
) pct_warn
from dba_free_space fre,
(select tablespace_name, sum(bytes) bytes
from dba_data_files
group by tablespace_name) tot,
dba_tablespaces tbs
where tot.tablespace_name = tbs.tablespace_name
and fre.tablespace_name(+) = tbs.tablespace_name
group by tbs.tablespace_name, tot.bytes, tot.bytes
order by 6, 2 ;
spool off
==================
OUTPUT
=======
TABLESPACE
TOTAL BYTES
USED
FREE
% USED
CRITICAL
INDX
26,214,400
1,048,576
25,165,824
4
XDB
20,971,520
1,048,576
19,922,944
5
UNDOTBS1
393,216,000
42,205,184
351,010,816
10.73
TOOLS
10,485,760
1,245,184
9,240,576
11.88
DRSYS
20,971,520
2,752,512
18,219,008
13.13
ODM
20,971,520
7,340,032
13,631,488
35
SYSAUX
1,080,033,280
923,598,848
156,434,432
85.52
EXAMPLE
151,388,160
143,851,520
7,536,640
95.02
USERS
83,886,080
79,757,312
4,128,768
95.08
SYSTEM
849,346,560
842,006,528
7,340,032
99.14TABLESPACE_NAME
size MB
free MB
% used
UNDOTBS1
375
361
3
INDX
25
24
4
XDB
20
19
5
TOOLS
10
9
11
DRSYS
20
18
13
ODM
20
13
35
SYSAUX
1030
147
85
USERS
80
4
95
EXAMPLE
145
8
95
SYSTEM
810
7
99
TEMP **TEMP**
63
0
100
Well, I don't see any problem there. Your temporary tablespace simply isn't required. This could be possible if you have enough memory to carry out the sort operation. -
Query to check tablespace size and freespace
hi experts
i am using oracle 9i .
want ot check freespace and size of tablespace could u plz tell me the query
thanks
varunadd following for temp files -
select sum(bytes)/1024 kbytes_alloc, tablespace_name
from sys.dba_temp_files
group by tablespace_name
the new query will be
select b.tablespace_name, tbs_size SizeMb, a.free_space FreeMb
from
(select tablespace_name, round(sum(bytes)/1024/1024 ,2) as free_space
from dba_free_space group by tablespace_name) a,
(select tablespace_name, sum(bytes)/1024/1024 as tbs_size
from dba_data_files group by tablespace_name
UNION
select tablespace_name, sum(bytes)/1024/1024 tbs_size
from dba_temp_files
group by tablespace_name ) b
where a.tablespace_name(+)=b.tablespace_name;
cheers -
Caclulate freespace from temporary tablespace
i want to manage temporary tablespace.
i want information like
total_space,
space_used,
free_space from temporary tablespaceRUN THIS
select substr(a.tablespace_name,1,20) "TS_name", substr(a.file_name,1,35) "File_Name",
round(sum(a.bytes)/1024/1024,2) "Size_MB",sum(NVL(b.bytes,0)) "FreeSpace" from dba_TEMP_files a,
(select substr(tablespace_name,1,20) tablespace_name,file_id, round(sum(bytes_used)/1024/1024,2) used_sp,
round(sum(blocks_free * 8192)/1024/1024,2) bytes from v$temp_space_header group by substr(tablespace_name,1,20),file_id ) b where
a.tablespace_name=b.tablespace_name(+) and a.file_id=b.file_id(+) group by
substr(a.tablespace_name,1,20), substr(a.file_name,1,35);
thanks and regards
kuljeet pal singh -
Temporary tablespace - used and freespace size and percentage
Hi,
anyone here have a gd script to query the above?
need to correctly calculate.
thanksYou should be more concerned of what's being used in temporary tablespace. As Oracle will reuse temp segment, free space in temp tablespace is not a good indicator.
select * from v$sort_usage; -
How to release space of SYSAUX tablespace
Hi,
I am now using htmldb 2.0 and created tens of tables in one schema. Several tables are stored in tablespace SYSAUX. Since now I am trying to store a big file to the table(1GB), I found the tablespace grows pretty fast and I have to extend the size. The odd thing is when I delete that file from my table, SYSAUX tablespace seems not release any room and when I insert the big file again into the table, SYSAUX grows again. How can I release the space then? I can't image that why it can't release any room. I also check the occupants of SYSAUX and found one occupant called "other" takes over 90% of space. I tried to move it out of SYSAUX, it doesn't work. What do "other" do actually? I got completely lost. Any help will be greatly appreciated.
LinkeHi,
if you drop a table in Oracle 10g,
you will find teh extents of this table in
DBA_FREE_SPACE.
in DBA_FREE_SPACE???
I don't think so.
SQL >select ddf.tablespace_name,round(total/1024/1024,3) ttlSize,round((total-nvl(freespace,0))/1024/1024,3) used, round((total-nvl(freespace,0))/total*100,2) usedpct
from
(select tablespace_name,sum(bytes) total from dba_data_files group by tablespace_name) ddf,
(select tablespace_name,sum(bytes) freespace from dba_free_space group by tablespace_name) dfs
where ddf.tablespace_name=dfs.tablespace_name(+) and ddf.tablespace_name='USERS';
TABLESPACE_NAME TTLSIZE USED USEDPCT
USERS 16 2.813 17.58
SQL >create table test (col1 number) storage(initial 2m)
2 /
Table created.
SQL >select ddf.tablespace_name,round(total/1024/1024,3) ttlSize,round((total-nvl(freespace,0))/1024/1024,3) used, round((total-nvl(freespace,0))/total*100,2) usedpct
from
(select tablespace_name,sum(bytes) total from dba_data_files group by tablespace_name) ddf,
(select tablespace_name,sum(bytes) freespace from dba_free_space group by tablespace_name) dfs
where ddf.tablespace_name=dfs.tablespace_name(+) and ddf.tablespace_name='USERS';
TABLESPACE_NAME TTLSIZE USED USEDPCT
USERS 16 4.813 30.08<--used 2mb
SQL >select sum(bytes)/1024/1024 from dba_segments where tablespace_name='USERS'
2 /
SUM(BYTES)/1024/1024
6.75
SQL >drop table test
2 /
Table dropped.
SQL >select sum(bytes)/1024/1024 from dba_segments where tablespace_name='USERS'
2 /
SUM(BYTES)/1024/1024
6.75 <-- kept in the same tablespace -
Huge drop in freespace in the database
Hi all,
I experienced a strange problem. Recently I had a new server installed and the database from the old server was migrated in to the new server. After doing so, I added additional datafiles to the tablespaces to increase the free space in the database.
The volume of data transactions per day is more or less same for all days. After 2 years of data transactions, my 4000 MB datafile got depleted to around 500 MB freespace. Then two months back the new datafiles were added to increase the total size of the datafiles to 7000 MB. At this point I had 3500 MB of freespace.
However, when I checked the freespace just after two months of adding additional datafiles, i find that there is only 2000 MB of free space.
No abnormal database activities have been taken up during this period. What could be the reason for such huge drop in freespace..?
regards
thomaskprakashHowever, when I checked the freespace just after two months of adding additional datafiles, i find that there is only 2000 MB of free space.
No abnormal database activities have been taken up during this period. What could be the reason for such huge drop in freespace..?There could me many reasons.
First of all, you have checked your freespace after couple of months, did you calculate how much space it would have used in these two months for data and indexes?
Second, your undo and temp might have increased or you may kept them as auto increase mode.
Jaffar
Maybe you are looking for
-
How to display a Sum field for a formula column?
Hi, I need to display a sum for a formula column at the end of report. for example: my formu_col=col_1-col_2 col_1 col_2 formu_col 3 1 2 6 5 1 total:sum(col_1) sum(col_2) sum(formu_col) now i have sum(col_1) and sum(col_2), but i don't have sum(formu
-
Data written in Operationamanager DB shows 1 Hr old time than current time
Hi All, I have a strange issue on my SCOM 2007 R2 CU4 RMS, Just discovered this accidentally. I Configured an alert for testing and i used a sql query to extract the data for the test alert. In generally the Ops DB and Ops warehouse write data in GMT
-
Disappearring music and videos from my iPad
Every since I purchased and downloaded the entire Beattle catalog several days ago, my iPad iTunes has acted up. Music and videos disappeared from my iPad only to reappear when resyncing. After my last resync i began a businss trip without my MBP
-
How do I get back audiobook Metadata fields that iTunes 12 has removed?
The Audiobooks Get Info window in iTunes 12 appears be lacking fields that previously existed unless you had them filled in. I can't find a way to access the 'missing' fields - either to add them back or fill them in. Example - I previously used Au
-
I accidently installed vidx extensions on my macbook pro. Although I thought I deleted it I still get the adds coming up. How do I get rid of it on my firefox browser?