Moneycontrol Brokerage Recos

Thursday, January 29, 2015

Step by Step Oracle 10g Automatic Storage Management Setup

Automatic Storage Management:
=====================
Automatic Storage Management (ASM) is an integrated file system and volume manager expressly built for Oracle database files. ASM provides the performance of raw I/O with the easy management of a file system. It simplifies database administration by eliminating the need for you to directly manage potentially thousands of Oracle database files. It does this by enabling you to divide all available storage into disk groups. You manage a small set of disk groups and ASM automates the placement of the database files within those disk groups.

In the SQL statements that you use for creating database structures such as tablespaces, control files, and redo and archive log files, you specify file location in terms of disk groups. ASM then creates and manages the associated underlying files for you.


Why we need Automatic Storage Management to be implemented:


  • If we want to have a file bigger than the disk/mount.
  • For the best I/O throughput operations.
  • To save file system administration cost
  • For disk fault tolerance etc.


Note: I suppose, already you have your Linux machine ready and Oracle 10g RDBMS binaries installed in there.

1. First create a directory to hold raw disks on a particular location.

$ mkdir /u01/asmdisks


2. Create RAW partitions:

Note: Here I have used raw devices that have been using traditionally. We have some drawbacks of using raw devices like if our raw disk is 10GB in size and the file stored in it is 5GB then remaining 5GB space can't be reclaimed and would be a waste of storage and it has high maintenance costs.

-------------------------
[root@ora10srv bin]# dd if=/dev/zero of=/u01/asmdisks/disk1 bs=1024k count=1000
1000+0 records in
1000+0 records out

[root@ora10srv bin]# dd if=/dev/zero of=/u01/asmdisks/disk2 bs=1024k count=1000
1000+0 records in
1000+0 records out

[root@ora10srv bin]# dd if=/dev/zero of=/u01/asmdisks/disk3 bs=1024k count=1000
1000+0 records in
1000+0 records out

[root@ora10srv bin]# dd if=/dev/zero of=/u01/asmdisks/disk4 bs=1024k count=1000
1000+0 records in
1000+0 records out

-------------------------
[root@ora10srv bin]# /sbin/losetup /dev/loop1 /u01/asmdisks/disk1

[root@ora10srv bin]# /sbin/losetup /dev/loop2 /u01/asmdisks/disk2

[root@ora10srv bin]# /sbin/losetup /dev/loop3 /u01/asmdisks/disk3

[root@ora10srv bin]# /sbin/losetup /dev/loop4 /u01/asmdisks/disk4

-------------------------
[root@ora10srv bin]# raw /dev/raw/raw1 /dev/loop1
/dev/raw/raw1:  bound to major 7, minor 1

[root@ora10srv bin]# raw /dev/raw/raw2 /dev/loop2
/dev/raw/raw2:  bound to major 7, minor 2

[root@ora10srv bin]# raw /dev/raw/raw3 /dev/loop3
/dev/raw/raw3:  bound to major 7, minor 3

[root@ora10srv bin]# raw /dev/raw/raw4 /dev/loop4
/dev/raw/raw4:  bound to major 7, minor 4


Now, we need to change the permission for oracle user on the raw disks created above.

[oracle@ora10srv raw]$ cd /dev/raw

[oracle@ora10srv raw]$ chown -R oracle:oinstall *

[oracle@ora10srv raw]$ chmod 660 *

[oracle@ora10srv raw]$ ls -ltr
total 0
crw-rw----  1 oracle oinstall 162, 1 Jan 28 13:39 raw1
crw-rw----  1 oracle oinstall 162, 2 Jan 28 13:39 raw2
crw-rw----  1 oracle oinstall 162, 3 Jan 28 13:39 raw3
crw-rw----  1 oracle oinstall 162, 4 Jan 28 13:40 raw4


3. Before creating and starting ASM instance, CSS service must be up and running so in order to get your CSS service up and running just go to $ORACLE_HOME/bin and run the following command as root user to start CSS service.

[root@ora10srv bin]# ./localconfig add
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
Configuration for local CSS has been initialized

Adding to inittab
Startup will be queued to init within 30 seconds.
Checking the status of new Oracle init process...
Expecting the CRS daemons to be up within 600 seconds.
CSS is active on these nodes.
        ora10srv
CSS is active on all nodes.
Oracle CSS service is installed and running under init(1M)

4. Run DBCA to create ASM Instance and database:

[oracle@ora10srv bin]$ ./dbca



Here we choose - Configure Automatic Storage Management option to create and start an ASM instance.



Provide Password for SYS and click on Next.



Click on OK to create and start ASM instance.






Click on Create New to create the Disk group to be used for database files.



Here Provide Disk Group Name - DATA and select candidate disks and click on OK.






Disk group has been created and mounted now.



Click on Yes - in order to create database further.



Now you can see +ASM Instance has been setup successfully and running.

[oracle@ora10srv bin]# ps -ef | grep asm
oracle    5788  5787  0 13:42 pts/1    00:00:15 /u01/app/oracle/product/10.2.0/db_1/jdk/jre/bin/java -Dsun.java2d.font.DisableAlgorithmicStyles=true -DORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1 -DDISPLAY=:0.0 -DJDBC_PROTOCOL=thin -mx128m -classpath /u01/app/oracle/product/10.2.0/db_1/jdk/jre/lib/rt.jar:/u01/app/oracle/product/10.2.0/db_1/jdk/jre/lib/i18n.jar:/u01/app/oracle/product/10.2.0/db_1/assistants/dbca/jlib/dbca.jar:/u01/app/oracle/product/10.2.0/db_1/assistants/jlib/assistantsCommon.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/ewt3.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/ewtcompat-3_3_15.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/share.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/help4.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/jewt4.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/oracle_ice5.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/kodiak.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/swingall-1_1_1.jar:/u01/app/oracle/product/10.2.0/db_1/lib/xmlparserv2.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/orai18n.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/orai18n-mapping.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/orai18n-utility.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/orai18n-collation.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/netcfg.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/ojmisc.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/oraclepki103.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/ldapjclnt10.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/opm.jar:/u01/app/oracle/product/10.2.0/db_1/jdbc/lib/classes12.zip:/u01/app/oracle/product/10.2.0/db_1/jlib/srvm.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/srvmhas.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/srvmasm.jar:/u01/app/oracle/product/10.2.0/db_1/classes:/u01/app/oracle/product/10.2.0/db_1/jlib/oemlt-10_1_0.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/emca.jar:/u01/app/oracle/product/10.2.0/db_1/sysman/jlib/emCORE.jar:/u01/app/oracle/product/10.2.0/db_1/oc4j/j2ee/home/oc4j.jar:/u01/app/oracle/product/10.2.0/db_1/oc4j/j2ee/home/db_oc4j_deploy.jar:/u01/app/oracle/product/10.2.0/db_1/jlib/emConfigInstall.jar:/u01/app/oracle/product/10.2.0/db_1/oui/jlib/OraInstaller.jar:/u01/app/oracle/product/10.2.0/db_1/oui/jlib/OraPrereq.jar:/u01/app/oracle/product/10.2.0/db_1/inventory/prereqs/oui/OraPrereqChecks.jar:/u01/app/oracle/product/10.2.0/db_1/oui/jlib/OraPrereqChecks.jar oracle.sysman.assistants.dbca.Dbca
oracle   25656     1  0 14:39 ?        00:00:00 asm_pmon_+ASM
oracle   25658     1  0 14:39 ?        00:00:00 asm_psp0_+ASM
oracle   25660     1  0 14:39 ?        00:00:00 asm_mman_+ASM
oracle   25662     1  0 14:39 ?        00:00:01 asm_dbw0_+ASM
oracle   25664     1  0 14:39 ?        00:00:00 asm_lgwr_+ASM
oracle   25666     1  0 14:39 ?        00:00:00 asm_ckpt_+ASM
oracle   25668     1  0 14:39 ?        00:00:00 asm_smon_+ASM
oracle   25670     1  0 14:39 ?        00:00:00 asm_rbal_+ASM
oracle   25672     1  0 14:39 ?        00:00:00 asm_gmon_+ASM
root     25733  5496  0 14:42 pts/2    00:00:00 grep asm

[oracle@ora10srv bin]# ps -ef | grep pmon
oracle   25656     1  0 14:39 ?        00:00:00 asm_pmon_+ASM
root     25739  5496  0 14:43 pts/2    00:00:00 grep pmon

SQL> set linesize 220
SQL> select * from v$instance;

INSTANCE_NUMBER INSTANCE_NAME    HOST_NAME                                                        VERSION           STARTUP_T STATUS       PAR    THREAD# ARCHIVE LOG_SWITCH_WAIT LOGINS     SHU DATABASE_STATUS
--------------- ---------------- ---------------------------------------------------------------- ----------------- --------- ------------ --- ---------- ------- --------------- ---------- --- -----------------
INSTANCE_ROLE      ACTIVE_ST BLO
------------------ --------- ---
              1 +ASM             ora10srv                                                         10.2.0.3.0        28-JAN-15 STARTED      NO           0 STOPPED  ALLOWED    NO  ACTIVE
UNKNOWN            NORMAL    NO



Now, let's proceed with database creation based on Automatic Storage Management.









Here we choose Automatic Storage Management(ASM) as our storage Mechanism.


Select disk groups to be used as storage for the database.











Now, let's check with database login if our created database files are placed inside Automatic Storage Management.


[oracle@ora10srv bin]# ps -ef | grep pmon
oracle   25656     1  0 14:39 ?        00:00:00 asm_pmon_+ASM
oracle   26152     1  0 14:56 ?        00:00:00 ora_pmon_asmdb
root     26228  5496  0 15:01 pts/2    00:00:00 grep pmon

Enter user-name: sys as sysdba
Enter password:

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> set linesize 220
SQL> select name from v$datafile;

NAME
---------------------------------------------------------
+DATA/asmdb/datafile/system.256.870187759
+DATA/asmdb/datafile/undotbs1.258.870187769
+DATA/asmdb/datafile/sysaux.257.870187763
+DATA/asmdb/datafile/users.259.870187771

SQL> select name from v$controlfile;

NAME
-----------------------------------------------------------
+DATA/asmdb/controlfile/current.261.870188029
+DATA/asmdb/controlfile/current.260.870188031

Here we can see our database files are created inside Automatic Storage Management..............!!

Hope it would help someone to setup ASM based database.............!!

Wednesday, January 28, 2015

Error while loading shared libraries: libstdc++.so.5



If you are having the following issue while setting up RAC Clusterware installation or setting up an +ASM Instance then here you go:

[root@ora10srv bin]# ./localconfig add
/etc/oracle does not exist. Creating it now.
/u01/app/oracle/product/10.2.0/db_1/bin/crsctl.bin: error while loading shared libraries: libstdc++.so.5: cannot open shared object file: No such file or directory
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
Configuration for local CSS has been initialized

Adding to inittab
/etc/init.d/init.cssd: line 649: /etc/oracle/scls_scr/ora10srv/root/cssrun: No such file or directory
Startup will be queued to init within 30 seconds.
Checking the status of new Oracle init process...
/u01/app/oracle/product/10.2.0/db_1/bin/crsctl.bin: error while loading shared libraries: libstdc++.so.5: cannot open shared object file: No such file or directory
Giving up: Oracle CSS stack appears NOT to be running.
Oracle CSS service would not start as installed
Automatic Storage Management(ASM) cannot be used until Oracle CSS service is started.


Solution:
========

Ref: Metalink Note 400565.1 / Bug.5671963. Install compat-libstdc++-33-3.2.3-47.3.ia64.rpm and repeat the Oracle Clusterware installation.

Please note that compat-libstdc++-33-3.2.3-47.3.i386.rpm package provides the following libraries:

Provides :
libstdc++.so.5
libstdc++.so.5(CXXABI_1.2)
libstdc++.so.5(CXXABI_1.2.1)
libstdc++.so.5(CXXABI_1.2.2)
libstdc++.so.5(GLIBCPP_3.2)
libstdc++.so.5(GLIBCPP_3.2.1)
libstdc++.so.5(GLIBCPP_3.2.2)
libstdc++.so.5(GLIBCPP_3.2.3)
libstdc++.so.5(GLIBCPP_3.2.4)
compat-libstdc++-33


Now, having installed the above RPM try following commands again to start the CSS service.


$./localconfig delete

$./localconfig add


[root@ora10srv bin]# ./localconfig add
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
Configuration for local CSS has been initialized

Adding to inittab
Startup will be queued to init within 30 seconds.
Checking the status of new Oracle init process...
Expecting the CRS daemons to be up within 600 seconds.
CSS is active on these nodes.
        ora10srv
CSS is active on all nodes.
Oracle CSS service is installed and running under init(1M)



You can see that Oracle CSS service is installed and running now.

[root@ora10srv bin]# ps -ef | grep css
oracle   25308     1  0 14:32 ?        00:00:00 /u01/app/oracle/product/10.2.0/db_1/bin/ocssd.bin
root     25549  5496  0 14:37 pts/2    00:00:00 grep css

Tuesday, January 20, 2015

Yum Server Configuration

I have seen most of the people who try to install Oracle RDBMS/Oracle Grid Infrastructure on Linux OS very first time or so get stuck at the stage of RPM package validation and while installing them one by one at OS level due to dependencies among them. So to overcome from such situation and to do all RPMs/packages installations in an easy way you should configure yum server on a machine and let it do all the downloading/installation of all packages itself for you.

To configure yum server, first of all we need to identify the installed Linux OS version and it's corresponding public yum repository.

[root@localhost ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.4 (Tikanga)

[root@localhost ~]# cd /etc/yum.repos.d/

Now we will be creating public-yum-el5.repo named file with following details to cofig the yum server pointing public yum repository.

[root@localhost ~]# vi public-yum-el5.repo

[el5_u4_base]
name=Enterprise Linux $releasever Update 4 installation media copy ($basearch)
baseurl=http://public-yum.oracle.com/repo/EnterpriseLinux/EL5/4/base/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=0
enabled=1


Note : Make sure you have changed the value of enabled to 1 from 0, Save and Exit;


List repository packages in Oracle Linux as shown below now.

[root@localhost ~]# yum list

Now we are ready to install any packages required with following yum install command:

[root@localhost ~]# yum install [package_name]

For example, I wanted to install elfutils-devel packages but it has dependent packages to be installed first. As we have already configured the yum server then we just need to provide some start string of the package to be installed ending with asterisk(*) then it will automatically download/install all its dependent packages along as follows:

[root@localhost yum.repos.d]# yum install elfutils*
Loaded plugins: rhnplugin, security
This system is not registered with ULN.
ULN support will be disabled.
Setting up Install Process
Package elfutils-libelf-0.137-3.el5.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package elfutils.x86_64 0:0.137-3.el5 set to be updated
---> Package elfutils-devel.i386 0:0.137-3.el5 set to be updated
---> Package elfutils-devel.x86_64 0:0.137-3.el5 set to be updated
---> Package elfutils-devel-static.i386 0:0.137-3.el5 set to be updated
---> Package elfutils-devel-static.x86_64 0:0.137-3.el5 set to be updated
---> Package elfutils-libelf.i386 0:0.137-3.el5 set to be updated
---> Package elfutils-libelf-devel.i386 0:0.137-3.el5 set to be updated
---> Package elfutils-libelf-devel.x86_64 0:0.137-3.el5 set to be updated
---> Package elfutils-libelf-devel-static.i386 0:0.137-3.el5 set to be updated
---> Package elfutils-libelf-devel-static.x86_64 0:0.137-3.el5 set to be updated
---> Package elfutils-libs.i386 0:0.137-3.el5 set to be updated
---> Package elfutils-libs.x86_64 0:0.137-3.el5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================
 Package                             Arch          Version              Repository          Size
=================================================================================================
Installing:
 elfutils                            x86_64        0.137-3.el5          el5_u5_base        215 k
 elfutils-devel                      i386          0.137-3.el5          el5_u5_base         61 k
 elfutils-devel                      x86_64        0.137-3.el5          el5_u5_base         62 k
 elfutils-devel-static               i386          0.137-3.el5          el5_u5_base        122 k
 elfutils-devel-static               x86_64        0.137-3.el5          el5_u5_base        119 k
 elfutils-libelf                     i386          0.137-3.el5          el5_u5_base         58 k
 elfutils-libelf-devel               i386          0.137-3.el5          el5_u5_base         24 k
 elfutils-libelf-devel               x86_64        0.137-3.el5          el5_u5_base         24 k
 elfutils-libelf-devel-static        i386          0.137-3.el5          el5_u5_base         66 k
 elfutils-libelf-devel-static        x86_64        0.137-3.el5          el5_u5_base         64 k
 elfutils-libs                       i386          0.137-3.el5          el5_u5_base        193 k
 elfutils-libs                       x86_64        0.137-3.el5          el5_u5_base        183 k

Transaction Summary
=================================================================================================
Install      12 Package(s)
Upgrade       0 Package(s)

Total download size: 1.2 M
Is this ok [y/N]: y

Note : Here you can see it asks for all dependent packages to be downloaded or not so we will press (y) to download all dependent packages.


Downloading Packages:
(1/12): elfutils-libelf-devel-0.137-3.el5.x86_64.rpm                      |  24 kB     00:00  
(2/12): elfutils-libelf-devel-0.137-3.el5.i386.rpm                        |  24 kB     00:00  
(3/12): elfutils-libelf-0.137-3.el5.i386.rpm                              |  58 kB     00:00  
(4/12): elfutils-devel-0.137-3.el5.i386.rpm                               |  61 kB     00:00  
(5/12): elfutils-devel-0.137-3.el5.x86_64.rpm                             |  62 kB     00:00  
(6/12): elfutils-libelf-devel-static-0.137-3.el5.x86_64.rpm               |  64 kB     00:00  
(7/12): elfutils-libelf-devel-static-0.137-3.el5.i386.rpm                 |  66 kB     00:00  
(8/12): elfutils-devel-static-0.137-3.el5.x86_64.rpm                      | 119 kB     00:00  
(9/12): elfutils-devel-static-0.137-3.el5.i386.rpm                        | 122 kB     00:00  
(10/12): elfutils-libs-0.137-3.el5.x86_64.rpm                             | 183 kB     00:00  
(11/12): elfutils-libs-0.137-3.el5.i386.rpm                               | 193 kB     00:00  
(12/12): elfutils-0.137-3.el5.x86_64.rpm                                  | 215 kB     00:00  
-------------------------------------------------------------------------------------------------
Total                                                             54 kB/s | 1.2 MB     00:21  
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 1e5e0159
el5_u5_base/gpgkey                                                        | 1.4 kB     00:00  
Importing GPG key 0x1E5E0159 "Oracle OSS group (Open Source Software group) <build@oss.oracle.com>" from /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
Is this ok [y/N]: y

Note : Here it asks whether you want to install all downloaded packages so we will hit (y)

Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : elfutils-libs                                                            1/12
  Installing     : elfutils-libelf                                                          2/12
  Installing     : elfutils                                                                 3/12
  Installing     : elfutils-libs                                                            4/12
  Installing     : elfutils-libelf-devel                                                    5/12
  Installing     : elfutils-libelf-devel                                                    6/12
  Installing     : elfutils-libelf-devel-static                                             7/12
  Installing     : elfutils-libelf-devel-static                                             8/12
  Installing     : elfutils-devel-static                                                    9/12
  Installing     : elfutils-devel                                                          10/12
  Installing     : elfutils-devel                                                          11/12
  Installing     : elfutils-devel-static                                                   12/12

Installed:
  elfutils.x86_64 0:0.137-3.el5                                                                
  elfutils-devel.i386 0:0.137-3.el5                                                            
  elfutils-devel.x86_64 0:0.137-3.el5                                                          
  elfutils-devel-static.i386 0:0.137-3.el5                                                    
  elfutils-devel-static.x86_64 0:0.137-3.el5                                                  
  elfutils-libelf.i386 0:0.137-3.el5                                                          
  elfutils-libelf-devel.i386 0:0.137-3.el5                                                    
  elfutils-libelf-devel.x86_64 0:0.137-3.el5                                                  
  elfutils-libelf-devel-static.i386 0:0.137-3.el5                                              
  elfutils-libelf-devel-static.x86_64 0:0.137-3.el5                                            
  elfutils-libs.i386 0:0.137-3.el5                                                            
  elfutils-libs.x86_64 0:0.137-3.el5                                                          

Complete!


Finally, you saw all dependent packages got installed in such an ease way by configuring yum server.