Hi everybody, i'm back.
Today i will talk about a specific process, that i´m been working for, that is a "fast cleaning the contents in a schema".
So, i will explain and show the main script to clear out all objects from dba_segments from user.
You could have two situations to use this procedure:
a) to an inport data&metada to an existente user with no objects.
b) to droping a fast user.
This metoth is fastest than a "Drop user cascade".
The explanation is simple:
You just need understand the relational link bettwen the objects, and then cleanup from the bottom of priroraty, or the bottom of pyramid.
See you soon with the example.
ORACLE DataBase Administrator
This space will not be more than a place to publish my notes and issues commands for certain management databases on ORACLE platform. I want to be a help to all stakeholders. And how could't it be otherwise, i intend to learn from you. For me to OCM still lack a lot of road walking. Thank you all. Greetings' «José Maia »
segunda-feira, 28 de julho de 2014
terça-feira, 11 de junho de 2013
TABLESPACES SPACE
Olá , cá estou de volta!
Desta vez trago um tópico simples... "ESPAÇO no TBS"
Para começar temos uma querie q nos mostra o espaço total , o espaço ocupado, e uma percentagem relativa ao espaço livre.
--> VISTA GLOBAL:
select aloc.tablespace_name, aloc.espaco ALOCADO_MB, liv.espaco LIVRE_MB, ( aloc.espaco-NVL(liv.espaco,0) ) OCUPADO_MB,
TRUNC ( liv.espaco/aloc.espaco * 100 ) "%_LIVRE"
from ( select tablespace_name, sum(bytes)/1024/1024 espaco from dba_data_files
where tablespace_name LIKE '%' -- in('')
group by tablespace_name ) aloc, ( select tablespace_name, sum(bytes)/1024/1024 espaco from dba_free_space
group by tablespace_name ) liv where aloc.tablespace_name = liv.tablespace_name (+) order by "%_LIVRE";
Nesta versão temos a hipotese de ver todos os TABLESPACES com o like '%' ou entao defini-los no "IN".
Complemento ainda com mais três queries uma para o size do TBS outra para ver os datafiles que fazem parte do TABLESPACE. Por fim uma q nos mostra a quota dos users nesse TABLESPACE.
--> SIZE DO TBS:
select TABLESPACE_NAME, sum(BYTES)/1024/1024 from dba_data_files where TABLESPACE_NAME =upper('nome_tablespace') group by tablespace_name;
--> DATAFILES:
select FILE_NAME,TABLESPACE_NAME,BYTES/1024/1024 from dba_data_files where TABLESPACE_NAME = upper('nome_tablespace');
--> QUOTA:
select TABLESPACE_NAME, USERNAME, BYTES/1024/1024, MAX_BYTES from dba_ts_quotas where TABLESPACE_NAME = upper('users');
JM
(TJá)
Desta vez trago um tópico simples... "ESPAÇO no TBS"
Para começar temos uma querie q nos mostra o espaço total , o espaço ocupado, e uma percentagem relativa ao espaço livre.
--> VISTA GLOBAL:
select aloc.tablespace_name, aloc.espaco ALOCADO_MB, liv.espaco LIVRE_MB, ( aloc.espaco-NVL(liv.espaco,0) ) OCUPADO_MB,
TRUNC ( liv.espaco/aloc.espaco * 100 ) "%_LIVRE"
from ( select tablespace_name, sum(bytes)/1024/1024 espaco from dba_data_files
where tablespace_name LIKE '%' -- in('')
group by tablespace_name ) aloc, ( select tablespace_name, sum(bytes)/1024/1024 espaco from dba_free_space
group by tablespace_name ) liv where aloc.tablespace_name = liv.tablespace_name (+) order by "%_LIVRE";
Nesta versão temos a hipotese de ver todos os TABLESPACES com o like '%' ou entao defini-los no "IN".
Complemento ainda com mais três queries uma para o size do TBS outra para ver os datafiles que fazem parte do TABLESPACE. Por fim uma q nos mostra a quota dos users nesse TABLESPACE.
--> SIZE DO TBS:
select TABLESPACE_NAME, sum(BYTES)/1024/1024 from dba_data_files where TABLESPACE_NAME =upper('nome_tablespace') group by tablespace_name;
--> DATAFILES:
select FILE_NAME,TABLESPACE_NAME,BYTES/1024/1024 from dba_data_files where TABLESPACE_NAME = upper('nome_tablespace');
--> QUOTA:
select TABLESPACE_NAME, USERNAME, BYTES/1024/1024, MAX_BYTES from dba_ts_quotas where TABLESPACE_NAME = upper('users');
JM
(TJá)
Subscrever:
Mensagens (Atom)