Monday 25 March 2013

Startup and Shutdown services in Oracle Applications


Startup / Shutdown Apps 

In our next topic in learning Oracle Apps DBA , this post covers startup & shutdown of Oracle Application DBA

As you are aware by now there is Database Tier ( Database & DB Listener ) and Application Tier ( WebServer, Forms, Reports, Concurrent Manager, Discoverer, Apps Listener, OnetoOne Fullfillment Server )

Order of StartUp of Services Should be 
First DB Listener, Database & then Application Tier Services

Order of ShutDown of Services Should be
First Application Tier Services then Database & DB Listener

Database Startup/Shutdown Scripts
Depending on your AD Version these will be in ORACLE_HOME / appsutil/scripts /SID_hostname
addbctl.sh database startup shutdown script
addlnctl.sh database listener Script 

Where 

AD is for Application DBA
DB is for database
DLN is database listener
CTL is control

Isn't this easy to remeber ( Thanks to Oracle for naming convention)

-----
Application Tier Startup/Shutdown Scripts
Depending on your AD Version these will be in

OAD_TOP/admin/scripts/ SID_hostname

adalnctl.sh Apps Listener Control Script
adapcctl.sh Apache/Web Server Control Script
adcmctl.sh Concurrent Manager Control Script
addisctl.sh Discoverer Control Script
adfrmctl.sh Forms server Control Script
adrepctl.sh Report Server Control Script
adstpall.sh Stop All Middle/Application Tier
adstrtall.sh Start All Middle/Application Tier

Where AD & CTL you already know now :) isn't it

adl stand for Apps Listener
apc stand for Apache
cm Concurrent Manager
dis Discoverer
frm forms
rep report

AppsDBA Basics(Architecture)


This Topic is quite important and I recommend you to go through this thoroughly.

First I want to discuss terminology which you will encounter here & in most of Oracle Documentation.

Server - is a process or group of processes and provides a particular functionality/service For example, Database Server listen and process database requests, similarly Web Server listens for and processes HTTP requests.

Tier - is a logical grouping of services, may be on single machine or spread across more than one physical machine. For Example, Middle Tier in Oracle apps consist Form,Web,Report...Services. Forms & Report can be one machine 1 & Web Server can be on machine 2, still they will be part of same tier called as Application Tier or Middle Tier.

Node - is referred as Machine, Each tier may consist of one or more node and each node can potentially have more than one tier.

Desktop Tier - Oracle Applications/E-Business Suite is built on three tier Architecture with first Desktop Tier ic client machines accessing applications via browser(HTML based Self service applications) or Java Applet(Jinitiator) for Form based interface.

Application/Middle Tier - Second is Application Tier also called as middle tier consists of WebServer Forms, Reports, Concurrent processing, Discoverer and Admin Server. I suppose its known as Middle tier because it lies between our desktop & third tier called database tier.

Database Tier - Third is Database Tier contain Orale database server which store all your application data. I am sure if you are DBA you know it :)

AUTOMATIC STORAGE MANAGEMENT (ASM)


AUTOMATIC STORAGE MANAGEMENT (ASM)
Automatic Storage Management (ASM) is a concept to administer Oracle related files by efficiently referencing disks as raw devices or by using the ASMLib software. This article presents the setup details for using either raw devices or ASMLib.
The ASM functionality is an extention of the Oracle Managed Files (OMF) functionality.It includes striping and mirroring to provide storage solutions with high level of redundancy. To use ASM functionality we need to configure an ASM instance(which is apparently not a full database instance,but just the memory structures).
In summary ASM provides the following functionality:
* Manages groups of disks, called disk groups.
* Manages disk redundancy within a disk group.
* Provides near-optimal I/O balancing without any manual tuning.
* Enables management of database objects without specifying mount points and filenames.
* Supports large files.
The ASM instance shares the Oracle home with the database instance. If you plan on running multiple database instances on the server the ASM instance should be installed in a separate Oracle home.
ASM can be configured using two methods of creating disks:
a) Using asmlib
b) Using rawdevices.
Before we proceed with the installation/configuration of ASM,it is always better to skid through the below contents,and make yourself aware of the same:
1) DISK PARITIONING:
A) To check the paritions available on your machine,use the command –> fdisk -l
B) To parition the current available filesystem,follow the below:
# fdisk /dev/sda
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won’t be recoverable.
The number of cylinders for this disk is set to 1305.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0×0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1305, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1305, default 1305):
Using default value 1305
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
#
c) To delete a current existing partition,use the below
fdisk /dev/sda
and then option “d”
2) RAW DEVICES:
It is important that if you use raw devices,then you are required to register the raw devices in /etc/sysconfig/rawdevices file ,and then you start the raw devices.
Edit the /etc/sysconfig/rawdevices file, adding the following lines.
/dev/raw/raw1 /dev/sda1
/dev/raw/raw2 /dev/sda2
/dev/raw/raw3 /dev/sda3
NOTE: Ensure that df -h ,won’t show up the above devices.If they are mounted,then these devices can’t be used to create an ASM Instance.
Once,you edit the /etc/sysconfig/rawdevices file,then you can start/enable/stop/disable your rawdevices using the following command:
service rawdevices restart
3) ASM Logs:
Logfile location to monitor issues while ASM creation –> /var/log/oracleasm
*oracleasm is the filename
–> Now that we made ourselves aware of few commands required while creating an ASM instance.Let us proceed with ASM instance creation.
PARTITION DISKS
Both ASMLib and raw devices require the candidate disks to be partitioned before they can be accessed.
Example:
# ls sd*
sda sda1 sda2 sdb sdc sdd
# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won’t be recoverable.
The number of cylinders for this disk is set to 1305.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0×0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1305, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1305, default 1305):
Using default value 1305
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
#
The remaining disks (“/dev/sdc” and “/dev/sdd”) must be partitioned in the same way.
NOTE : Ensure that after paritioning you use either asmlib to create disks or create rawdevices and assign them as ASM disks later using DBCA.
ASMLIB INSTALLATION
This step is only necessary if you want to use ASMLib to access the ASM disks.
Determine your kernel version using the following command as the root user.
# uname -r
2.6.9-34.ELsmp
#
Download the ASMLib software from the OTN website, making sure you pick the version that matches your distribution, kernel and architecture. For this example I used CentOS 4.3, so the following packages were required:
• oracleasm-support-2.0.1-1.i386.rpm
• oracleasmlib-2.0.1-1.i386.rpm
• oracleasm-2.6.9-34.ELsmp-2.0.1-1.i686.rpm
Install the packages as the root user.
#Install the packages with the below commands:
rpm -Uvh oracleasm-support-2.0.1-1.i386.rpm
rpm -Uvh oracleasmlib-2.0.1-1.i386.rpm
rpm -Uvh oracleasm-2.6.9-34.ELsmp-2.0.1-1.i686.rpm
#To check what packages/drivers are installed on your system, use the below command:
rpm –qa | grep –i oracleasm
With the software installed, configure the ASM kernel module.
# /etc/init.d/oracleasm configure
Configuring the Oracle ASM library driver.
This will configure the on-boot properties of the Oracle ASM library
driver. The following questions will determine whether the driver is
loaded on boot and what permissions it will have. The current values
will be shown in brackets (‘[]‘). Hitting without typing an
answer will keep that current value. Ctrl-C will abort.
Default user to own the driver interface []: oracle
Default group to own the driver interface []: oinstall
Start Oracle ASM library driver on boot (y/n) [n]: y
Fix permissions of Oracle ASM disks on boot (y/n) [y]:
Writing Oracle ASM library driver configuration: [ OK ]
Creating /dev/oracleasm mount point: [ OK ]
Loading module “oracleasm”: [ OK ]
Mounting ASMlib driver filesystem: [ OK ]
Scanning system for ASM disks: [ OK ]
#
Once the kernel module is loaded, stamp (or label) the partitions created earlier as ASM disks.
# /etc/init.d/oracleasm createdisk VOL1 /dev/sda1
Marking disk “/dev/sdb1 as an ASM disk: [ OK ]
# /etc/init.d/oracleasm createdisk VOL2 /dev/sdb1
Marking disk “/dev/sdc1 as an ASM disk: [ OK ]
# /etc/init.d/oracleasm createdisk VOL3 /dev/sdc1
Marking disk “/dev/sdd1 as an ASM disk: [ OK ]
#
If this were a RAC installation, the disks would only be stamped by one node. The other nodes would just scan for the disks.
# /etc/init.d/oracleasm scandisks
Scanning system for ASM disks: [ OK ]
#
The stamped disks are listed as follows.
# /etc/init.d/oracleasm listdisks
VOL1
VOL2
VOL3
#
The disks are now ready to be used by ASM.
To administer the Automatic Storage Management library driver and disks, use the oracleasm initialization script with different options, as follows:
# /etc/init.d/oracleasm configure
# /etc/init.d/oracleasm enable
# /etc/init.d/oracleasm restart
# /etc/init.d/oracleasm createdisk DISKNAME devicename
# /etc/init.d/oracleasm deletedisk DISKNAME
Caution: Do not use this command to unmark disks that are being used by an Automatic Storage Management disk group. You must drop the disk from the Automatic Storage Management disk group before you unmark it.
querydisk
Use the querydisk option to determine whether a disk device or disk name is being used by the Automatic Storage Management library driver:
# /etc/init.d/oracleasm querydisk {DISKNAME | devicename}
listdisks
Use the listdisks option to list the disk names of marked Automatic Storage Management library driver disks:
# /etc/init.d/oracleasm listdisks
scandisks
Use the scandisks option to enable cluster nodes to identify which shared disks have been marked as Automatic Storage Management library driver disks on another node:
# /etc/init.d/oracleasm scandisks
Raw Device Setup
This step is only necessary if you want ASM to access the disks as raw devices.
Edit the /etc/sysconfig/rawdevices file, adding the following lines.
/dev/raw/raw1 /dev/sda1
/dev/raw/raw2 /dev/sdb1
/dev/raw/raw3 /dev/sdc1
Restart the rawdevices service using the following command.
root@localhost ~]# service rawdevices restart
Assigning devices:
/dev/raw/raw1 –> /dev/sda1
/dev/raw/raw1: bound to major 8, minor 3
/dev/raw/raw2 –> /dev/sdb1
/dev/raw/raw2: bound to major 8, minor 7
/dev/raw/raw3 –> /dev/sdc1
/dev/raw/raw3: bound to major 8, minor 8
done
[root@localhost ~]#
Run the following commands and add them the /etc/rc.local file.
chown oracle:oinstall /dev/raw/raw1
chown oracle:oinstall /dev/raw/raw2
chown oracle:oinstall /dev/raw/raw3
chmod 600 /dev/raw/raw1
chmod 600 /dev/raw/raw2
chmod 600 /dev/raw/raw3
The ASM raw device disks are now configured.
ASM CREATION:
Creation of the ASM instance is the same, regardless of the use of ASMLib or raw devices. When using ASMLib, the candidate disks are listed using the stamp associated with them, while the raw devices are listed using their device name.
To configure an ASM instance, start the Database Configuration Assistant by issuing the “./runInstaller” command as the oracle user. On the “Welcome” screen, click the “Next” button.
Select the “Advanced Installation”, then click the “Next” Button.
Select the “Configure Automatic Storage Management” option, then click the “Next” Button.
On the next page, when using raw devices, the candidate discs are listed using the device names. So check the devices and redundancy (High, normal and external) as per your requirement.
click on “change disk discovery path” and search with string –> /dev/raw/* (Only for linux)
On the “ASM Disk Groups” screen. Click the “Finish” button.
Click the “Yes” button to perform another operation.
You are now ready to create a database instance using ASM.
ASM Instance creation:
After you configure the kernel parameters and Bash profile, performing the following.
$ export ORACLE_SID=+ASM
$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 – Production on Sat Jul 6 14:01:06 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 – Production
With the Partitioning, OLAP and Data Mining options
SQL> alter system register;
System altered.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 – Pr oduction
With the Partitioning, OLAP and Data Mining options
$
DATABASE CREATION:
Go back to the DBCA and create a custom database in the normal way, selecting the “Automatic Storage Management (ASM)” storage option.
· Enter the ASM password if prompted, then click the “OK” button.
· Select the “DATA” disk group, then clicking the “Next” button.
· Accept the default “Oracle-Managed Files” database location by clicking the “Next” button.
· Enable the “Flash Recovery Area” and Archiving, using the “+DATA” disk group for both.
Continue with the rest of the DBCA, selecting the required options along the way.
To create an ASM instance first create a file called init+ASM.ora in the /tmp directory containing the following information.
INSTANCE_TYPE=ASM
Next, using SQL*Plus connect to the ide instance.
export ORACLE_SID=+ASM
sqlplus / as sysdba
Create an spfile using the contents of the init+ASM.ora file.
SQL> CREATE SPFILE FROM PFILE=’/tmp/init+ASM.ora’;
File created.
Finally, start the instance with the NOMOUNT option.
SQL> startup nomount
ASM instance started
Total System Global Area 125829120 bytes
Fixed Size 1301456 bytes
Variable Size 124527664 bytes
Database Buffers 0 bytes
Redo Buffers 0 bytes
SQL>
The ASM instance is now ready to use for creating and mounting disk groups. To shutdown the ASM instance issue the following command.
SQL> shutdown
ASM instance shutdown
SQL>
Once an ASM instance is present disk groups can be used for the following parameters in database instances (INSTANCE_TYPE=RDBMS) to allow ASM file creation:
* DB_CREATE_FILE_DEST
* DB_CREATE_ONLINE_LOG_DEST_n
* DB_RECOVERY_FILE_DEST
* CONTROL_FILES
* LOG_ARCHIVE_DEST_n
* LOG_ARCHIVE_DEST
* STANDBY_ARCHIVE_DEST
Refference:


What to do if my Global Inventory is corrupted ?


What to do if my Global Inventory is corrupted ?
No need to worry if your global Inventory is corrupted, you can recreate global Inventory on machine using Universal Installer and attach already Installed oracle home by option
-attachHome
./runInstaller -silent -attachHome -invPtrLoc $location_to_oraInst.loc
ORACLE_HOME=”Oracle_Home_Location” ORACLE_HOME_NAME=”Oracle_Home_Name”
CLUSTER_NODES=”{}”