Monday, December 21, 2015

Data Block Corrupt - database offline!

How to get the DB back up:
1.  login as sysdba
2. shutdown immediate;
3. startup;

How to find the table or index with the problem:
1. type the file.trc thru GREP
    cat orcl_pmon_4543.trc|grep 'data block corrupted'

Results:
  • ORA-01578: ORACLE data block corrupted (file # 6, block # 208825)
  • ORA-01578: ORACLE data block corrupted (file # 6, block # 208825)
Use this query:
select owner, segment_type, segment_name
from dba_extents
where file_id=6
  and 208825
  between block_id and block_id+blocks-1;
Results:

OWNER SEGMENT_TYPE SEGMENT_NAME
HYP_CCC9 INDEX PARTITION SERVER_FACT_ENTITY_ID_IDX

How to find the DB filename:
 cat orcl_pmon_4543.trc|grep 'data file'

Results:

ORA-01110: data file 6: '/home/oracle/app/oracle/oradata/orcl/HYP_DM9_IDX_3.dbf'
ORA-01110: data file 6: '/home/oracle/app/oracle/oradata/orcl/HYP_DM9_IDX_3.dbf'



How to fix this:
1.  Idea, rename the bad index and create a new one?






Friday, December 18, 2015

Oracle DB Table Space Corrupt affecting Entity_DAY_FACT table.

So today Oracle was made about a corruption.

Error in rollups was:
ERROR: Rollup process on baseline table errored out.: -12801: ORA-12801: error signaled in parallel query server P004 ORA-01578: ORACLE data block corrupted (file # 208, block # 1006627) ORA-01110: data file 208: '/home/oracle/app/oracle/oradata/orcl/temp2.dbf'ORA-06512: at "HYP_CCC9.ROLLUP_METRICS", line 3324 ORA-06512: at "HYP_CCC9.ROLLUP_METRICS", line 3255 


So to fix it I shutdown DM/CCC.

Then I renamed the table Entity_day_fact.

Then I made a new Table, based on the definition of the original table.

Deleted all the indexes.

Added them back to the new table.

Cleared errors in EM.

Shutdown database.
Restarted Linux host.
Started Oracle DB
Listener
EM

Then restarted CCC/DM

It is working fine again!

David

Thursday, October 8, 2015

Oracle File Corruption - keeps happening in test Oracle Instance

If you are having more than one File Corruption... you may need to enable this!

DB_BLOCK_CHECKING

When the DB_BLOCK_CHECKING parameter is set to [TRUE|HIGH] Oracle performs a walk through of the data in the block to check it is self-consistent. Unfortunately block checking can add between 1 and 10% overhead to the server. Oracle recommend setting this parameter to [TRUE|HIGH] if the overhead is acceptable.
Allowable values include [OFF|FALSE], LOW, MEDIUM, [HIGH|TRUE]. Read the definitions here

I kept having problems with a test Oracle DB....again and again.
Until I turned on this setting I could not load data consistently.

Here is what I used to enable this feature:

db_block_checking tips

Oracle Tips by Burleson Consulting
June 15, 2009
The db_block_checking parameter is used to performs block checks for all data blocks making sure that all data in the block is consistent.  The default fordb_block_checking is false, because db_block_checking imposes an additional system overhead.

This db_block_checking parameter is used primarily in diagnosing disk I/O issues in system where replicated blocks show corruption.  checks data block integrity before writing the data block to disk.  

In this involves checking the internal block headers and footer, plus internal row linkages.

Block checking provides early detection of block corruption, however, it costs between 1-10% in overhead on the database.  The more DML and block writes that occur on a system (INSERT, UPDATE, DELETE), the more costlydb_block_checking becomes.

WARNING:  While the Oracle documentation says that db_block_checking=true only adds a 1 to 10% overhead depending on concurrency of DML, we have seen cases where db_block_checking=truemade the updates run 6x slower. 

Any errors encountered by block checking result in an ORA-600 level message in the alert log.  Before setting the db_block_checking parameter to TRUE, first execute the database verify (dbv) utility against the datafiles to make sure they are free of corruption.   Even when db_block_checking=false, Oracle still provides block checking for the system tablespace.
Note that the db_block_checking parameter can be changed with an alter systemcommand:

alter system set db_block_checking=true scope=both;

For additional information on handling corruption, see the BC expert notes on corruption and see MOSC Note 1088018.1 - Handling Oracle Database Corruption Issues.

Also see related pages:

- db_block_checksum tips 


- db_ultra_safe Tips 

Tuesday, October 6, 2015

Firefox cannot open https://server:1158/em/ enterprise manager console

Fix for Oracle 11.2.0.1.0
I tried to use the fix at http://frodo.looijaard.name/article/oem-database-control-security-certificate, but my emctl release on Oracle 11.1.0.6 does not support the options it details at the end. So I fixed it by unsecuring the console.

emctl unsecure dbconsole

A somewhat poor response I agree to what Mozilla are doing, but this system is only available on an internal network.


---------- Below may work for Oracle DB 12c


4. Re: (Error code: ssl_error_weak_server_cert_key)
Jônatan SmithNewbie
Hi,

Here in our organization, we had this problem because the OutOfBox certifications aren't 2048bits. As Firefox was working to improve the security, weaks certificates (1024,512bits) were retired (https://blog.mozilla.org/security/2014/09/08/phasing-out-certificates-with-1024-bit-rsa-keys/).

I was able to fix it by replacing default's certificates by others. We have an own Certificate Authority, trusted by all internal network, which signed a certificate for use in EM12c.

These certificates were installed using this manual:http://docs.oracle.com/cd/E24628_01/doc.121/e36415/sec_features.htm#EMSEC13070

If you don't have a Certificate Authority to use with your Enterprise Manager, you can install a self signed certificate (easy with Google) or alternatively you can disable security if it is not a requirement.

If you prefer to disable it, you can find the guidelines in the item 6 of chapter 2.3.5 of Security Manual provided above. Here are the commands:

emctl secure unlock
emctl secure unlock -console -upload


I hope it helps.
Good luck and good work.

    Wednesday, September 16, 2015

    DBMS_REPAIR - for fixing corrupt blocks in DB

    Corruption was CheckSum and was not fixed by this process...

    ----------- How to find the tables with the problem -----

    Where corrupt block is in File_ID=10 and Block # 270456

    SELECT
      owner
    , segment_name
    , tablespace_name
    FROM
      dba_extents
    WHERE
      FILE_ID=10
    AND 270456 BETWEEN BLOCK_ID AND BLOCK_ID+BLOCKS;

    -------------------------------------

    Setup a Table Space for DBMS_REPAIR tables:

    CREATE SMALLFILE TABLESPACE "DBMS_REPAIR_TBL"
     DATAFILE
     'Repair1.dbf' SIZE 200M AUTOEXTEND ON NEXT 200M MAXSIZE 5G,
     'Repair2.dbf' SIZE 200M AUTOEXTEND ON NEXT 200M MAXSIZE 5G,
     'Repair3.dbf' SIZE 200M AUTOEXTEND ON NEXT 200M MAXSIZE 5G,
     'Repair4.dbf' SIZE 200M AUTOEXTEND ON NEXT 200M MAXSIZE 5G
     NOLOGGING
     DEFAULT NOCOMPRESS
     ONLINE
     EXTENT MANAGEMENT LOCAL AUTOALLOCATE
     SEGMENT SPACE MANAGEMENT AUTO;

    Source for the below is:
    http://www.dba-oracle.com/concepts/dbms_repair.htm

    ---------- Create Two Tables
    begin
      dbms_repair.admin_tables(
           table_name => 'REPAIR_TABLE',
           table_type => dbms_repair.repair_table,
           action     => dbms_repair.create_action,
          tablespace => 'DBMS_REPAIR_TBL' );
    end;
    /

    begin
      dbms_repair.admin_tables(
         table_name => 'ORPHAN_TABLE',
         table_type => dbms_repair.orphan_table,
         action     => dbms_repair.create_action,
         tablespace => 'DBMS_REPAIR_TBL'
       );
    end;

    ---------------- Run Check Table

    set serveroutput on
    declare corr_count binary_integer;
    begin
    corr_count := 0;
    dbms_repair.CHECK_OBJECT (
       schema_name       => 'HYP_CCC',
       object_name       => 'ENTITY_DAY_FACT',
       partition_name    => null,
       object_type       => dbms_repair.table_object,
       repair_table_name => 'REPAIR_TABLE',
       flags             => null,
       relative_fno      => null,
       block_start       => null,
       block_end         => null,
       corrupt_count     => corr_count
       );
    dbms_output.put_line(to_char(corr_count));
    end;
    /

    --- IF ERRORS found run Fix Table OR Fix Index

    SET SERVEROUTPUT ON
    DECLARE fix_count INT;
    BEGIN
    Fix_count := 0;
    DBMS_REPAIR.FIX_CORRUPT_BLOCKS (
    SCHEMA_NAME => 'HYP_CCC',
    OBJECT_NAME=> 'ENTITY_DAY_FACT',
    OBJECT_TYPE => dbms_repair.table_object,
    REPAIR_TABLE_NAME => 'REPAIR_TABLE',
    FIX_COUNT=> fix_count);
    DBMS_OUTPUT.PUT_LINE('Fix count = ' || TO_CHAR(fix_count));
    END;
    /

    ---
    SET SERVEROUTPUT ON
    DECLARE key_count INT;
    BEGIN
    key_count := 0;
    DBMS_REPAIR.DUMP_ORPHAN_KEYS (
    SCHEMA_NAME => 'HYP_CCC',
    OBJECT_NAME => 'INDEX_NAME_HERE',
    OBJECT_TYPE => dbms_repair.index_object,
    REPAIR_TABLE_NAME => 'REPAIR_TABLE',
    ORPHAN_TABLE_NAME=> 'ORPHAN_KEY_TABLE',
    KEY_COUNT => key_count);
    DBMS_OUTPUT.PUT_LINE('Orphan key count: ' || TO_CHAR(key_count));
    END;
    /

    ----------

    Tuesday, September 15, 2015

    ArchiveLog turned on, but nobody is backing it up...

    Archive logs fill up the disk quickly and cause an outage.

    Here is how I deleted all archive logs.

    Deleting old archive logs by date

    The other day when logging into one of my test systems I was greeted with the following error:

    ORA-00257 archiver error. connect internal only until freed

    The cause?  Out of disk space.  Since it was non-production we weren't backing it up, so the archive logs were just hanging out there forever.

    I logged into RMAN from the console and launched the following:

    allocate channel for delete type disk;
    change archivelog until time 'SYSDATE-7' delete;
    release channel;


    Don't do this on a production system and definitely re-think your decision to have Oracle databases in archivelog mode that aren't being frequently backed up.  I know I will.

    Cheers

    Oracle DB Shutdown taking forever....

    One way out is to open another SQLPLUS '/ as sysdba'

    then

    Shutdown abort;

    This will kill the long running shutdown in the other session.

    Not recommended, but it works.

    Friday, February 13, 2015

    Add DBLINK to SQLServer DB?

    Source : Oracle 11g on linux
    destination : ms sql server 2005

    i need to create the db link from oracle to ms sql server to view the tables , is it posibble without configuring the gateways( as looks like it is licenced product)

    Please let me know any alternative to achive this

    Thanks
    PGR
    kgronau
    Correct Answerby kgronau on Nov 12, 2013 10:00 AM
    There are 2 gateway - the commercial Database Gateway for Ms SQl Server which requires a license and the Database Gateway for ODBC which is for free. The license for DG4ODBC is included in your database license. You only need to install a suitable ODBC driver on your Linux box (for example use the MS SQl Server ODBC driver for Linux - details can be found here: http://www.microsoft.com/en-gb/download/details.aspx?id=36437 ). and then configure the gateway using the My Oracle Support Note:
    How to Configure DG4ODBC on 64bit Unix OS (Linux, Solaris, AIX, HP-UX Itanium) to Connect to Non-Oracle Databases Post Install  [Article ID 561033.1]


    - Klaus