请教一个判断语句。
有一个备份数据库B,在备份好后才会向我们开放,但是有时候这一天都不会开。
我有一个数据库A,在A上建了到数据库B的DBLINK。
在A上跑了一个应用,要用到B的数据,比如:
select * from all_tables@B
我要怎样判断数据库B是否已经可用,我试了用异常,如下:
declare
aa number(10);
begin
select count(*) into aa from all_tables@B where rownum<2;
exception
when others then
dbms_output.put_line('数据库未准备好');
end;
但捕捉不到,报的错误是ORA-00942:表或视图不存在。
不知还有什么别的办法?请教。