获得datafile,control file,redo logfile的信息

--------------------------------------------------------------------------
--File: checkfiles.sql
--Function: check all files including datafile,controlfile,logfile
--Author: NinGoo
--Create: 2006-3-11
--Modify:
--Version: 1.0
--------------------------------------------------------------------------


set echo off
set feedback off
set verify off
set timing off
set linesize 80
set pagesize 200

column name for a44
column status for a19
column size(M) for a7
column error for a20
ttitle center 'The infomation of all files' skip 3
--------------------------------------------------------------------------
select 'Data' as "TYPE",to_char(file#)||':'||name as "NAME",
status || '(' || enabled || ')' as Status,
to_char(bytes/1024/1024) as "SIZE(M)"
from v$datafile
union all
select LPAD('-',7,'-'),LPAD('-',44,'-'),LPAD('-',19,'-'),LPAD('-',7,'-') from dual
union all
select 'Temp',to_char(file#)||':'||name as "name",status || '(' || enabled || ')',
to_char(bytes/1024/1024)
from v$tempfile
union all
select LPAD('-',7,'-'),LPAD('-',44,'-'),LPAD('-',19,'-'),LPAD('-',7,'-') from dual
union all
select 'Redo',to_char(l.group#)||':'||lf.MEMBER,
lf.type || '(seq:' || to_char(l.sequence#)||')'||decode(l.archived,'YES',' A'),
to_char(l.BYTES/1024/1024 )
from v$logfile lf,v$log l
where lf.group#=l.group#
union all
select LPAD('-',7,'-'),LPAD('-',44,'-'),LPAD('-',19,'-'),LPAD('-',7,'-') from dual
union all
select 'Control',name,status ,
to_char(FILE_SIZE_BLKS*BLOCK_SIZE/1024/1024)
from v$controlfile
union all
select LPAD('-',7,'-'),LPAD('-',44,'-'),LPAD('-',19,'-'),LPAD('-',7,'-') from dual;

ttitle center 'the files which should be recoverd' skip 3
select a.file#,a.online_status as "STAT",a.error,b.name
from v$recover_file a, v$datafile b
where a.file#=b.file#;
--------------------------------------------------------------------------
set feedback on
set verify on
ttitle off

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/193161/viewspace-50210/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/193161/viewspace-50210/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值