How to set an Oracle DB 10g to start automatically

Login to where the Oracle DB is installed and vi as root

[bash]vi /etc/oratab[/bash]

Edit the file, find and set the lines as follows:

[text]orcl:/u01/app/oracle/product/10.2.0/db_1:N[/text]
vi cmd to type Insert key
[text]orcl:/u01/app/oracle/product/10.2.0/db_1:Y[/text]
vi cmd Esc to exit editing
vi cmd to write/save and exit :wq

Edit dbora, which is mainly to set the ORA home and owner and execute the listener to start or stop

[bash]vi /etc/init.d/dbora #file will be created if it does not exist[/bash]

Edit the file and enter the following as specific to your ORA environment vars:

[text]#!/bin/sh
# description: Oracle auto start-stop script.
# # Set ORA_HOME to be equivalent to the $ORACLE_HOME
# from which you wish to execute dbstart and dbshut;
# # Set ORA_OWNER to the user id of the owner of the
# Oracle database in ORA_HOME.

ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_HOME PATH

ORA_HOME=/u01/app/oracle/product/10.2.0/db_1
ORA_OWNER=oracle

if [ ! -f $ORA_HOME/bin/dbstart ] then
echo “Oracle startup: cannot start”
exit fi

case “$1” in
‘start’)
# Start the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
su $ORA_OWNER -c “$ORA_HOME/bin/dbstart $ORA_HOME” ;
;

‘stop’)
# Stop the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
su $ORA_OWNER -c “$ORA_HOME/bin/dbshut $ORA_HOME” ;
;
esac[/text]

Set the appropriate privileges to the file:
[bash]chmod 750 /etc/init.d/dbora[/bash]

Notes:
May need to set in /u01/app/oracle/product/10.2.0/db_1/bin/dbstart
[text]ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle/bin/tnslsnr
to:
ORACLE_HOME_LISTNER=$ORACLE_HOME[/text]

…in some cases where the listener won’t start.

How to find the ORACLE_HOME path for Oracle DB 10g

Login to the server which you have the DB installed on
[bash]sqlplus /nolog #login to SQL*Plus console[/bash]
From SQL*Plus console:
[sql]conn user/pass as sysdba
var ohp varchar2(100);  –set a variable ‘ohp’
exec dbms_system.get_env(‘ORACLE_HOME’, &#58ohp) ; –call the get_env system-procedure
print ohp; –prinout the result[/sql]

You should then see an output print of the ORACLE_HOME path for the DB installed:

[sql]/u01/app/oracle/product/10.2.0/db_1[/sql]

 

count a column, then count the group -oracle reports

You want to the following report output (ProdA and ProdB are within same column):

Prod-Id | A | B | Subtotals
123 | 4  | 3 | 7
124 | 2 | 5 | 7

Columns: prod_id, prod_code, prod_type
Group by: prod_type

  1. After grouping your columns, create formulas for data A, B, All (within group-2):
    [sql]if :prod_code = ‘A’ then –set ‘B’ for second formula
    return 1; –counts 1 on every row of prod_code = ‘A’ (or ‘B’)
    end if;

    if :prod_code is not null then –find all items other than ‘A’ or ‘B’
    return 1; –counts 1 on every row of prod_code = null
    end if;[/sql]

  2. Create a Count for each data type A, B  (within group-1, reset at group-1)
  3. Do a Sum based on the “all items” Count (within group-1, reset at group-1)
  4. Place fields of steps 1,2,3 in a repeating region of group-1

You should have the results as seen in example above.

Oracle AS 10g R3 (10.1.3) install on linux CentOS 5.5

Oracle Application Server 10g Release 3 (10.1.3) installation on CentOS 5.5 (2.6.18-194.el5):

Using: rpm > install packages, vi > editing, cpio, unzip > unpack archives

  • Download and extract the OAS Suite cpio to i.e. /tmp/orainstall
  • Check that the following packages are installed on the system:
  • gcc-3.4.3-22.1
    gcc-c++-3.4.3-22.1
    openmotif21-2.1.30-11 (this failes on check, installs ok) (more…)