Database size and after refresh- check below
Database size
col "Database Size" format a20
col "Free space" format a20
col "Used space" format a20
select round(sum(used.bytes) / 1024 / 1024 / 1024 ) || ' GB' "Database Size"
, round(sum(used.bytes) / 1024 / 1024 / 1024 ) -
round(free.p / 1024 / 1024 / 1024) || ' GB' "Used space"
, round(free.p / 1024 / 1024 / 1024) || ' GB' "Free space"
from (select bytes
from v$datafile
union all
select bytes
from v$tempfile
union all
select bytes
from v$log) used
, (select sum(bytes) as p
from dba_free_space) free
group by free.p
/
This script will display a list of Oracle invalid objects:
break on c1 skip 2
set pages 999
col c1 heading 'owner' format a15
col c2 heading 'name' format a40
col c3 heading 'type' format a10
ttitle 'Invalid|Objects'
select
owner c1,
object_type c3,
object_name c2
from
dba_objects
where
status != 'VALID'
order by
owner,
object_type;
SELECT OBJECT_NAME FROM DBA_OBJECTS WHERE STATUS = 'INVALID';
*/
select
decode(object_type, ‘PACKAGE BODY’, ‘PACKAGE’, object_type) ||
‘ ‘ || owner || ‘.’ ||
object_name
as invalid_objects
from ALL_objects
where status = ‘INVALID’ and object_type in
(‘PROCEDURE’,’FUNCTION’,’PACKAGE’,’PACKAGE BODY’,’TRIGGER’,’VIEW’)
ORDER BY 1
/
————
recompile.sql
/*
Script to generate the SQL commands needed to recompile invalid Oracle objects.
By Rodger Lepinsky
*/
select ‘alter ‘ ||
decode(object_type, ‘PACKAGE BODY’, ‘PACKAGE’, object_type) ||
‘ ‘ || owner || ‘.’ ||
object_name || ‘ compile ‘ ||
decode(object_type, ‘PACKAGE BODY’, ‘BODY’,”) ||';’
AS RECOMPILE
from ALL_objects
where status = ‘INVALID’
and object_type in
(‘PROCEDURE’,’FUNCTION’,’PACKAGE’,’PACKAGE BODY’,’TRIGGER’,’VIEW’)
ORDER BY 1
/
Database size
COLUMN "Total Gb" FORMAT 999,999,999.0
COLUMN "Redo Gb" FORMAT 999,999,999.0
COLUMN "Temp Gb" FORMAT 999,999,999.0
COLUMN "Data Gb" FORMAT 999,999,999.0
Prompt
Prompt "Database Size"
select (select sum(bytes/1073741824) from dba_data_files) "Data Gb",
(select NVL(sum(bytes/1073741824),0) from dba_temp_files) "Temp Gb",
(select sum(bytes/1073741824)*max(members) from v$log) "Redo Gb",
(select sum(bytes/1073741824) from dba_data_files) +
(select NVL(sum(bytes/1073741824),0) from dba_temp_files) +
(select sum(bytes/1073741824)*max(members) from v$log) "Total Gb"
from dual;
-- *****************************************************************
drop table SYSTEM.SEM_DASD_GROWTH_temp;
--truncate table SEM_CLONING_DATAFILES;
-- *****************************************************************
set echo off
set heading off
set pagesize 0
set LINESIZE 120
set feedback off
set verify off
-- *****************************************************************
create table SYSTEM.sem_dasd_growth_temp
(TABLESPACE VARCHAR2(44),
FILE_NAME VARCHAR2(64),
CURRENT_SIZE NUMBER(15),
FREE_SPACE NUMBER(15),
LARGEST_FREE NUMBER(15));
INSERT INTO SYSTEM.SEM_DASD_GROWTH_temp
SELECT d.tablespace_name
,d.file_name
,d.current_size
,round(nvl(f.free_space,0),2)
,round(nvl(f.largest_free,0),2)
FROM
(select tablespace_name
, file_id
, sum(f.bytes/(1024*1024)) free_space
, max(f.bytes/(1024*1024)) largest_free
from sys.dba_free_space f
group by tablespace_name, file_id) f
,
(select tablespace_name
, file_id
, file_name
, blocks*(select value from v$parameter
where name = 'db_block_size')/(1024*1024) current_size
, maxblocks*(select value from v$parameter
where name = 'db_block_size')/(1024*1024) maxblocks
, increment_by*(select value from v$parameter
where name = 'db_block_size')/(1024*1024) increment_by
, autoextensible
from sys.dba_data_files
group by tablespace_name, file_id, file_name, blocks, maxblocks,
increment_by, autoextensible) d
WHERE d.FILE_ID = f.FILE_ID(+);
commit;
-- *****************************************************************
/*
drop table SYSTEM.SEM_DASD_GROWTH;
--truncate table SYSTEM.RR_SEM_GROWTH;
--truncate table SEM_CLONING_DATAFILES;
-- *****************************************************************
-- column "Ddname" format a20
-- column "TABLESPACE" format a40
-- *****************************************************************
create table SYSTEM.RR_SEM_GROWTH
(TABLESPACE VARCHAR2(44),
FILE_NAME VARCHAR2(64),
CURRENT_SIZE NUMBER(15),
FREE_SPACE NUMBER(15),
LARGEST_FREE NUMBER(15),
DDNAME VARCHAR2(40),
run_date timestamp(7));
*/
-- *****************************************************************
insert all
into system.RR_SEM_GROWTH values(tablespace,substr(file_name,8,64),
current_size,free_space,largest_free,substr(file_name,20,40),sysdate)
select *
from SYSTEM.RR_SEM_GROWTH_temp;
-- order by tablespace;
commit;
exit
-- *****************************************************************
/*
select file_name from system.RR_SEM_GROWTH;
select * from SYSTEM.RR_SEM_GROWTH_temp;
select * from system.RR_SEM_GROWTH;
col "Database Size" format a20
col "Free space" format a20
col "Used space" format a20
select round(sum(used.bytes) / 1024 / 1024 / 1024 ) || ' GB' "Database Size"
, round(sum(used.bytes) / 1024 / 1024 / 1024 ) -
round(free.p / 1024 / 1024 / 1024) || ' GB' "Used space"
, round(free.p / 1024 / 1024 / 1024) || ' GB' "Free space"
from (select bytes
from v$datafile
union all
select bytes
from v$tempfile
union all
select bytes
from v$log) used
, (select sum(bytes) as p
from dba_free_space) free
group by free.p
/
This script will display a list of Oracle invalid objects:
break on c1 skip 2
set pages 999
col c1 heading 'owner' format a15
col c2 heading 'name' format a40
col c3 heading 'type' format a10
ttitle 'Invalid|Objects'
select
owner c1,
object_type c3,
object_name c2
from
dba_objects
where
status != 'VALID'
order by
owner,
object_type;
SELECT OBJECT_NAME FROM DBA_OBJECTS WHERE STATUS = 'INVALID';
*/
select
decode(object_type, ‘PACKAGE BODY’, ‘PACKAGE’, object_type) ||
‘ ‘ || owner || ‘.’ ||
object_name
as invalid_objects
from ALL_objects
where status = ‘INVALID’ and object_type in
(‘PROCEDURE’,’FUNCTION’,’PACKAGE’,’PACKAGE BODY’,’TRIGGER’,’VIEW’)
ORDER BY 1
/
————
recompile.sql
/*
Script to generate the SQL commands needed to recompile invalid Oracle objects.
By Rodger Lepinsky
*/
select ‘alter ‘ ||
decode(object_type, ‘PACKAGE BODY’, ‘PACKAGE’, object_type) ||
‘ ‘ || owner || ‘.’ ||
object_name || ‘ compile ‘ ||
decode(object_type, ‘PACKAGE BODY’, ‘BODY’,”) ||';’
AS RECOMPILE
from ALL_objects
where status = ‘INVALID’
and object_type in
(‘PROCEDURE’,’FUNCTION’,’PACKAGE’,’PACKAGE BODY’,’TRIGGER’,’VIEW’)
ORDER BY 1
/
Database size
COLUMN "Total Gb" FORMAT 999,999,999.0
COLUMN "Redo Gb" FORMAT 999,999,999.0
COLUMN "Temp Gb" FORMAT 999,999,999.0
COLUMN "Data Gb" FORMAT 999,999,999.0
Prompt
Prompt "Database Size"
select (select sum(bytes/1073741824) from dba_data_files) "Data Gb",
(select NVL(sum(bytes/1073741824),0) from dba_temp_files) "Temp Gb",
(select sum(bytes/1073741824)*max(members) from v$log) "Redo Gb",
(select sum(bytes/1073741824) from dba_data_files) +
(select NVL(sum(bytes/1073741824),0) from dba_temp_files) +
(select sum(bytes/1073741824)*max(members) from v$log) "Total Gb"
from dual;
-- *****************************************************************
drop table SYSTEM.SEM_DASD_GROWTH_temp;
--truncate table SEM_CLONING_DATAFILES;
-- *****************************************************************
set echo off
set heading off
set pagesize 0
set LINESIZE 120
set feedback off
set verify off
-- *****************************************************************
create table SYSTEM.sem_dasd_growth_temp
(TABLESPACE VARCHAR2(44),
FILE_NAME VARCHAR2(64),
CURRENT_SIZE NUMBER(15),
FREE_SPACE NUMBER(15),
LARGEST_FREE NUMBER(15));
INSERT INTO SYSTEM.SEM_DASD_GROWTH_temp
SELECT d.tablespace_name
,d.file_name
,d.current_size
,round(nvl(f.free_space,0),2)
,round(nvl(f.largest_free,0),2)
FROM
(select tablespace_name
, file_id
, sum(f.bytes/(1024*1024)) free_space
, max(f.bytes/(1024*1024)) largest_free
from sys.dba_free_space f
group by tablespace_name, file_id) f
,
(select tablespace_name
, file_id
, file_name
, blocks*(select value from v$parameter
where name = 'db_block_size')/(1024*1024) current_size
, maxblocks*(select value from v$parameter
where name = 'db_block_size')/(1024*1024) maxblocks
, increment_by*(select value from v$parameter
where name = 'db_block_size')/(1024*1024) increment_by
, autoextensible
from sys.dba_data_files
group by tablespace_name, file_id, file_name, blocks, maxblocks,
increment_by, autoextensible) d
WHERE d.FILE_ID = f.FILE_ID(+);
commit;
-- *****************************************************************
/*
drop table SYSTEM.SEM_DASD_GROWTH;
--truncate table SYSTEM.RR_SEM_GROWTH;
--truncate table SEM_CLONING_DATAFILES;
-- *****************************************************************
-- column "Ddname" format a20
-- column "TABLESPACE" format a40
-- *****************************************************************
create table SYSTEM.RR_SEM_GROWTH
(TABLESPACE VARCHAR2(44),
FILE_NAME VARCHAR2(64),
CURRENT_SIZE NUMBER(15),
FREE_SPACE NUMBER(15),
LARGEST_FREE NUMBER(15),
DDNAME VARCHAR2(40),
run_date timestamp(7));
*/
-- *****************************************************************
insert all
into system.RR_SEM_GROWTH values(tablespace,substr(file_name,8,64),
current_size,free_space,largest_free,substr(file_name,20,40),sysdate)
select *
from SYSTEM.RR_SEM_GROWTH_temp;
-- order by tablespace;
commit;
exit
-- *****************************************************************
/*
select file_name from system.RR_SEM_GROWTH;
select * from SYSTEM.RR_SEM_GROWTH_temp;
select * from system.RR_SEM_GROWTH;
Comments
Post a Comment