Friday, September 23, 2005

Oracle's 10g ASM implementation on CentOS 4.1 (RHEL 4 U1)


Actually there are several nice articles on Oracle Technical Network
devoted to the same topic. What’s new may be said ?
The target of publication is to highlight the optimal sequence of steps
required to bring Oracle10g (10.2.0.1) ASM-database up on CentOS4.1,
placing ASM instance and serviced databases in different Oracle Homes.
Oracleasm library install is done immediately after creating "oracle"
linux account and "dba" group to be ready for ASM Instance creating during
the first Installer run supposed to build it. ASM instance for disks and disk’s
group management is created the first by Installer along with the disk’s group
for database supposed to be built during the second run of Installer and to be
placed into recently created disk’s group.

I. Oracle 10gR2 ASM and ASMLib 2.0 I/O.

1.Install CentOS 4.1

2.Run as root:



# groupadd dba # group of users to be granted SYSDBA system privilege
# groupadd oinstall # group owner of Oracle files
# useradd -c "Oracle software owner" -g oinstall -G dba oracle
# passwd oracle
# mkdir -p /u01/app/oracle
# chown -R oracle.oinstall /u01
# mkdir -p /u02/oradata/wtfdata
# chown -R oracle.oinstall /u02




OTN instruction:-
Before installing Automatic Storage Management, it is recommended that you install
the optional add-on Automatic Storage Management support library, ASMLib.
ASMLib is an application program interface (API) Oracle that is aimed at simplifying
the interface between the operating system and the database, and to exploit
the capabilities and strengths of storage arrays provided by different vendors.
ASMLib provides an alternative interface for the Automatic Storage Management-enabled kernel to discover and access block devices. It provides storage and operating system vendors the opportunity to supply extended storage-related features.
These features provide benefits such as improved performance and greater data integrity.
OTN instruction ends.


3.To install ASMLIB 2.0 run as root:-



# rpm -Uvh oracleasm-2.6.9-11.ELsmp-2.0.0-1.i686.rpm oracleasmlib-2.0.0-1.i386.rpm oracleasm-support-2.0.0-1.i386.rpm




Now you get /etc/init.d/oracleasm ready to go.

Configuring the Oracle ASM library driver:-



# /etc/init.d/oracleasm configure
Default user to own the driver interface [oracle]: oracle
Default group to own the driver interface [dba]: dba
Start Oracle ASM library driver on boot (y/n) [y]: y
Fix permissions of Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: [ OK ]
Scanning system for ASM disks: [ OK ]


# /etc/init.d/oracleasm enable




Create ASM disks as desired utilizing command:


# /etc/init.d/oracleasm createdisk VLM0X /dev/sdx






Tune /etc/sysctl.conf,/etc/security/limits.conf,/etc/pam.d/login, /etc/profile
and oracle's shell environment as advised in [1].

Login as oracle:-



$ cd /tmp/database
$./runInstaller






OTN instructions:-
It’s recommended that you install Automatic Storage Management in its own Oracle home, regardless of whether you plan to only have one or multiple database instances.
Installing Automatic Storage Management in its own Oracle home helps ensure higher
availability and manageability.With separate Oracle homes, you can upgrade Automatic Storage Management and databases independently, and you can remove database software without impacting the Automatic Storage Management instance. Ensure that the Automatic Storage Management version is the same or later than the Oracle Database version.If an Automatic Storage Management installation does not already exist and you select the Oracle Universal Installer option to install and configure Automatic Storage Management only, then Oracle Universal Installer installs Automatic Storage Management in its own Oracle home.
OTN instruction ends.



Select " Advanced installation" and create ASM instance in
$ORACLE_HOME=/u01/app/oracle/oracle/product/10.2.0/db_1

Create disk group during this run .

Exit installer.


$ ./runInstaller






Select " Advanced installation" and create new ASM-database placed into existing disk's group

in $ORACLE_HOME=/u01/app/oracle/oracle/product/10.2.0/db_2 .
Modify ~oracle/.bash_profile correspondently. Relogin as oracle.

Next:-



$ sqlplus /nolog
SQL> conn / as sysdba
Connected.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.

Total System Global Area 285212672 bytes
Fixed Size 1218968 bytes
Variable Size 88082024 bytes
Database Buffers 188743680 bytes
Redo Buffers 7168000 bytes
Database mounted.

SQL> alter database archivelog;
Database altered.
SQL> alter database MastDB flashback on;
Database altered.
SQL> alter database open;
Database altered.




Open Enterpise Manager console.(Enterprise Manager 10g Database Control URL

http://ServerCentOS41:1158/em). Create new disk's group for flashback

recovery area and modify corresponding value on Recovery Settings page of EM.

System startup in this case should look like:-



[oracle@ServerCentOS41 ~]$ ./lsnrstart
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 30-AUG-2005 17:57:41
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Starting /u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 10.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ServerCentOS41)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ServerCentOS41)(PORT=1521)))
------------------------
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 30-AUG-2005 17:57:42
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ServerCentOS41)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 30-AUG-2005 17:57:42
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Starting /u01/app/oracle/product/10.2.0/db_2/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 10.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/10.2.0/db_2/network/admin/listener.ora
Log messages written to /u01/app/oracle/product/10.2.0/db_2/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ServerCentOS41)(PORT=1522)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC2)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ServerCentOS41)(PORT=1522)))
------------------------
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 30-AUG-2005 17:57:42
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/10.2.0/db_2/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/10.2.0/db_2/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ServerCentOS41)(PORT=1522)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC2)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully




[oracle@ServerCentOS41 ~]$ dbstart

Processing ASM instance "+ASM": log file /u01/app/oracle/product/10.2.0/db_1/startup.log
Processing Database instance "MastDB": log file /u01/app/oracle/product/10.2.0/db_2/startup.log
[oracle@ServerCentOS41 ~]$ emctl start dbconsole


TZ set to US/Eastern
Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0
Copyright (c) 1996, 2005 Oracle Corporation. All rights reserved.
http://ServerCentOS41:1158/em/console/aboutApplication
Starting Oracle Enterprise Manager 10g Database Control .............. started.
-------------------------------------------------------------------------------
Logs are generated in directory /u01/app/oracle/oracle/product/10.2.0/db_2/ServerCentOS41_MastDB/sysman/log






Install described above was done with different Oracle Homes

for ASM instance and ASM-database.

To put ASM instance and ASM-database in same Oracle Home.

Start runInstaller just once to build all stuff at a time.

Login as oracle:-



$ cd /tmp/database
$./runInstaller




Select " Advanced option" and install "Software only"

in ORACLE_HOME - /u01/app/oracle/oracle/product/10.2.0/db_1.
Modify oracle's .bash_profile:-
export ORACLE_HOME and new PATH.
Source new .bash_profile:-


$. ~oracle/.bash_profile
$dbca






During this run the request to start CSS daemons by root will come up.



# $ORACLE_HOME/bin/localconfig add






ASM instance , needed disk's groups and ASM-database itself will be created.
Then perform listener and local TNS names configuration.


$netca






II. Oracle 10gR2 ASM and Standard Linux I/O.


This method creates Oracle database files on raw character devices managed by ASM
using standard Linux I/O system calls.It requires to create RAW devices for all
disk partitions used by ASM.


1.Install CentOS 4.1

2.Run as root:


 
# groupadd dba # group of users to be granted SYSDBA system privilege
# groupadd oinstall # group owner of Oracle files
# useradd -c "Oracle software owner" -g oinstall -G dba oracle
# passwd oracle
# mkdir -p /u01/app/oracle
# chown -R oracle.oinstall /u01
# mkdir -p /u02/oradata/data
# chown -R oracle.oinstall /u02




Just as an example create 4 partitions:

/dev/hda6,/dev/hdc6 5 GB each one

/dev/hda7,/dev/hdc7 3 GB each one

Create raw devices modifying file /etc/sysconfig/rawdevices as follows:

/dev/raw/raw1 /dev/hda6

/dev/raw/raw2 /dev/hdc6

/dev/raw/raw3 /dev/hda7

/dev/raw/raw4 /dev/hdc7

Put in /etc/rc.d/rc.local

chown oracle:dba /dev/raw/raw*

chmod 660 /dev/raw/raw*

I was experiencing problems with loosing "oracle:dba" permissions after Linux
reboot. Oracle's raw device came up with "root:disk" ownership after reboot.


Restart Linux

Run as root:-



# service rawdevices restart






Tune /etc/sysctl.conf,/etc/security/limits.conf,/etc/pam.d/login,

/etc/profile and oracle's shell environment as advised in [1].



Login as oracle:-


 
$ cd /tmp/database
$./runInstaller




Select " Advanced installation" and
create ASM instance in ORACLE_HOME=/u01/app/oracle/oracle/product/10.2.0/asm
During this run create diskgroup RAWDATA1 with normal redundancy
mirroring /dev/raw/raw1 and /dev/raw/raw2.You should be fine with discovering raw devices unless permissions "oracle:dba" are lost
Exit installer.

Export ORACLE_HOME for ASM instance and corresponding PATH.
Then run "dbca" to create diskgroup RAWDATA2 with
normal redundancy mirroring /dev/raw/raw3 and /dev/raw/raw4

  
$ ./runInstaller






Select " Advanced installation" and create new ASM-database placed RAWDATA1 diskgroup

in $ORACLE_HOME=/u01/app/oracle/oracle/product/10.2.0/db_1.
Modify ~oracle/.bash_profile correspondently.Relogin as oracle.
Next:-


  
$ sqlplus /nolog
SQL> conn / as sysdba
Connected.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 285212672 bytes
Fixed Size 1218968 bytes
Variable Size 88082024 bytes
Database Buffers 188743680 bytes
Redo Buffers 7168000 bytes
Database mounted.
SQL> alter database archivelog;
Database altered.
SQL> alter database rawdbs flashback on;
Database altered.
SQL> alter database open;
Database altered.




Open Enterpise Manager console.(Enterprise Manager 10g Database Control

URL http://ServerCentOS41:1158/em). Put flashback recovery area in RAWDATA2

modifying corresponding value on Recovery Settings page of EM.



References.

1.www.puschitz.com/InstallingOracle10g.shtml