Saturday, January 7, 2012

How to use custom font on your website with CSS

With CSS (Cascading Style Sheets) you can easily use custom fonts on your website. You can use for logo or header or for whole website.

Let's see our font name is Mudir MT font. So in the css we need to add the following codes if we want to see this font as body of the HTML.

Step 01: Add following lines to your CSS.
@font-face {
 font-family: Mudir MT;
 src: url('mudir.TTF');
}

Step 02: Add font family to CSS Id/class.

body {
 word-wrap: break-word;
 margin: 0px;
 background-color: #e3e3e3;
        font-family: Mudir MT;
        font-weight: bold;
 
}

Now new font Mudir MT will be used on your website.

How to verify whether weblogic is installed in your server.

For many products installation at first you need to install Oracle web logic. For example,
you must have Oracle WebLogic Server 10.3.2 for installing Enterprise Manager Grid Control.

To verify whether Oracle WebLogic Server is installed, go to the Oracle home of the Oracle WebLogic Server.

For example in my case I see following output,
[oracle@av-mrp ~]$ cat /u03/Oracle/Middleware/logs/log.txt
Dec 13, 2011 4:17:44 PM -- install "WebLogic Platform" 10.3.5.0 at /u03/Oracle/Middleware
    release  10.3.5.0 [Added]
    |_____Common Infrastructure Engineering 7.2.0.0 [Added]
    |    |_____Uninstall [Added]
    |    |_____Patch Client [Added]
    |    |_____Patch Attachment Facility [Added]
    |    |_____Clone Facility [Added]
    |_____WebLogic Server 10.3.5.0 [Added]
    |    |_____Core Application Server [Added]
    |    |_____Administration Console [Added]
    |    |_____Configuration Wizard and Upgrade Framework [Added]
    |    |_____Web 2.0 HTTP Pub-Sub Server [Added]
    |    |_____WebLogic SCA [Added]
    |    |_____WebLogic JDBC Drivers [Added]
    |    |_____Third Party JDBC Drivers [Added]
    |    |_____WebLogic Server Clients [Added]
    |    |_____WebLogic Web Server Plugins [Added]
    |    |_____UDDI and Xquery Support [Added]
    |    |_____Server Examples [Not Installed]
    |    |_____Evaluation Database [Added]
    |    |_____Workshop Code Completion Support [Added]
    |_____Oracle Configuration Manager 10.3.3.1 [Added]
    |    |_____Data Collector [Added]
    |_____Oracle Coherence 3.6.0.4 [Added]
         |_____Coherence Product Files [Added]
         |_____Coherence Examples [Not Installed]
which indicates weblogic server is installed and following features/components added.

Thursday, January 5, 2012

Understanding ORA-1410 Error

In this post I will try to make you understand what is ROWID, the nature of the ORA-1410 error, the nature of a rowid, how you can get the error, and possible ways to investigate the error.

In the simplest case, ORA-1410 means simply that a rowid is invalid.

Whats is a Rowid

A rowid is a structure that allows direct access to a row. The rowid contains information on the object number, the datafile it is located in, the block number, and the slot number within the block.

Oracle 8 and greater version of Oracle has a rowid in this format:
OOOOOOFFFBBBBBBSSS
O=Data Object Number (length=6)
F=Relative File Number (length=3)
B=Block Number (length=6)
S=Slot Number (length=3)

The dbms_rowid package (rowid_info procedure) can be used to decode the rowid into its components.
The following anonymous PL/SQL block will decode any rowid you provide
In this case we are providing rowid as AAAYQKAAEAAAAPzAAA
SQL> select rowid from t1 where c1=1;

ROWID
------------------
AAAYQKAAEAAAAPzAAA

SQL> set serveroutput on
SQL> declare
  2          my_rowid rowid := 'AAAYQKAAEAAAAPzAAA';   -- or any rowid
  3          rowid_type number;
  4          object_number number;
  5          relative_fno number;
  6          block_number number;
  7          row_number number;
  8          begin
        dbms_rowid.rowid_info(my_rowid, rowid_type, object_number, relative_fno, block_number, row_number);
  9   10          dbms_output.put_line('ROWID:   ' || my_rowid);
 11          dbms_output.put_line('Object#:      ' || object_number);
 12          dbms_output.put_line('RelFile#:     ' || relative_fno);
 13          dbms_output.put_line('Block#:       ' || block_number);
 14          dbms_output.put_line('Row#:         ' || row_number);
 15          end;
 16          /
ROWID:   AAAYQKAAEAAAAPzAAA
Object#:      99338
RelFile#:     4
Block#:       1011
Row#:         0

PL/SQL procedure successfully completed.

In order to find the object name of this ID 99338 issue following statement:
SQL> col owner for a10
col object_name for a30
select owner,object_name,object_type,data_object_id
     from dba_objects
     where data_object_id = 99338;SQL> SQL>   2    3

OWNER      OBJECT_NAME                    OBJECT_TYPE         DATA_OBJECT_ID
---------- ------------------------------ ------------------- --------------
ARJU       T1                             TABLE PARTITION              99338

In order to find data file name (RelFile#: 4) issue:
SQL> select file_name
     from dba_data_files
     where file_id = 4;  2    3

FILE_NAME
--------------------------------------------------------------------------------
+DATA/moon/datafile/users.259.732901417

Reason of ORA-1410
When Oracle parses the rowid (to get the file, block, and slot), if there is no row there, then Oracle throws an error ORA-1410.

- If the file and block are both valid, and the only problem is that the row slot does not exist, it returns the 'no rows selected' message.

- If any other part of the rowid has a problem, then the ORA-1410 is returned and may be cause for concern.

ORA-1410 is often linked with block corruption, because it can be one source of the error. However, there are other sources of the error.

This is a list of possible sources of ORA-1410 errors.
1. The rowid was manually entered incorrectly into a SQL statement. Or a customized PL/SQL procedure has faulty logic and generates an incorrect rowid.

2. The rowid was generated internally, but was corrupted while in memory.

3. The rowid was retrieved from an index, which was corrupt. If this is the case, you would expect to see other corruption errors accompanying the ORA-1410.

4. DDL on objects during long running queries which access those objects.. For example, rebuilding an index can cause the ORA-1410 if a SQL statement is accessing the index.

5. The rowid was valid, but the data block or datafile was corrupted (overwritten) so the block address may be wrong. If this is the case, you would expect to see other corruption errors accompanying the ORA-1410.

6. The rowid was valid but points to a block that was moved recently. This can occur due to timing, where a table was truncated while a SQL was in progress. Therefore, the SQL has a cached rowid, but the block was removed during the truncation. The same thing can happen if a table partition was exchanged while a SQL statement was running. In this case the file number changed and the SQL statement could report ORA-1410.

7. An Oracle Bug, OS bug, or other application bug.

Example of how ORA-1410 can occur
With a simple example, I will demonstrate of how ORA-1410 might occur.

- First create a simple table with one or two columns.
- Then insert a couple of rows and commit.
- Then display the rowids
-- Create a sample table. 
SQL> create table rowid_demo (col1 varchar(10), col2 varchar2(10));

Table created.

-- Insert rows into the sample tables. 
SQL> insert into rowid_demo values('value1','col2');

1 row created.

SQL> insert into rowid_demo values('value2','col2');

1 row created.

SQL> commit;

Commit complete.

-- Display the rowids 
SQL> select rowid from rowid_demo;

ROWID
------------------
AAAYQOAAEAAACmmAAA
AAAYQOAAEAAACmmAAB

From the above example we see there is two rows in the rowid_demo table with the following rowids:

AAAYQOAAEAAACmmAAA
AAAYQOAAEAAACmmAAB

Let's now play with these ROW IDs
From these two rowids we see last 3 digits are (which is slot number of 3 length) AAA and AAB. Let's increment the last rowid slot by 1 (so . . . . AAB becomes . . . . . .AAC), and select from the table using this non-existent rowid. Since we changed only the last value only slot number was changed so no rows were selected.

SQL> select * from rowid_demo where rowid='AAAYQOAAEAAACmmAAC';

no rows selected

Even changing last 3 digits to FFF returns "no rows selected".

SQL> select * from rowid_demo where rowid='AAAYQOAAEAAACmmFFF';

no rows selected

Now instead of slot number let's change the block number (length 6) and see what happens. Existing block number is AAACmm and lets change to FFFFmm.


SQL> select * from rowid_demo where rowid='AAAYQOAAEFFFFmmAAB';
select * from rowid_demo where rowid='AAAYQOAAEFFFFmmAAB'
*
ERROR at line 1:
ORA-01410: invalid ROWID

Now we see ORA-01410: invalid ROWID.

So we clearly see how ORA-01410 is generated. We see what happens in a corruption of the rowid. In the above example part of the rowid was overwritten by FFFF and it was the block address that was overwritten.

The overwrite can be caused by a few events:

1) A piece of C code wrote to memory it thought it owned. If the C code is Oracle’s, it is an Oracle bug. If the code is from the OS, it is a vendor (OS) bug. If the code is from an application, then we need to get in touch with the supplier of the application code. For Oracle Bugs, you will need to engage Oracle Support.

2) A flaw in memory, where hardware is failing, and a memory address is bad. Hopefully, we will see messages in the OS error logs to verify this.

3) A rowid was generated incorrectly, either by Oracle code, or by customized application code.


A corruption can occur not only on the rowid, but also on the object that holds a copy of the rowid (for example, an index), or on the table where the rowid points. If an index was corrupted, then the rowids in the index can have incorrect components, and will cause an ORA-1410 if it is used to access the data rows. Similarly, if the data component (table) was corrupted, then the block address may be overwritten, and a valid rowid from the index may not be able to find the block. The ORA-1410 will again occur.

The next step in the example is to demonstrate how changing the object can cause ORA-1410 even with a valid rowid.

In this example, we will truncate the table and see the effect on the rowid.
-- Show the two rowids in the table
SQL>  select rowid from rowid_demo;

ROWID
------------------
AAAYQOAAEAAACmmAAA
AAAYQOAAEAAACmmAAB

-- Select all columns from the table using one of the  rowids.

SQL> select * from rowid_demo where rowid='AAAYQOAAEAAACmmAAA';

COL1       COL2
---------- ----------
value1     col2
-- Now truncate the table

SQL> truncate table rowid_demo;

Table truncated.

-- Rerun the previous select statement using the known valid rowid.

SQL> select * from rowid_demo where rowid='AAAYQOAAEAAACmmAAA';
select * from rowid_demo where rowid='AAAYQOAAEAAACmmAAA'
              *
ERROR at line 1:
ORA-01410: invalid ROWID

In the above example, we see a common cause of the ORA-1410. A SQL statement has some rowid’s cached in memory, for selecting from a table. But the table is truncated in the interim, and all blocks in the table cease to exist. So on executing the select with the cached rowid, we see the ORA-1410.

The same thing happens if a table partition is exchanged, becoming a stand-alone table. In this case the file number has changed, and any SQL that was running and had rowid’s cached in memory, can get the ORA-1410.

ORA-00240: control file enqueue held for more than 120 seconds

- In the database everything seems frozen.
- All asmcmd, sqlplus commands seems hanged. startup and shutdown of database does not work. Even whenever I issue shutdown or startup command nothing is reported in Oracle alert log.
- After giving asmcmd command I enter into ASMCMD> command prompt but any command like cd or ls command in that prompt seems like hanged.

In the Oracle database Alert log we see the following entry:
RDBMS alertlog:
=====================
Wed Jan 04 14:38:35 2012
Errors in file /u01/app/oracle/diag/rdbms/bddipdc/bddipdc1/trace/bddipdc1_arc1_19498.trc (incident=206730):
ORA-00240: control file enqueue held for more than 120 seconds
Incident details in: /u01/app/oracle/diag/rdbms/bddipdc/bddipdc1/incident/incdir_206730/bddipdc1_arc1_19498_i206730.trc

bddipdc1_arc1_19498.trc
=====================
*** 2012-01-04 14:38:35.603
Incident 206730 created, dump file: /u01/app/oracle/diag/rdbms/bddipdc/bddipdc1/incident/incdir_206730/bddipdc1_arc1_19498_i206730.trc
ORA-00240: control file enqueue held for more than 120 seconds

...

*** 2012-01-04 14:52:40.058
The current process holds the control file enqueue for too long
Dump of the process state:
ksedsts()+461<-kcc_tac_callback()+143<-ksu_dispatch_tac()+1578<-ksvcheckwait()+936<-ksvworkwait()+1677<-ksvwait()+874<-ksvsubmit()+3856<-kfncSlaveSubmit()+480<-kfncFileDelete()+1092<-kfioDelete()+154<-ksfddel1()+734<-ksfddel()+190<-kcfdosf()+271<-krff_remove_fb_log()+1671
<-krfgdelfb1()+2401<-krfgdelfb()+16<-krareclaim()+2899<-krasreclaim()+255<-krasrfc()+1502<-krsi_dst_open()+4443<-krse_arc_spool()+23924<-krse_arc_driver_core()+1263<-krse_arc_driver()+308<-kcrrwkx()+2947<-kcrrwk()+287<-ksbabs()+465<-krsv_abs()+39<-ksbrdp()+923
<-opirip()+623<-opidrv()+603<-sou2o()+103<-opimai_real()+266<-ssthrdmain()+214<-main()+201<-__libc_start_main()+244<-_start()+36Current Wait Stack:
2: waiting for 'KSV master wait'
=0x0, =0x0, =0x0
wait_id=1002392 seq_num=10705 snap_id=4
wait times: snap=6 min 0 sec, exc=16 min 4 sec, total=16 min 4 sec
wait times: max=infinite, heur=16 min 7 sec
wait counts: calls=321 os=321
in_wait=1 iflags=0x1520
1: waiting for 'ASM file metadata operation'
msgop=0x10, locn=0x0, =0x0
wait_id=1002390 seq_num=10698 snap_id=2
wait times: snap=0.000000 sec, exc=0.000020 sec, total=16 min 7 sec
wait times: max=infinite, heur=16 min 7 sec
wait counts: calls=0 os=0
in_wait=1 iflags=0x1520
0: waiting for 'Disk file operations I/O'
FileOperation=0x4, fileno=0x0, filetype=0x2
wait_id=1002389 seq_num=10695 snap_id=1
wait times: snap=0.000000 sec, exc=0.000010 sec, total=16 min 7 sec
wait times: max=infinite, heur=16 min 7 sec
wait counts: calls=0 os=0
in_wait=1 iflags=0x15a0
There are 265 sessions blocked by this session.

........

*** 2012-01-04 14:52:58.078 4529 kcrr.c
ORA-00028: your session has been killed
ORA-00028: your session has been killed
ORA-00028: your session has been killed
ORA-00028: your session has been killed
ORA-00028: your session has been killed
error 28 detected in background process
OPIRIP: Uncaught error 447. Error stack:
ORA-00447: fatal error in background process
ORA-00028: your session has been killed

*** 2012-01-04 14:52:58.095
Exception [type: SIGSEGV, Address not mapped to object] [ADDR:0x60020730] [PC:0x1B3CDFF, kcrfatrm()+25] [flags: 0x0, count: 1]
DDE: Flood control is not active
Incident 208818 created, dump file: /u01/app/oracle/diag/rdbms/bddipdc/bddipdc1/incident/incdir_208818/bddipdc1_arc1_19498_i208818.trc
ORA-07445: exception encountered: core dump [kcrfatrm()+25] [SIGSEGV] [ADDR:0x60020730] [PC:0x1B3CDFF] [Address not mapped to object] []
ORA-00447: fatal error in background process
ORA-00028: your session has been killed

ssexhd: crashing the process...

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


+ASM1_diag_21197.trc
====================

System State 9  (2012-01-04 15:24:59.072)
~~~~~~~~~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~
1:                                      [DEAD]
2:  waiting for 'pmon timer'
3:  waiting for 'VKTM Logical Idle Wait'
4:  waiting for 'rdbms ipc message'
5:
6:  waiting for 'PING'
7:  waiting for 'rdbms ipc message'
8:  waiting for 'DIAG idle wait'
9:  waiting for 'rdbms ipc message'
10: waiting for 'ges remote message'
11: waiting for 'gcs remote message'
12: waiting for 'heartbeat monitor sleep'
13: waiting for 'rdbms ipc message'
14: waiting for 'rdbms ipc message'
15: waiting for 'rdbms ipc message'
16: waiting for 'rdbms ipc message'
17: waiting for 'rdbms ipc message'
18: waiting for 'buffer busy'
19: waiting for 'rdbms ipc message'
20: waiting for 'rdbms ipc message'
21: waiting for 'rdbms ipc message'
22: waiting for 'rdbms ipc message'
23: waiting for 'SQL*Net message from client'
24: waiting for 'ASM background timer'
25: waiting for 'ASM file metadata operation'
26: waiting for 'Disk file operations I/O'    <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    Cmd: PL/SQL Execute
27: waiting for 'no free buffers'
    Cmd: Select
28: waiting for 'ASM file metadata operation'
29: waiting for 'Disk file operations I/O'
    Cmd: PL/SQL Execute
30: waiting for 'ASM file metadata operation'
    Cmd: PL/SQL Execute
31: waiting for 'ASM file metadata operation'
32: waiting for 'ASM file metadata operation'[Enq FA-00000001-000000FF]
33: waiting for 'Disk file operations I/O'
    Cmd: PL/SQL Execute
34: waiting for 'ASM file metadata operation'
    Cmd: PL/SQL Execute
35: waiting for 'ASM file metadata operation'[Enq FA-00000001-000000FF]
36: waiting for 'ASM file metadata operation'
    Cmd: PL/SQL Execute
37: waiting for 'ASM file metadata operation'
38: waiting for 'ASM file metadata operation'
39: waiting for 'Disk file operations I/O'
    Cmd: PL/SQL Execute
40: waiting for 'ASM file metadata operation'
41: waiting for 'no free buffers'
    Cmd: Select
42: waiting for 'Disk file operations I/O'
    Cmd: PL/SQL Execute
43: waiting for 'ASM file metadata operation'
    Cmd: PL/SQL Execute
44: waiting for 'ASM file metadata operation'
45: waiting for 'no free buffers'
    Cmd: Select
46: waiting for 'no free buffers'
    Cmd: Select
47: waiting for 'PX Deq: Execute Reply'
    Cmd: Select
48: waiting for 'buffer busy'
    Cmd: Select
49: waiting for 'buffer busy'
    Cmd: Select
50: waiting for 'no free buffers'
    Cmd: Select
51: waiting for 'no free buffers'
    Cmd: Select
52: waiting for 'ASM file metadata operation'[Enq FA-00000001-000000FF]
53: waiting for 'ASM file metadata operation'
    Cmd: PL/SQL Execute
54: waiting for 'ASM file metadata operation'
55: waiting for 'buffer busy'
    Cmd: Select
56: waiting for 'ASM file metadata operation'
57: waiting for 'ASM file metadata operation'
58: waiting for 'Disk file operations I/O'
    Cmd: PL/SQL Execute
59: waiting for 'Disk file operations I/O'
    Cmd: PL/SQL Execute
60: waiting for 'ASM file metadata operation'
61: waiting for 'ASM file metadata operation'
62: waiting for 'ASM file metadata operation'
63: waiting for 'ASM file metadata operation'
    Cmd: PL/SQL Execute
64: waiting for 'ASM file metadata operation'[Enq FA-00000001-000000FF]
65: waiting for 'ASM file metadata operation'
    Cmd: PL/SQL Execute
66: waiting for 'ASM file metadata operation'[Enq FA-00000001-000000FF]
67: waiting for 'Disk file operations I/O'
    Cmd: PL/SQL Execute
68: waiting for 'ASM file metadata operation'
    Cmd: PL/SQL Execute
69: waiting for 'ASM file metadata operation'
70: waiting for 'Disk file operations I/O'
    Cmd: PL/SQL Execute
71: waiting for 'ASM file metadata operation'
    Cmd: PL/SQL Execute
72: waiting for 'ASM file metadata operation'[Enq FA-00000001-000000FF]
73: waiting for 'Disk file operations I/O'
    Cmd: PL/SQL Execute
74: waiting for 'ASM file metadata operation'
    Cmd: PL/SQL Execute
75: waiting for 'ASM file metadata operation'[Enq FA-00000001-000000FF]
76: waiting for 'Disk file operations I/O'
    Cmd: PL/SQL Execute
77: waiting for 'ASM file metadata operation'
    Cmd: PL/SQL Execute
78: waiting for 'ASM file metadata operation'
79: waiting for 'PX Deq: Execute Reply'
    Cmd: Select
80: waiting for 'buffer busy'
    Cmd: Select
81: waiting for 'no free buffers'
    Cmd: Select
82: waiting for 'ASM file metadata operation'
83: waiting for 'ASM file metadata operation'
84: waiting for 'buffer busy'
    Cmd: Select

Blockers
~~~~~~~~

                   Resource Holder State
   Enq FA-00000001-000000FF    25: waiting for 'ASM file metadata operation'
   Enq FA-00000001-000000FF    54: waiting for 'ASM file metadata operation'

Warning: The following processes have multiple session state objects and
may not be properly represented above :
   25:   26:   28:   29:   31:   32:   33:   35:   37:   38:   39:   40:   42:
   44:   52:   54:   56:   57:   58:   59:   60:   61:   62:   64:   66:   67:
   69:   70:   72:   73:   75:   76:   78:   82:   83:

Object Names
~~~~~~~~~~~~
Enq FA-00000001-000000FF

From the ASM alert log:
==========================
Wed Jan 04 14:38:35 2012
System State dumped to trace file /u01/app/grid/diag/asm/+asm/+ASM1/trace/+ASM1_diag_21197.trc 
Wed Jan 04 14:39:12 2012
System State dumped to trace file /u01/app/grid/diag/asm/+asm/+ASM1/trace/+ASM1_diag_21197.trc
Wed Jan 04 14:52:30 2012

............................

Wed Jan 04 15:00:47 2012
NOTE: ASM client bddipdc1:BDDIPDC disconnected unexpectedly.
NOTE: check client alert log.
NOTE: Process state recorded in trace file /u01/app/grid/diag/asm/+asm/+ASM1/trace/+ASM1_ora_19353.trc
Wed Jan 04 15:01:49 2012
NOTE: killing foreground process 37 (2472) for state cleanup
NOTE: killing foreground process 37 (2472) for state cleanup
NOTE: killing foreground process 37 (2472) for state cleanup


Cause of the Problem

This is severe Oracle bug which happened due to ARC process holding the controlfile and blocking other. In Oracle support Oracle identified this bug as follows:

Bug 10431994: ALL ASM OPERATIONS HUNG (NO FREE BUFFER/ASM FILE METADATA OPERATION)

Bug 10222719: DBMV2: ASM INSTANCE HANGS WITH RBAL PROCESS WAITS ON "NO FREE BUFFER"

This is ASM bug, so all related ASM operations like on database, grid are all hanged.

Solution of the Problem 

There is no workaround of this non-sense bug. However there is One off patch available patch 10222719 which you can download from Oracle support and apply in your environment.

However this issue is fixed in the following releases.

- 11.2.0.3
- 11.2.0.2.2 Patch Set Update
- 11.2.0.2.2 Grid Infrastructure Patch Set Update (GI PSU)
- 11.2.0.2 Grid Infrastructure Bundle 2
- 11.2.0.2 Bundle Patch 3 for Exadata Database
- 11.2.0.1 Bundle Patch 10 for Exadata Database
- 11.2.0.2 Patch 3 on Windows Platforms

ORA-00600: internal error code, arguments: [ktecgetsh-inc]

Problem Description
The following simple script fires Oracle bug. TERRIBLE ORACLE.
CREATE TABLE t1(c1 NUMBER, c2 NUMBER)
PARTITION BY RANGE(c1) (
PARTITION p1 VALUES LESS THAN(10), 
PARTITION p2 VALUES LESS THAN(20)) ENABLE ROW MOVEMENT;

INSERT INTO t1 VALUES(1,1);

COMMIT;

ALTER TABLE t1 SHRINK SPACE CASCADE;

ALTER TABLE t1 SPLIT PARTITION p1 AT(5) INTO (
PARTITION p1_1, PARTITION p1_2);

INSERT INTO t1 VALUES(4,4);

Here goes output of the above script execution.
SQL> CREATE TABLE t1(c1 NUMBER, c2 NUMBER)
  2  PARTITION BY RANGE(c1) (
  3  PARTITION p1 VALUES LESS THAN(10),
  4  PARTITION p2 VALUES LESS THAN(20)) ENABLE ROW MOVEMENT;

INSERT INTO t1 VALUES(1,1);

COMMIT;

ALTER TABLE t1 SHRINK SPACE CASCADE;

ALTER TABLE t1 SPLIT PARTITION p1 AT(5) INTO (
PARTITION p1_1, PARTITION p1_2);
Table created.

SQL> SQL>
1 row created.

SQL> SQL>
Commit complete.

SQL> SQL>
Table altered.

SQL> SQL>   2

Table altered.

SQL>
SQL> INSERT INTO t1 VALUES(4,4);
INSERT INTO t1 VALUES(4,4)
            *
ERROR at line 1:
ORA-00600: internal error code, arguments: [ktecgetsh-inc], [1], [], [], [],
[], [], [], [], [], [], []

Cause of the Problem
The problem occurred due to Oracle bug 7313847 which is not published.
ORA-600 [KTECGETSH-INC] ON INSERT. A memory corruption can be left after a shrink and split of a partitioned table. This corruption may raise ORA-600 [ktecgetsh-inc] or ora-10632.
The call stack is as follows:
ktecgetsh <- ktecgshx  <- ktspisc <- ktspgsp_cbk1 <- ktspgsp_cbk <- kdtgsp <- kdtgsph
       <- kdtgrs <- kdtInsRow <- insrow <- insdrv <- inscovexe
        <- insExecStmtExecIniE <- ngine <- insexe <- ngine <- opiexe
         <- kpoal8 <- opiodr <- ttcpip <- opitsk <- opiino
          <- opiodr <- opidrv <- sou2o <- opimai_real <- main
           <- start
This issue is memory corruption.

Solution of the Problem 1. Shutdown and restart the instance after the SPLIT partition operation (this will ensure that the in-memory data is reloaded from the dictionary).

2. Apply Patch 7313847 if available for your platform and version.

3. Upgrade to 11.2.0.2 or higher (the bug fix is included in 11.2.0.2 and above).

Wednesday, January 4, 2012

How to Debug a Shell Script Under Linux or UNIX

When things are not going according to your plan, then there is needed something to investigate in the scripts in order to determine which lines or in which phase issue is arrived. Bash provides extensive debugging features. In this topic I will discuss all possible debugging features which you can use in shell script under linux and unix.

Put entire Script in debugging mode by adding -x option to bash command
While executing the shell script using bash command just append -x option which will run the entire script in debug mode. Traces of each command plus its arguments are printed to standard output after the commands have been expanded but before they are executed.

Example:
Here goes my script.
[oracle@rac1 ~]$ cat test_debug.sh
#!/bin/bash
echo `date`
a=1
b=2
c=$(($a + $b ))
echo "$a + $b = $c"
Here goes the output whenever I run script in debugging mode by adding -x option to bash command.

[oracle@rac1 ~]$ bash -x test_debug.sh
++ date
+ echo Thu Jan 5 13:19:43 BDT 2012
Thu Jan 5 13:19:43 BDT 2012
+ a=1
+ b=2
+ c=3
+ echo '1 + 2 = 3'
1 + 2 = 3

Debugging on part of the script by adding set -x command inside the shell script
Use the set -x bash built-in command in order to activate debug on those portions of the script of which you suspect as troublesome zones. You can issue set +x command on those portions which you are sure there is no problem.

Here goes the script
[oracle@rac1 ~]$ cat test_debug.sh
#!/bin/bash
set -x # activate debugging from here
echo `date`
a=1
b=2
set +x # stop debugging from here
c=$(($a + $b ))
echo "$a + $b = $c"
Here I executed the script.
[oracle@rac1 ~]$ bash test_debug.sh
++ date
+ echo Thu Jan 5 13:35:44 BDT 2012
Thu Jan 5 13:35:44 BDT 2012
+ a=1
+ b=2
+ set +x
1 + 2 = 3

Replace standard shebang line within script
You can also replace the standard Sharp bang line inside the script.
The general she bang will look like,
#!/bin/bash
which can be replace by following lines of codes in order to activate debugging.
#!/bin/bash -xv
The -v option will prints shell input lines as they are read.

Tuesday, January 3, 2012

Williams Specialty Company eCommerce Web Site

Case Project—Statement of Work
Williams Specialty Company (WSC)
eCommerce Web Site

1.     System Description


Williams Specialty Company (WSC) is a small print and engraving organization.  When a customer requests a printing or engraving job the sales person must enter the information into the order database (1) type of job (print or engraving), (2) media (clothing, plague, or trophy) (3) media catalog number, and (4) content into the print/engraving request database.  The sales person then makes payment arrangements with the customer, which includes billing an existing customer, setting up an account for billing, or payment on delivery.  If a payment on delivery option is selected, the sales person requests and receives at least a 10 percent deposit.
WSC wants to provide a web site so that their clients can provide the order information through a website.  In addition, WSC wants to provide their entire catalog on the website.      
Only customers with valid customer numbers and passwords are able to enter the customer area. 

2.     Software Deliverables

2.1.    Description of Functionality

The application will provide the following functionality:
1.  Creation, modification, storage, and retrieval of order request information
2.  Creation, modification, storage, and retrieval of catalog information.
3.  Creation, modification, storage, and retrieval of purchase order information.
4.  Creation, modification, storage, and retrieval of user access information.
5.  Allows a customer to enter an order request into the database.
6.  Allows a customer to retrieve order request information.
7.  Allows the operations manager to retrieve a order information from the database
8.  Allows the operations manager to validate the purchase order
9.  Allows the operations manager to close out the print request.
10. Allows a customer to update their personal and billing information.

2.2.    List of major software components

  1. Access Control
  2. Database Management
  3. Customer Interface
  4. Operations Manager Interface and Business Rules

3.     Equipment and Hardware Requirements

  1. Small business network, with no more than 20 nodes
  2. Standard Windows 2000/XP workstations.
  3. MS Office 2000/XP, with MS Access
  4. MS Outlook 2000/XP

4.     Documentation

4.1.    User Documentation

The contractor shall supply basic training user manuals describing each of the operations in a MS Word document.

4.2.    Development Documentation

The contractor shall supply all Planning, Requirements, Design, and Source code.

5.     Testing

5.1.    Test Plan and Procedures

The contractor shall supply a test plan and procedures for each level of testing.

5.2.    Unit Test Case Results

The contractor shall supply the results of the unit tests.

5.3.    Integration Test Case Results

The contractor shall supply the results of the integration test.

5.4.    Acceptance Test Case Results

The contractor shall supply the results of the acceptance test. 

As sys user password reset shows ORA-01031: insufficient privileges

Problem Description
After connecting to sys user as sysdba system privilege whenever we want to unlock avsys user in Oracle Audit vault it raises ORA-01031: insufficient privileges like below.
SQL> conn / as sysdba
Connected.

SQL> alter user AVSYS account unlock;
alter user AVSYS account unlock
*
ERROR at line 1:
ORA-01031: insufficient privileges
Even reset password of AVDVA user also fails.
SQL> select GRANTEE from dba_role_privs where GRANTED_
and grantee not in ('DVSYS','AVSYS');  

GRANTEE
------------------------------
AVDVA

SQL> alter user avdva identified by avdva;
alter user avdva identified by avdva
                               *
ERROR at line 1:
ORA-01031: insufficient privileges
Cause of the Problem
Audit Vault is protected by Database Vault. In order to reset password and make account unlock for avsys user you need to connect to avdva user and then do the operation. The DV account manager username (in this case AVDVA) and password is specified when you install AV. This is the same password of Audit Vault Admin and Report manager. If you don't know it anymore the only method is to disable Database vault in the AV repository and then use a sysdba connection to change the password.

Here we know the password of avdva user.
SQL> conn avdva
Enter password:
Connected.
Now unlock the avsys user and reset the password.
SQL> alter user AVSYS account unlock;

User altered.

SQL> conn avsys/avsys
ERROR:
ORA-28001: the password has expired


Changing password for avsys
New password:
Retype new password:
Password changed
Connected.

Error Executing task start_collector: Internal Collector - CSDK layer error

Problem Description
While starting the DBAUD collector the following error occurs :

avctl start_collector -collname DBAUD_Collector -srcname DHAKA.COM

Error Executing task start_collector: Internal Collector DHAKA.COM:DBAUD_Collector Error

The collector log ($ORACLE_HOME/av/log/DBAUD_Collector_DHAKA.log) shows the following errors:
***** Started logging for 'AUD$ Audit Collector' ***** 

Dec 13, 2011 4:10:04 PM: 
***** Collector Name = DBAUD_Collector 

Dec 13, 2011 4:10:04 PM: 
***** Source Name = DHAKA.COM 

Dec 13, 2011 4:10:04 PM: 
***** Av Name = AV 

Dec 13, 2011 4:10:04 PM: 
***** Starting CB 

Dec 13, 2011 4:10:04 PM: 
Getting parameter |AUDAUDIT_DELAY_TIME|, got |20| 

Dec 13, 2011 4:10:04 PM: 
Getting parameter |AUDAUDIT_SLEEP_TIME|, got |5000| 

Dec 13, 2011 4:10:04 PM: 
Getting parameter |AUDAUDIT_ACTIVE_SLEEP_TIME|, got |1000| 

Dec 13, 2011 4:10:04 PM: 
Getting parameter |AUDAUDIT_MAX_PROCESS_RECORDS|, got |1000| 

Dec 13, 2011 4:10:04 PM: 
Getting parameter AUDAUDIT_SORT_POLICY, got |never| 

Dec 13, 2011 4:10:04 PM: 
***** CSDK inited OK 

Dec 13, 2011 4:10:04 PM: 
***** Src alias = SRCDB1 

INFO @ '05/05/2008 14:11:26 -6:00': 
***** SRC connected OK 

INFO @ '05/05/2008 14:11:26 -6:00': 
***** SRC data retireved OK 

INFO @ '05/05/2008 14:11:26 -6:00': 
***** Recovery done OK 

INFO @ '05/05/2008 14:11:26 -6:00': 
***** Initialization done OK 

ERROR @ '05/05/2008 14:11:26 -6:00': 
ORA-03113: end-of-file on communication channel 

ERROR @ '05/05/2008 14:11:26 -6:00': 
CSDK layer error 
ERROR @ '05/05/2008 14:11:26 -6:00': 
ORA-03114: not connected to ORACLE 

ERROR @ '05/05/2008 14:11:26 -6:00': 
ORA-03114: not connected to ORACLE 

ERROR @ '05/05/2008 14:11:26 -6:00': 
Collecting thread died with status 0 

INFO @ '05/05/2008 14:11:31 -6:00': 
Could not call Listener, NS error 12541, 12560, 511, 2, 0 
INFO @ '05/05/2008 14:11:37 -6:00': 
Could not call Listener, NS error 12541, 12560, 511, 2, 0 
INFO @ '05/05/2008 14:11:43 -6:00': 
Could not call Listener, NS error 12541, 12560, 511, 2, 0

Cause of the Problem
This issue is caused by Bug 6596328 - DBAUD COLLECTOR WON'T START WITH RAC SOURCE DB, INTERNAL ERROR, 2968.

Due to the above bug whenever the aud$ table contains rows having sessionid <= 0 the DBAUD collector throws errors during startup.

Solution of the Problem
Bug 6596328 is solved in version 10.2.3. If it is not possible to install AV 10.2.3 then workaround the problem by deleting the offending rows from aud$ :
SQL> select count(*) from sys.aud$ where sessionid <= 0; 

COUNT(*) 
---------- 
1 

SQL> delete from sys.aud$ where sessionid <= 0; 

1 row deleted


SQL> commit; 

commit completed

VALIDATE_AGENT_CMD must be declared ORA-06550 while starting up a Collector

Problem Description
When starting a collector the following error occurs:

avctl start_collector -srcname sqlserver -collname sqlserver_collector
Starting collector...
Error executing command start_collector
Internal Error

Log file agent_client-0.log shows the following errors:
Dec 9, 2011 2:38:38 PM Thread-18 SEVERE: Internal Error
Internal Error
at oracle.av.common.AuditException.toAuditException(AuditException.java:252)
at oracle.av.management.impl.HttpManagementAdaptor.getData(HttpManagementAdaptor.java:231)
mpiled Code))
at oracle.sysman.emSDK.svlt.EMRedirectFilter.doFilter(EMRedirectFilter.java:101)
.....
Nested Exception:
java.sql.SQLException: ORA-06550: line 1, column 51: PLS-00302: component 'VALIDATE_AGENT_CMD' must be declared ORA-06550: line 1, column 8: PL/SQL: Statement ignored
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java(Compiled Code))
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java(Compiled

Cause of the Problem
Oracle Audit Vault earlier releases of 10g is extremely buggy product. And the error occurred due to one of the bug. The full install of the agent for Windows 64 bit is in fact containing all the fixes of Audit Vault Bundle Patch 3 whereas on the Audit Vault Server the latest installed patch is Bundle Patch 2.

Starting with Bundle Patch 3 package DBMS_AUDIT_VAULT_AGENT_INSTALL has a new procedure : VALIDATE_AGENT_CMD. The agents patched to Bundle Patch 3 will execute commands using this procedure and if this does not exist on the AV Server the reported error will be encountered.

Solution of the Problem
Make sure that Bundle Patch 3 ( or newer) is installed on the Audit Vault Server. Better upgrade to Oracle Audit Vault Server (10.3) which can be downloaded from http://www.oracle.com/technetwork/database/audit-vault/downloads/index.html

Error executing command start_av null while starting Audit vault server.

Problem Description
While starting audit vault server it fails Error executing command start_av null. Collector with Internal error like below.

[oracle@av-mrp ~]$ avctl start_collector -collname DBAUD_Collector -srcname RAJSHAHI
Starting collector...
Error executing command start_collector
Internal Error

[oracle@av-mrp ~]$ avctl show_av_status
TZ set to Asia/DaccaOracle Audit Vault 10g Database Control Release 10.2.3.2.6
Copyright (c) 2006, 2009 Oracle Corporation.  All rights reserved.
http://av-mrp:5700/av
Oracle Audit Vault 10g is not running.
------------------------------------

Logs are generated in directory /u01/oracle/product/10.2.3/av_1/av/log

[oracle@av-mrp ~]$ avctl start_av
Error executing command start_av
null
Cause of the Problem
The problem happened due to database is not registered to listener or listener is not started or database is not started.

Solution of the Problem
If there is no static entry in the listener then register the database with listener manually.
[oracle@av-mrp ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0 - Production on Tue Jan 3 14:23:52 2012

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area  536870912 bytes
Fixed Size                  2085288 bytes
Variable Size             390073944 bytes
Database Buffers          138412032 bytes
Redo Buffers                6299648 bytes
Database mounted.
Database opened.

[oracle@av-mrp ~]$ lsnrctl status

LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 03-JAN-2012 14:25:12

Copyright (c) 1991, 2007, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=av-mrp)(PORT=1521)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused

[oracle@av-mrp ~]$ lsnrctl start

LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 03-JAN-2012 14:25:17

Copyright (c) 1991, 2007, Oracle.  All rights reserved.

Starting /u01/oracle/product/10.2.3/av_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 10.2.0.4.0 - Production
System parameter file is /u01/oracle/product/10.2.3/av_1/network/admin/listener.ora
Log messages written to /u01/oracle/product/10.2.3/av_1/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=av-mrp)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 10.2.0.4.0 - Production
Start Date                03-JAN-2012 14:25:19
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/oracle/product/10.2.3/av_1/network/admin/listener.ora
Listener Log File         /u01/oracle/product/10.2.3/av_1/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=av-mrp)(PORT=1521)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

[oracle@av-mrp ~]$ avctl start_av
Error executing command start_av
null
[oracle@av-mrp ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0 - Production on Tue Jan 3 14:25:28 2012

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options

SQL> alter system register;

System altered.

SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options

[oracle@av-mrp ~]$ avctl start_av
Starting OC4J...
OC4J started successfully.
TZ set to Asia/DaccaOracle Audit Vault 10g Database Control Release 10.2.3.2.6
Copyright (c) 2006, 2009 Oracle Corporation.  All rights reserved.
http://av-mrp:5700/av
Oracle Audit Vault 10g is running.
------------------------------------

Logs are generated in directory /u01/oracle/product/10.2.3/av_1/av/log

How to start Collectors directly from AV agent environment

We can start the collector from audit vault server home by following command

$ avctl start_collector -collname DBAUD_Collector -srcname RAJSHAHI

However we can also start the collect from Audit Vault agent. An alternative way of starting the collectors from the AV Agent environment is the use of avaudcoll command. This method can be used to diagnose why the collectors cannot be started with the avctl start_collector command.

Step 01: Go to the Agent Oracle Home and set the ORACLE_HOME to point to agent's home. If you set environmental variable in a file you can simply run that file to set all environmental variables.

Step 02: Change path to the bin directory,
cd $ORACLE_HOME/bin

Step 03:
Start the DBAUD Collector:

$avaudcoll sourcename={the source name} collectorname={the name of the collector} avname={the alias of the AV Server database} hostname={hostname of the source DB} command=start

Start the OSAUD Collector:

$avoscoll sourcename={the source name} collectorname={the name of the collector} avname={the alias of the AV Server database} hostname={hostname of the source DB} command=start