oracle dataguard 之nologing

管理部分

如果沒有啓用database force logging,則備庫對/*+ append */操作,nologging操作,會報壞塊;

建議表空間force logging或者database force logging;

測試:

select force_logging, tablespace_name
  from dba_tablespaces
 where tablespace_name in
       (select default_tablespace from dba_users where username = 'SCOTT');
------------------------------
FORCE_LOGGING	TABLESPACE_NAME
NO	TEST
create table t1 noglogging as select * from user_tables;

備庫查詢:

select * from t1;
ORA-01578: ORACLE data block corrupted (file # 8, block # 483)
ORA-01110: data file 8: '/data/db/test1.dbf'
ORA-26040: Data block was loaded using the NOLOGGING option

但以下是可以的

select * from t1 where rownum<1

主庫收集下表信息:

begin
  dbms_stats.gather_table_stats(ownname=>'SCOTT',tabname=>'T1',cascade=>TRUE);
  end
select table_name,num_rows,logging from  user_tables where table_name='T1';

統計信息也是同步過來的;也就是表結構啥都是正常的,就是這個表的數據同步不了;

解決辦法:

主庫把表刪了重建,或者把相應的數據文件做恢復;


--相關sql


alter database force logging;
select force_logging from dba_tablespaces;
select force_logging from v$database;
alter tablespace test force logging;
select  logging,table_name,tablespace_name from user_tables where table_name ='TEST';
alter tablespace test no force logging;
select tablespace_name,logging,force_logging from dba_tablespaces;


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章