Thursday 29 June 2017

Corrupt block relative dba message in the Alert Log - Definition and Solution

What is the meaning of message "Corrupt block relative dba..." in the alert log?

message describing the block corruption:


Bad header found during buffer read
Data in bad block:
type: 2 format: 2 rdba: 0x21008dd0
last change scn: 0x0006.12114f8e seq: 0x37 flg: 0x04
spare1: 0x0 spare2: 0x0 spare3: 0x0
consistency value in tail: 0x4f8e0237
check value in block header: 0x6e5b
computed block checksum: 0x0
Reread of rdba: 0x3d808dd0 (file 246, block 36304) found same corrupted data
Errors in file /testsite/testdb/db/tech_st/11.1.0/admin/TEST_erptestappldb/diag/rdbms/test/TEST/trace/TEST_s000_11075614.trc
(incident=31537):
ORA-01578: ORACLE data block corrupted (file # 246, block # 36304)
ORA-01110: data file 246: '/testsite/testdb/db/apps_st/data/a_txn_data47.dbf'
Incident details in: /testsite/testdb/db/tech_st/11.1.0/admin/TEST_erptestappldb/diag/rdbms/test/TEST/incident/incdir_31537/T
EST_s000_11075614_i31537.trc
Wed Jun 28 11:42:12 2017
Corrupt Block Found
TSN = 10, TSNAME = APPS_TS_TX_DATA
RFN = 246, BLK = 36304, RDBA = 1031835088
OBJN = 87982, OBJD = 87982, OBJECT = OE_ORDER_HEADERS_ALL, SUBOBJECT =
SEGMENT OWNER = ONT, SEGMENT TYPE = Table Segment
Wed Jun 28 11:42:25 2017
Non critical error ORA-48913 caught while writing to trace file "/testsite/testdb/db/tech_st/11.1.0/admin/TEST_erptestappldb/
diag/rdbms/test/TEST/incident/incdir_31537/TEST_s000_11075614_i31537.trc"
Error message: ORA-48913: Writing into trace file failed, file size limit [10485760] reached
Writing to the above trace file is disabled for now on... 

Solution:

The corruption you are finding is misplaced block, which is a physical corruption introduced by the underlying system.

Corrupt block relative dba: 0x3d808dd0 (file 246, block 36304)
Bad header found during buffer read
Data in bad block:
type: 2 format: 2 rdba: 0x21008dd0 rdba: 0x21008dd0 != dba: 0x3d808dd0
last change scn: 0x0006.12114f8e seq: 0x37 flg: 0x04
spare1: 0x0 spare2: 0x0 spare3: 0x0
consistency value in tail: 0x4f8e0237
check value in block header: 0x6e5b
computed block checksum: 0x0
Reread of rdba: 0x3d808dd0 (file 246, block 36304) found same corrupted data 

This is fully solvable by blockrecovery operations. 

If RMAN backup is available and all archivelogs, than please run:

RMAN>recover corruption list;

Otherwise, the data in the affected blocks is lost and segments will need to be recreated.

To evaluate the overall database status, you can use:

RMAN> backup validate check logical database;

NOTE:
=====
This command will succeed if DB is running in ARCHIVELOG mode.
. If DB in NOARCHIVELOG mode, then this RMAN command *Must* be run against the database in MOUNT state.
. If you try to this RMAN command against an open DB running NOARCHIVELOG mode the following error will occur:

-> RMAN-03009: failure of backup command on d1 channel at 12/07/2009 18:55:25
-> ORA-19602: cannot backup or copy active file in NOARCHIVELOG mode

After RMAN validate finishes, the view v$database_block_corruption will be populated with all the affected blocks.

To identify the affected objects, below queries can be used:

set pagesize 2000
set linesize 280
SELECT e.owner, e.segment_type, e.segment_name, e.partition_name, c.file#
, greatest(e.block_id, c.block#) corr_start_block#
, least(e.block_id+e.blocks-1, c.block#+c.blocks-1) corr_end_block#
, least(e.block_id+e.blocks-1, c.block#+c.blocks-1)
- greatest(e.block_id, c.block#) + 1 blocks_corrupted
, corruption_type description
FROM dba_extents e, v$database_block_corruption c
WHERE e.file_id = c.file#
AND e.block_id <= c.block# + c.blocks - 1
AND e.block_id + e.blocks - 1 >= c.block#
UNION
SELECT s.owner, s.segment_type, s.segment_name, s.partition_name, c.file#
, header_block corr_start_block#
, header_block corr_end_block#
, 1 blocks_corrupted
, corruption_type||' Segment Header' description
FROM dba_segments s, v$database_block_corruption c
WHERE s.header_file = c.file#
AND s.header_block between c.block# and c.block# + c.blocks - 1
UNION
SELECT null owner, null segment_type, null segment_name, null partition_name, c.file#
, greatest(f.block_id, c.block#) corr_start_block#
, least(f.block_id+f.blocks-1, c.block#+c.blocks-1) corr_end_block#
, least(f.block_id+f.blocks-1, c.block#+c.blocks-1)
- greatest(f.block_id, c.block#) + 1 blocks_corrupted
, 'Free Block' description
FROM dba_free_space f, v$database_block_corruption c
WHERE f.file_id = c.file#
AND f.block_id <= c.block# + c.blocks - 1
AND f.block_id + f.blocks - 1 >= c.block#
order by file#, corr_start_block#; 

Tuesday 23 May 2017

Oracle Application Express (APEX) 5.x Installation With Oracle HTTP Server (OHS)

---Create a new tablespace to act as the default tablespace for APEX.
$sqlplus /as sysdba

-- For Oracle Managed Files (OMF).
SQL>CREATE TABLESPACE apex DATAFILE SIZE 1G AUTOEXTEND ON NEXT 100M;

-- For non-OMF.
SQL>CREATE TABLESPACE apex DATAFILE '/path/to/datafiles/apex01.dbf' SIZE 1G AUTOEXTEND ON NEXT 100M;

Remove the existing lower version of apex from database use below command.
---Uninstallation Process---

SQL>select * from dba_registry;

SQL>exit

$ cd $ORACLE_HOME/apex
$sqlplus /as sysdba

SQL>@apxremov.sql

SQL>exit

---Installation Process---

$ unzip apex_5.x.x_en.zip -d $ORACLE_HOME/

cd $ORACLE_HOME/apex

SQL>@apexins.sql APEX APEX TEMP1 /i/

SQL>@apxchpwd.sql

SQL> ALTER USER APEX_PUBLIC_USER IDENTIFIED BY myPassword ACCOUNT UNLOCK;

-----Installation and Configuration Oracle HTTP Server (OHS)----


----Login with oracle database user
#su - oracle

$mkdir -p /testsite/HTTP_Server ----software location
$mkdir -p /testsite/Oracle_WT ------Installation location

$ unzip ofm_webtier_ibm_aix_11.1.1.7.0_64_disk1_1of2 -d /testsite/HTTP_Server
$ unzip ofm_webtier_ibm_aix_11.1.1.7.0_64_disk1_2of2 -d /testsite/HTTP_Server

$cd /testsite/HTTP_Server

$ ls -l
Disk1
Disk2
Disk3
Disk4
Disk5

$cd Disk1

----Ignore Prerequisites.
$./runInstaller -ignoreSysPrereqs
$cd /testsite/Oracle_WT/Oracle_WT/instances/instance1/config/OHS/ohs1/mod_plsql

----Enter the below entry in the dads.conf file

Alias /i/ "/testsite/testdb/db/apex/images/"---Apex Image folder Location
<Location /apex>
   Order deny,allow
   PlsqlDocumentPath docs
   AllowOverride None
   PlsqlDocumentProcedure         wwv_flow_file_mgr.process_download
   PlsqlDatabaseConnectString     erptestappldb:1528:test ServiceNameFormat
   PlsqlNLSLanguage               AMERICAN_AMERICA.AL32UTF8
   PlsqlAuthenticationMode        Basic
   SetHandler                     pls_handler
   PlsqlDocumentTablename         wwv_flow_file_objects$
   PlsqlDatabaseUsername          APEX_PUBLIC_USER
   PlsqlDefaultPage               apex
   PlsqlDatabasePassword          myPassword
   PlsqlRequestValidationFunction wwv_flow_epg_include_modules.authorize
   PlsqlPathAlias                 i
   PlsqlPathAliasProcedure        wwv_flow.resolve_friendly_url
   Allow from all
</Location>

$cd Oracle_WT/Oracle_WT/instances/instance1/bin
$pwd
$ls -l
$./opmnctl stopall
$./opmnctl startall

----APEX should now be available from a URL like "http://machine:port/apex".--default port 7777