Operating System - HP-UX
1752564 Members
4740 Online
108788 Solutions
New Discussion юеВ

Re: datafiles that belong to tablespaces

 
Hunan_1
Frequent Advisor

datafiles that belong to tablespaces

Hi all, Could anyone please tell how can I see the datafiles that belong to certain tablespace.

Is it ok to see just the dba_data_files in order to see it?

If I have the tablespace offline, does the dba_data_datafiles still shows me the datafiles attached?

Another question, what would happend if some disk where I have some raw datafiles are damaged?

would the database crash?

Thanx
9 REPLIES 9
twang
Honored Contributor

Re: datafiles that belong to tablespaces

select tablespace_name,
file_id,
file_name,
bytes/1024/1024 "size"
from dba_data_files
order by tablespace_name, file_id, file_name;
Ravi_8
Honored Contributor

Re: datafiles that belong to tablespaces

Hi,

select tablespace_name, file_name from dba_data_files;
never give up
Ravi_8
Honored Contributor

Re: datafiles that belong to tablespaces

Hi,

select tablespace_name, file_name from dba_data_files;
never give up
Ravi_8
Honored Contributor

Re: datafiles that belong to tablespaces

Hi,

select tablespace_name, file_name from dba_data_files;
never give up
Steven E. Protter
Exalted Contributor

Re: datafiles that belong to tablespaces

If the disk crashed where datafiles are located, access to those datafiles, tablespaces and all objects within would be lost. Instantly.

It depends on your definition of crash whether or not the database would crash. It certainly wouldn't be very useful. There would be a lot of nasty error messges in the alert log.

If by crash, do you mean would the database processes, smon, pmon log writer, etc stop. Answer eventually, but you'll probably detect the problem first and have to do a shutdown abort.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Ravi_8
Honored Contributor

Re: datafiles that belong to tablespaces

Hi,

select tablespace_name, file_name from dba_data_files;
never give up
T G Manikandan
Honored Contributor

Re: datafiles that belong to tablespaces

If the hard disks on which the datafiles reside have problem,the database should stop responding until you recover it or remove those files(drop those files from the database).

you can query dba_data_files for the datafiles and the tablespaces.

Indira Aramandla
Honored Contributor

Re: datafiles that belong to tablespaces

Hi,

To get the datafile name and path you can select the view DBA_DATA_FILES. The columns file_name, tablespacE_name, status will display the datafile (name in full path), tablesapce name and the status as available. If you take a tablespace offline for backup or some maintenance the above status column will still show you as "available. The view DBA_TABLESPACS will shut the status as offline / online depending on the tablespace being online oor offline.

Not the other question that you asked. Whn the raw device on which a datafile is defined in a database is damaged, then the database will not crash. But you cannot access the data from the tables defined in that tablespace. The tablespace will be offline and will request for recovery.

I hope this helps you.


IA
Never give up, Keep Trying
Hein van den Heuvel
Honored Contributor

Re: datafiles that belong to tablespaces


While dba_data_files tends to have all the critical data fro your question, there are mor file to the database not listed there: TEMP, REDO, CONTROL.

Here is the simple script I made for this purpose which may provide a starting point...

hth,
Hein.

column status format a8
column member format a55
column Tablespace format a15
column owner format a10
column file format a45
column id format 99

set pages 9999
set heading off
set FEEDBACK off
select 'redo_'||l.group# "Tablespace", l.group# "Id", l.bytes/(1024*1024) "MB",
MEMBER "File" from v$logfile f, v$log l where l.group# = f.group#
union
select tablespace_name "Tablespace", FILE_ID "Id", bytes/(1024*1024) "MB",
file_name "File" from dba_data_files
union
select tablespace_name "Tablespace", FILE_ID "Id", bytes/(1024*1024) "MB",
file_name "File" from dba_temp_files
union
select 'Control file' "Tablespace", rownum "Id", 0 "MB",
name "File" from v$controlfile
order by 1
/