Vc tem *** certeza ** que a segunda tablespace temporária já foi usada 
recentemente e/ou está mesmo sendo usada no momento ??? Pois o fato é que um 
sort segment só é criado quanda a tablespace temporária é referenciada - LÓGICO 
que se ainda não foi/é usada/referenciada, a nova tablespace temp *** NÂO *** 
vai aparecer na v$sort_segment E portanto não apareceria no teu script... Um 
exemplo , em banco 10gr2 EE onde a TEMP é a default temporary tablespace :

=> vou criar uma tablespace temporária adicional como vc diz que fez :


SYS@O10GR2::SQL>select * from v$sort_segment;

TABLESPACE_NAME                       SEGMENT_FILE      SEGMENT_BLOCK        
EXTENT_SIZE      CURRENT_USERS      TOTAL_EXTENTS       TOTAL_BLOCKS       
USED_EXTENTS        USED_BLO
CKS       FREE_EXTENTS    FREE_BLOCKS      ADDED_EXTENTS        EXTENT_HITS     
 FREED_EXTENTS      FREE_REQUESTS           MAX_SIZE         MAX_BLOCKS      
MAX_USED_SIZE    MAX_US
ED_BLOCKS          MAX_SORT_SIZE    MAX_SORT_BLOCKS       RELATIVE_FNO
------------------------------- ------------------ ------------------ 
------------------ ------------------ ------------------ ------------------ 
------------------ ---------------
--- ------------------ ------------------ ------------------ ------------------ 
------------------ ------------------ ------------------ ------------------ 
------------------ -----
------------- ------------------ ------------------ ------------------
TEMP                                             0                  0           
     128               0                    28               3584               
   0
  0             28               3584                  0                  0     
             0          0                 28               3584                 
 0
0                      0                  0                  0

SYS@O10GR2::SQL>select * from dba_temp_files;

FILE_NAME                                                                       
FILE_ID TABLESPACE_NAME                             BYTES             BLOCKS 
STATUS          RELATIV
E_FNO AUT               MAXBYTES          MAXBLOCKS       INCREMENT_BY         
USER_BYTES        USER_BLOCKS
-------------------------------------------------------------------- 
------------------ ------------------------------ ------------------ 
------------------ --------- -------------
----- --- ------------------ ------------------ ------------------ 
------------------ ------------------
+DG11G/o10gr2/tempfile/temp.263.776787033                                       
      1 TEMP                             30408704               3712 AVAILABLE  
                1 YE
S            34359721984            4194302                 80           
29360128               3584


SYS@O10GR2::SQL>create temporary tablespace temp2 tempfile 'C:\TS_TEMP2.DBF' 
size 300M;

Tablespace criado.

=> tá online direitinho ....

SYS@O10GR2::SQL>select * from dba_temp_files;

FILE_NAME                                                                       
FILE_ID TABLESPACE_NAME                             BYTES             BLOCKS 
STATUS          RELATIV
E_FNO AUT               MAXBYTES          MAXBLOCKS       INCREMENT_BY         
USER_BYTES        USER_BLOCKS
-------------------------------------------------------------------- 
------------------ ------------------------------ ------------------ 
------------------ --------- -------------
----- --- ------------------ ------------------ ------------------ 
------------------ ------------------
+DG11G/o10gr2/tempfile/temp.263.776787033                                       
      1 TEMP                             30408704               3712 AVAILABLE  
                1 YE
S            34359721984            4194302                 80           
29360128               3584
C:\TS_TEMP2.DBF                                                                 
      2 TEMP2                           314572800              38400 AVAILABLE  
                1 NO
                       0                  0                  0          
313524224              38272

=> mas AINDA não aparece na v$sort-segment....

SYS@O10GR2::SQL>select * from v$sort_segment;

TABLESPACE_NAME                       SEGMENT_FILE      SEGMENT_BLOCK        
EXTENT_SIZE      CURRENT_USERS      TOTAL_EXTENTS       TOTAL_BLOCKS       
USED_EXTENTS        USED_BLO
CKS       FREE_EXTENTS    FREE_BLOCKS      ADDED_EXTENTS        EXTENT_HITS     
 FREED_EXTENTS      FREE_REQUESTS           MAX_SIZE         MAX_BLOCKS      
MAX_USED_SIZE    MAX_US
ED_BLOCKS          MAX_SORT_SIZE    MAX_SORT_BLOCKS       RELATIVE_FNO
------------------------------- ------------------ ------------------ 
------------------ ------------------ ------------------ ------------------ 
------------------ ---------------
--- ------------------ ------------------ ------------------ ------------------ 
------------------ ------------------ ------------------ ------------------ 
------------------ -----
------------- ------------------ ------------------ ------------------
TEMP                                             0                  0           
     128               0                    28               3584               
   0
  0             28               3584                  0                  0     
             0          0                 28               3584                 
 0
0                      0                  0                  0

=> crio um usuário que a tem como default temp :

SYS@O10GR2::SQL>create user zezinho identified by zezinho default tablespace 
users temporary tablespace temp2;

Usuario criado.

SYS@O10GR2::SQL>select username, default_tablespace, temporary_tablespace from 
dba_users where username in ('SCOTT', 'ZEZINHO');

USERNAME         DEFAULT_TABLESPACE             TEMPORARY_TABLESPACE
---------------- ------------------------------ ------------------------------
ZEZINHO          USERS                          TEMP2
SCOTT            USERS                          TEMP

SYS@O10GR2::SQL>grant create session to zezinho;

Concess?o bem-sucedida.

SYS@O10GR2::SQL>grant create table to zezinho;

Concess?o bem-sucedida.

=> veja que AINDA não aparece na v$sort_segment, PORTANTO não apareceria no seu 
script :

SYS@O10GR2::SQL>select * from v$sort_segment;

TABLESPACE_NAME                       SEGMENT_FILE      SEGMENT_BLOCK        
EXTENT_SIZE      CURRENT_USERS      TOTAL_EXTENTS       TOTAL_BLOCKS       
USED_EXTENTS        USED_BLO
CKS       FREE_EXTENTS    FREE_BLOCKS      ADDED_EXTENTS        EXTENT_HITS     
 FREED_EXTENTS      FREE_REQUESTS           MAX_SIZE         MAX_BLOCKS      
MAX_USED_SIZE    MAX_US
ED_BLOCKS          MAX_SORT_SIZE    MAX_SORT_BLOCKS       RELATIVE_FNO
------------------------------- ------------------ ------------------ 
------------------ ------------------ ------------------ ------------------ 
------------------ ---------------
--- ------------------ ------------------ ------------------ ------------------ 
------------------ ------------------ ------------------ ------------------ 
------------------ -----
------------- ------------------ ------------------ ------------------
TEMP                                             0                  0           
     128               0                    28               3584               
   0
  0             28               3584                  0                  5     
             0          0                 28               3584                 
 5                64
0                      5                640                  0

=> agora vou fazer uma operação que Efetivamente consome temp area, que é botar 
dados em  GTT, em outras sessões  :

SCOTT@O10GR2::SQL>create global temporary table teste_scott as (select * from 
all_objects);

Tabela criada.

e :

ZEZINHO@O10GR2::SQL>create global temporary table teste_zezinho as (select * 
from all_objects);

Tabela criada.

===>>> AGORA SIM eu referenciei a nova temp (portanto ela VAI ter um sort 
segment pra ela) , além de a ter usado (portanto o Consumo aparecerá também 
dentro do sort_segment) :

SYS@O10GR2::SQL>select * from v$sort_segment;

TABLESPACE_NAME                       SEGMENT_FILE      SEGMENT_BLOCK        
EXTENT_SIZE      CURRENT_USERS      TOTAL_EXTENTS       TOTAL_BLOCKS       
USED_EXTENTS        USED_BLO
CKS       FREE_EXTENTS    FREE_BLOCKS      ADDED_EXTENTS        EXTENT_HITS     
 FREED_EXTENTS      FREE_REQUESTS           MAX_SIZE         MAX_BLOCKS      
MAX_USED_SIZE    MAX_US
ED_BLOCKS          MAX_SORT_SIZE    MAX_SORT_BLOCKS       RELATIVE_FNO
------------------------------- ------------------ ------------------ 
------------------ ------------------ ------------------ ------------------ 
------------------ ---------------
--- ------------------ ------------------ ------------------ ------------------ 
------------------ ------------------ ------------------ ------------------ 
------------------ -----
------------- ------------------ ------------------ ------------------
TEMP                                             0                  0           
     128               0                    28               3584               
   0
  0             28               3584                  0                  5     
             0          0                 28               3584                 
 5                64
0                      5                640                  0
TEMP2                                            0                  0           
     128               0                     5                640               
   0
  0              5                640                  5                  0     
             0          0                  5                640                 
 5                64
0                      5                640                  0

==> okdoc ?? Veja como nessa situação o teu script funciona Sim :

SYS@O10GR2::SQL>SELECT d.tablespace_name tablespace_name,
  2  d.status tablespace_status,
  3  NVL(a.bytes, 0) tablespace_size,
  4  NVL(t.bytes, 0) used,
  5  TRUNC(NVL(t.bytes / a.bytes * 100, 0)) used_pct,
  6  NVL(s.current_users, 0) current_users
  7  FROM sys.dba_tablespaces d,
  8  (select tablespace_name,
  9  sum(bytes) bytes
 10  from dba_temp_files
 11  group by tablespace_name) a,
 12  (select tablespace_name,
 13  sum(bytes_cached) bytes
 14  from v$temp_extent_pool
 15  group by tablespace_name) t,
 16  v$sort_segment s
 17  WHERE d.tablespace_name = a.tablespace_name(+)
 18  AND d.tablespace_name = t.tablespace_name(+)
 19  AND d.tablespace_name = s.tablespace_name
 20  ;

TABLESPACE_NAME                TABLESPAC    TABLESPACE_SIZE               USED  
         USED_PCT      CURRENT_USERS
------------------------------ --------- ------------------ ------------------ 
------------------ ------------------
TEMP                           ONLINE              30408704           29360128  
               96          0
TEMP2                          ONLINE             314572800            5242880  
                1          0

SYS@O10GR2::SQL>

==> blz ?? vou encerrar o consumo na temp2 :

ZEZINHO@O10GR2::SQL>exit
Desconectado de Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 
64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

C:\Users\jchiappa>

==> olha lá o resultado :

SYS@O10GR2::SQL>l
  1  SELECT d.tablespace_name tablespace_name,
  2  d.status tablespace_status,
  3  NVL(a.bytes, 0) tablespace_size,
  4  NVL(t.bytes, 0) used,
  5  TRUNC(NVL(t.bytes / a.bytes * 100, 0)) used_pct,
  6  NVL(s.current_users, 0) current_users
  7  FROM sys.dba_tablespaces d,
  8  (select tablespace_name,
  9  sum(bytes) bytes
 10  from dba_temp_files
 11  group by tablespace_name) a,
 12  (select tablespace_name,
 13  sum(bytes_cached) bytes
 14  from v$temp_extent_pool
 15  group by tablespace_name) t,
 16  v$sort_segment s
 17  WHERE d.tablespace_name = a.tablespace_name(+)
 18  AND d.tablespace_name = t.tablespace_name(+)
 19  AND d.tablespace_name = s.tablespace_name
 20*
SYS@O10GR2::SQL>/

TABLESPACE_NAME                TABLESPAC    TABLESPACE_SIZE               USED  
         USED_PCT      CURRENT_USERS
------------------------------ --------- ------------------ ------------------ 
------------------ ------------------
TEMP                           ONLINE              30408704           29360128  
               96          0
TEMP2                          ONLINE             314572800            5242880  
                1          0

SYS@O10GR2::SQL>

==>> EXATAMENTE o resultado esperado , tá Registrado que já foi 
usada/referenciada a temp tablespace secundária, E neste momento o consumo dela 
é mínimo (só os extents iniciais que a alocação de um sort segment cria tão 
lá....

 []s
 
   Chiappa
   

--- Em [email protected], Márcio - Grupos Oracle <marcio_cbj@...> 
escreveu
>
> Consegui fazer através dessa view.
> 
>  
> 
> select tablespace_name,sum(bytes_used/1024/1024)
> USEB_IN_MB,sum(bytes_free/1024/1024) FREE_IN_MB  from v$temp_space_header
> group by tablespace_name;
> 
>  
> 
> O estranho que vejo, é que a TEMP, que está para os demais schemas está com
> 2GB em uso, já a TEMP1, que foi criada para somente um schema está com quase
> nada em uso, ou seja, os 10GB estão livres
> 
>  
> 
> Na consulta da dba_users, a coluna TEMPORARY_TABLESPACE, mostra que o schema
> está realmente com a TEMP1 nova.
> 
>  
> 
> De: [email protected] [mailto:[email protected]] Em
> nome de Márcio - Grupos Oracle
> Enviada em: Thursday, 13 de December de 2012 12:15
> Para: [email protected]
> Assunto: RES: [oracle_br] tablespace temp
> 
>  
> 
>   
> 
> Segue:
> 
> SELECT d.tablespace_name tablespace_name, 
> d.status tablespace_status, 
> NVL(a.bytes, 0) tablespace_size, 
> NVL(t.bytes, 0) used, 
> TRUNC(NVL(t.bytes / a.bytes * 100, 0)) used_pct, 
> NVL(s.current_users, 0) current_users
> FROM sys.dba_tablespaces d, 
> (select tablespace_name, 
> sum(bytes) bytes
> from dba_temp_files 
> group by tablespace_name) a, 
> (select tablespace_name, 
> sum(bytes_cached) bytes
> from v$temp_extent_pool 
> group by tablespace_name) t, 
> v$sort_segment s
> WHERE d.tablespace_name = a.tablespace_name(+) 
> AND d.tablespace_name = t.tablespace_name(+) 
> AND d.tablespace_name = s.tablespace_name
> 
> 
> 
> -----Mensagem original-----
> De: [email protected] <mailto:oracle_br%40yahoogrupos.com.br>
> [mailto:[email protected] <mailto:oracle_br%40yahoogrupos.com.br>
> ] Em
> nome de Milton Bastos Henriquis Jr.
> Enviada em: Thursday, 13 de December de 2012 12:14
> Para: [email protected] <mailto:oracle_br%40yahoogrupos.com.br> 
> Assunto: Re: [oracle_br] tablespace temp
> 
> Seria mais fácil vc colar essa consulta aqui pra gente... rs...
> 
> 2012/12/13 Márcio - Grupos Oracle <marcio_cbj@...
> <mailto:marcio_cbj%40yahoo.com.br> >
> 
> > **
> >
> >
> > Boas.
> >
> > Adicionei uma tablespace temp para um schema, e os demais estão com a 
> > tablespace TEMP default.
> >
> > Nas consultas que tenho para verificar a utilização da tablespace 
> > temp, está retornando somente a que está como default e não a nova. 
> > Como eu faço para consultar a utilização dessa tablespace temp nova.?
> >
> > 10.2.0.5
> >
> > [As partes desta mensagem que não continham texto foram removidas]
> >
> > 
> >
> 
> [As partes desta mensagem que não continham texto foram removidas]
> 
> ------------------------------------
> 
> ----------------------------------------------------------
> ----------------------------------------------
> >Atenção! As mensagens do grupo ORACLE_BR são de acesso público e de inteira
> responsabilidade de seus remetentes.
> Acesse: http://www.mail-archive.com/[email protected]/
> ----------------------------------------------------------
> ----------------------------------------------
> >Apostilas » Dicas e Exemplos » Função » Mundo Oracle » Package » 
> >Procedure » Scripts » Tutoriais - O GRUPO ORACLE_BR TEM SEU PROPRIO 
> >ESPAÇO! VISITE: http://www.oraclebr.com.br/
> ----------------------------------------------------------
> -------------------------------------------- Links do Yahoo! Grupos
> 
> 
> 
> 
> 
> [As partes desta mensagem que não continham texto foram removidas]
>


Responder a