Tuesday, May 13, 2014

Data Structure



1. Malloc in C Language
2. Linked List data structure creation in C Language
3. Character frequency in a String using Java
4. Selection sorting using Java
7. Linked list using java For more on youtube
1. Youtube TOC
2. Facebook TOC

Thursday, May 8, 2014

Crunch of hard drive space on your linux machine. Wanted to add new hard drive follow up the below steps (On Virtual Machine)

Step 1: Open VMware. Select “Edit virtual machine settings”




Step 2: Now click on Add… button.


Step 3: Select “Hard Disk” then “Next”.


Step 4: Independent option can be check  according to the need. Here I am keeping unchecked.



Step 5: Change hard disk size according to need.



Step 6: Start the Virtual machine.


Step 7: Open terminal and find out new raw partition name, as below (In my case it is /dev/sdb)


Step 8: use fdisk /dev/sdb to create new partition.




Step 9: We created the partition called /dev/sdb1.

Create one directory under root mount point.
#mkdir /d01
#mount –t ext3 /dev/sdb1 /d01

O/P Before mounting /d01 filesystem 




 O/P After mounting /d01 filesystem


NOTE: Be careful while editing /etc/fstab entries. It will cause boot problem (If in-case follow the link solution)  

To make it auto mount during the server boot add below entries to /etc/fstab file.
Eg. 

/dev/sdb1       /d01      ext3 defaults 1 2 


Command for unmounting the /d01 mount point


Command to mount: mount /dev/sdb1


--END--
















Monday, January 9, 2012

Migration of Oracle 10g Database to ASM (Automatic Storage Management) on Virtual Machine


Migration of Oracle 10g Database to ASM (Automatic Storage Management) on Virtual Machine



Step 1: Open Virtual Machine (Vmware_workstation 7.0)
Step 2: Add Hard Drive (Here i am using 3 Hard Drives).
a. Click on the "Edit virtual machine settings".
b. Click on "Add..." Button.
c. Select "Hard Disk," press "Next" button.
d. Select "Create a new virtual disk", press "Next" button.
e. Select "SCSI" and "Independent Persistent", press "next" button.
f. Specify the required Hard Drive space in "Maximum disk size (GB)", press "Next" and "Finish".
NOTE: Repeat the "Step 2:" as many disk you want to add.
Step 3: Start Virtual Machine
Step 4: Now create the RAW Device
a. Partition the disk driver.
1. Login as root user
   # fdisk -l
  # cd /dev/
  # ls sd*
  sda sdb sdc sdd sde
 # fdisk /dev/sdb (sdc, sdd ......)
   command (m for help): n (Choose 'n' command)
  command action
  e extend
  p primary partition (1-4)
  p (Choose 'p' command)
  Partition Number (1-4): 1 (Choose '1')
  First Cylinder (1-1115, default 1): (Press Enter)
  Last cylinder or +size or +sizeM or +sizeK (1-1305,
default 1305): (Press Enter)
  . . . .
   . . . .
  Command (m for help): w (Choose 'w' command)
  The partition table has been altered!    Calling ioctl() to re-read partition table.   Syncing disks.
NOTE: Repeat the above same steps for remaining Disk.
b. Binding raw device with partition on new SCSI disk.
                                  a. Login as root.
      # raw /dev/raw/raw1 /dev/sdb1
      # raw /dev/raw/raw2 /dev/sdc1
      # raw /dev/raw/raw3 /dev/sdd1
c. Change the ownership and peof the raw device.
  a. Login as root
      # cd /dev/raw
      # chown oracle:dba raw[1-3]
      #chmod 600 /dev/raw/raw1
      #chmod 600 /dev/raw/raw2
      # chmod 600 /dev/raw/raw3
Step 4: ASM Creation using raw devices
a. To configure as ASM instance, start the Database Configuration Assistant by issuing the "dbca"     command as the oracle user.
b. On the "Welcome" screen, click the "Next" button.
c. Select the "Configure Automatic Storage Management" option, then click "Next" button.
d. If the Oracle Cluster Synchronization Service (CSS) is not running currently, a warning screen will be displayed. Follow the instruction and click "OK". Once the service started click "Next" button.
NOTE: Script gives the o/p.
 # /u01/app/oracle/product/10.2.0/db_1/bin/localconfig add
   /etc/oracle does not exist. Creating it now.
   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 90 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.
     centos2
   CSS is active on all nodes.
   Oracle CSS service is installed and running under init(1M)
e. Enter the password for the ASM instance, then click "Next" button.
f. On the conformation screen, click "Ok" button.
g. Wait while the asm instance is cleared.
h. Once the asm creation is done, you are presented with the "ASM Disk Group" screen. Click "Create New" button.
i. On the "Create Disk Group" screen, enter Disk Group Name of "DATA" and select the required level  of redundancy.
 - External:
ASM does not mirror the files. This option should only be used if your disk are already  protected by some form of redundancy, like RAID
 - Normal:
  ASM performs two-way mirroring of all files.
 - High:
  ASM performs three-way mirroring of all files.
j. If you don't see disks which you believes should be available, then press on "Change Disk Discovery path..."
NOTE: Add raw devices path like this: /dev/raw/raw1,/dev/raw/raw2,/dev/raw/raw3
And then press "Ok" button.
h. On the "ASM Disk Groups " screen, Click the "Finish" button.
i. Click "Yes" button to perform another operation. (Now you are ready to create a database instance using ASM)
Step 5: Migration of Oracle 10g Database to ASM
a. Login as oracle user
b. Set the environment
c. start the listener
 $lsnrctl start
d. Disable Block change tracking:
$ sqlplus "/as sysdba"
SQL>  select * from v$block_change_tracking;
STATUS  FILENAME  BYTES
-----------------------------------------------
DISABLED
NOTE: If not disable then, disable using below command:
SQL> ALTER DATABASE DISABLE BLOCK CHANGE TRACKING;
Database altered
e. Shutdown the database
SQL>shutdown immediate
SQL> exit
f. Create pfile and add/modify the following parameters:
SQL> create pfile from spfile;
File created.
Parameters:
------------------
*.control_files=+DATA
*.db_recovery_file_dest=+DATA
*.db_recovery_file_dest_size=2147483648
*.db_create_file_dest=+DATA
*.db_create_online_log_dest_1=+DATA
g. Create spfile back from modified pfile:
SQL> create spfile from pfile;
File created
SQL> exit
h. Copy Database to ASM diskgroups using RMAN
 - start the instance on nomount
                                 - Copy the control file from old location to ASM using
                                 - Mount the database
                                 - copy the datafiles to ASM disk group using rman
 - Switch database to copy and open the database
                                  $ rman
                                   RMAN> connect target
                                   Connected to target database (not started)
                                   RMAN> startup nomount
   RMAN> restore controlfile from '/u01/app/oracle/oradata/prod/contorl01.ctl';
   RMAN> startup mount
   RMAN> configure device type disk parallelism 4;
   RMAN> backup as copy database format '+DATA';
                                   RMAN> switch database to copy;
   RMAN> alter database open;
   RMAN> exit

i. Migration tempfile to ASM:
 - tempfile can't be migrate using RMAN, it has to be migrate manually to ASM.
 $ sqlplus "/as sysdba"
 SQL> select name, bytes from v$tempfile;
NAME                                                                                     BYTES
------------------------------------------------------------------------------
/u01/app/oracle/oradata/prod/temp01.dbf    20971520
SQL> create temporary tablespace temp1 tempfile SIZE 100M extent management local   uniform size 1M;
  Tablespace created.
 SQL> alter database default temporary tablespace temp1;
  Database altered.
 SQL> drop tablespace temp including contents;
  Tablespace dropped.
  SQL> create temporary tablespace temp tempfile SIZE 100M extent management local    uniform size 1M;
  Tablespace created.
 SQL> alter database default temporary tablespace temp;
  Database altered.
SQL> drop tablespace temp1 including contents;
  Tablespace dropped.
 SQL> select name from v$tempfile;
  NAME
  ------------------------------------------------------------------------------
  +DATA/prod/tempfile/temp.264.596370217
j. Migrate and drop the old Online Redo Logs to ASM
 - Run the following procedure to migrate the redo logs to ASM.
SQL> declare cursor orlc is  select lf.member, l.bytes from v$log l, v$logfile lf where
             l.group# = lf.group# and lf.type = 'ONLINE' order by l.thread#, l.sequence#;
             type numTab_t is table of number index by binary_integer; type charTab_t is table of varchar2(1024) index by binary_integer;
byteslist numTab_t; namelist charTab_t;  procedure migrateorlfile(name IN varchar2, bytes IN number) is
 retry number; stmt varchar2(1024);   als varchar2(1024) := 'alter system switch logfile'; 
begin  select count(*) into retry from v$logfile;    stmt := 'alter database add logfile size ' || bytes;
execute immediate stmt; stmt := 'alter database drop logfile ''' || name || ''''; for i in 1..retry loop
 begin execute immediate stmt;  exit; exception when others then if i > retry then raise; 
 end if;  execute immediate als;
  end; 
 end loop;
 end;
begin  open orlc; fetch orlc bulk collect into namelist, byteslist;
close orlc; for i in 1..namelist.count loop migrateorlfile(namelist(i), byteslist(i));
 end loop; 
end;
 /

 SQL> select member from v$logfile;  
      MEMBER
      --------------------------------------------------------------------------------  
      +DATA/prod/onlinelog/group_3.259.596373299 
      +DATA/prod/onlinelog/group_2.258.596373295
      /u01/app/oracle/oradata/prod/redo01.log
      +DATA/prod/onlinelog/group_4.257.596373293   
    SQL> alter system switch logfile;   
                                 System altered.  
                     SQL> /    
                              System altered.
     SQL> /   
                          System altered.
                      SQL> /
                                  System altered.
  - Re-Execute the same script again in order to migrate the remaining ones. 
SQL> declare  cursor orlc is   select lf.member, l.bytes  from v$log l, v$logfile lf
where l.group# = lf.group# and lf.type = 'ONLINE' order by l.thread#, l.sequence#;
 type numTab_t is table of number index by binary_integer; type charTab_t is table of varchar2(1024) index by binary_integer;
 byteslist numTab_t; namelist charTab_t; procedure migrateorlfile(name IN varchar2, bytes IN number) is retry number;
  stmt varchar2(1024); als varchar2(1024) := 'alter system switch logfile';
begin  select count(*) into retry from v$logfile; stmt := 'alter database add logfile size ' || bytes;
execute immediate stmt; stmt := 'alter database drop logfile ''' || name || ''''; for i in 1..retry loop
begin execute immediate stmt;   exit;
exception  when others then   if i > retry then raise;  end if; execute immediate als;
 end; 
end loop;
end;
begin open orlc;  fetch orlc bulk collect into namelist, byteslist; close orlc;
for i in 1..namelist.count loop migrateorlfile(namelist(i), byteslist(i));
end loop;
 end; 
/

 SQL> select member from v$logfile;
        MEMBER 
         -------------------------------------------------------------------------------- 
        +DATA/prod/onlinelog/group_3.259.596373619
        +DATA/prod/onlinelog/group_2.258.596373615 
        +DATA/prod/onlinelog/group_1.261.596373613 
        +DATA/prod/onlinelog/group_4.257.596373293 
        +DATA/prod/onlinelog/group_5.260.596373609
 SQL> exit
k. Delete The old Datafiles using RMAN.
 $ rman target /
RMAN> run {
  2> delete copy of database
  3> }
  RMAN> exit
l. Enable the block change tracking.
 SQL> alter database enable block change tracing;
 Database altered.
m. Now your database is ready to use using ASM.





Monday, March 28, 2011

Oracle Application Release 12 Single Node Installation Document

Disk space requirements:

Application node (Fresh & Vision database) - 28 GB

Database node for Fresh database - 45GB

Database node for Vision demo database - 133GB

Stage area size - 33GB

Total Space for fresh Install - 73GB

Total Space for Vision - 161GB

Operating System Name

Supported Version

Red Hat Enterprise Linux

4.0 - Update 4 or higher (32-bit)

Kernel Requirements:

The following table lists the required minimum kernel versions.

Operating System

Kernel

Instructions

Red Hat Enterprise Linux AS/ES 4.0

2.6.9-42.EL

To determine version, $ uname - r

Required Packages:

Check required rpms installed or not (Eg : rpm –q glibc-2.3.4-2.25 )

glibc-2.3.4-2.25

glibc-common-2.3.4-2.25

binutils-2.15.92.0.2-21

compat-libstdc++-296-2.96-132.7.2

gcc-3.4.6-3

gcc-c++-3.4.6-3

libgcc-3.4.6-3

libstdc++-3.4.6-3

libstdc++-devel-3.4.6-3

openmotif21-2.1.30-11.RHEL4.6

pdksh-5.2.14-30.3

setarch-1.6-1

make-3.80-6.EL4

gnome-libs-1.4.1.2.90-44.1

sysstat-5.0.5-11.rhel4

compat-db-4.1.25-9

control-center-2.8.0-12.rhel4.5

xscreensaver-4.18-5.rhel4.11

libaio-0.3.105-2

libaio-devel-0.3.105-2

After installing these patches, run ldconfig -v. The openmotif package version numbering must be 2.1.30. For example, openmotif-2.2.3-10.RHEL4.5 is not supported.

Java version Requirements

$java –version

Java version should be minimum 1.4.2.

Sites to Download Rpms:

http://rpm.pbone.net/

http://linuxsoft.cern.ch/

Software Requirements:

Check this Softwares installed. ( Eg : which ar )

Ar, gcc , g++ , ld , ksh, make, Xdisplay

Kernel Settings:

Set following kernel parameters in /etc/sysctl.conf

set kernel.semmsl=256

set kernel.semmns=32000

set kernel.semopm=100

set kernel.semmni=142

set kernel.shmall=2097152

set kernel.shmmax=2147483648 (half of memory)

set kernel.shmmni=4096

set kernel.msgmax=8192

set kernel.msgmnb=65535

set kernel.msgmni=2878

set fs.file-max=65536

set net.ipv4.ip_local_port_range=1024 65000

set net.core.rmem_default=262144

set net.core.rmem_max=262144

set net.core.wmem_default=262144

set net.core.wmem_max=262144

After editing the file, use the "sysctl -p" command or restart the system to invoke the new

settings.

Domain Name System (DNS) Resolver Parameters:

Following entries to these minimum settings in the /etc/resolv.conf file on each server node:

options attempts:5
options timeout:15

Verifying Host Names:

Verify that the /etc/hosts file is formatted as follows:

127.0.0.1 localhost.localdomain localhost

      . 

Verify that the /etc/sysconfig/network file is formatted as follows:

HOSTNAME=.

If the /etc/sysconfig/networking/profiles/default/network file exists, remove it.

If you changed any files in the previous steps, restart the system.

Modifying the Number of Open File Descriptors:

Open the /etc/security/limits.conf file and change the existing values for "hard" and "soft" parameters as follows. Restart the system after making changes.

  * hard nofile 65535
  * soft nofile 4096
  * hard nproc 16384
  * soft nproc 2047
 
 
Net Service Listeners in Multi-user Installations:
 
$ chmod 777 /var/tmp/.oracle
 
 

Creating the Stage Area Directory:

Create directory for staging

$cd /

$mkdir stage

Verify software version (perl).

You must have perl 5.0053 or higher installed, and it must be in your PATH. Use

the following commands to identify the perl version and its location. The command

is the same for both UNIX and Windows platforms:

$perl -v

 

Mount the DVD

 

Run the adautostg.pl script.

 

$ perl /mnt/cdrom/Disk1/rapidwiz/adautostg.pl

Before starting installation check rapidwiz version:

Current Version of Rapid Install

The most current version of the Rapid Install wizard is 12.0.0.22. You can obtain this version by applying patch 5885627, available at OracleMetaLink. To verify your current version, use the RapidWizVersion executable, located in the rapidwiz directory on the Start Here DVD. For example:

UNIX:

$ cd /Stage12/startCD/Disk1/rapidwiz
$ ./RapidWizVersion
 

To update the Start Here DVD, uncompress the patch in the main staging area to overwrite the startCD directory. For example:

UNIX:

$ cd /Stage12
$ unzip -o p5885627_R12_GENERIC.zip
 
 

OS user account settings:

Create group for user

$groupadd dba

$useradd –g dba oracle

$useradd –g applmgr

Change read write execute permission and ownership to directories where going to install application and database

$chmod 777 /u01

$chmod 777 /u02

Start installation

$ /stage/Stage12i/startCD/Disk1/rapidwiz/rapidwiz

Sample screen shots of Oracle Applications Release 12 Rapid Install Wizard

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Application Home Page:

http://hostname.domainname:8000

Make profile entry for Users

For Database tier User ( .bash_profile )

. /u01/oracle/PROD/db/tech_st/10.2.0/PROD_r12.env

For Application tier User ( .bash_profile )

. /u02/oracle/PROD/apps/apps_st/appl/APPSPROD_r12.env

References:

Metalink Note: 402310.1

Oracle Applications Installation and Upgrade Notes Release 12 for Linux (32-bit)

Metalink Note: 405565.1

Oracle Applications Release 12 Installation Guidelines

Metalink Note: 405293.1

Oracle Applications Release Notes Release 12

B31295-04

http://download.oracle.com/docs/cd/B40089_05/current/acrobat/120oaig.pdf

Execution Plan & Statistics