Database Blog

Tablespace Monitoring script

select d.tablespace_name,round((d.max – u.bytes)/1024/1024,2) as max_free_mbytes,round(u.bytes*100/d.max,2) as used_pctfrom sys.SM$TS_USED u,(select tablespace_name,sum(decode(MAXBYTES,0,bytes,maxbytes)) maxfrom sys.dba_data_filesgroup by tablespace_name) dwhere u.tablespace_name = d.tablespace_name andround(u.bytes*100/d.max,2)>70;

Read More

Oracle Tablespace Maintenance scripts excluding Undo and Temp tablespaces

To Find % of free space left in Tablespace select (BYTES/1024)/1024 “Used Space(MB)”, total  “allocated size(MB)”, maxi “maximum allowable (MB)”, maxi-(BYTES/1024)/1024 “effectivefree(MB)”, –maxi-total “free(MB)”, round(((maxi-(BYTES/1024)/1024)/maxi)*100,2) “% FREE” from SM$TS_USED,(select sum((BYTES/1024)/1024)…

Read More

To get the NLS PARAMETER details

set linesize 150set pagesize 1000col name for a50col parameter for a30col value for a30col member for a50col DATAFILE_NAME for a70col TEMPFILE_NAME for a70col CONTROLFILE_NAME for a70col LOGFILE_MEMBER for a70 select…

Read More

To Find Oracle Server bit (32 or 64bit server)

Method 1) sqlplus “/as sysdba”-> Verify the bit in the banner message of SQLPLUS OR “select banner from v$version;” Method 2)  $ cd $ORACLE_HOME/bin            …

Read More

To check the Instance Uptime

select instance_name||’, up since ‘||            to_char(startup_time,’DD-MON-YYYY HH24:MI:SS’) start_time     from gv$instance;

Read More

To Identify Space occupied and original space utilized of a database

set numf 999999.99 select sum(bytes)/(1024*1024*1024) “Total Allocated GB”,Total_Consumed_GB from dba_data_files, (select sum(bytes)/(1024*1024*1024) Total_Consumed_GB from dba_segments) group by Total_Consumed_GB;

Read More

To get the DATABASE SCHEMA SIZE from the database

set linesize 150 set pagesize 5000 col owner for a15 col segment_name for a30 col segment_type for a20 col TABLESPACE_NAME for a30 clear breaks clear computes compute sum of SIZE_IN_GB…

Read More

To get the LOGFILES INFORMATION from the database

col member for a65 select lf.MEMBER,l.GROUP#,THREAD#,SEQUENCE#,MEMBERS,bytes/1024/1024 “BYTES IN MB”,ARCHIVED,l.status from v$log l,v$logfile lf where l.GROUP#=lf.GROUP#

Read More

To get the CONTROLFILES INFORMATION from the database

col name for a90 select * from v$controlfile

Read More

To get the TEMPFILES SIZE from the database

select tablespace_name,file_name,bytes/1024/1024 “SIZE_IN_MB” from dba_temp_files order by file_name asc;

Read More