Posts

CyclicRotation:Rotate an array to the right by a given number of steps.

An array A consisting of N integers is given. Rotation of the array means that each element is shifted right by one index, and the last element of the array is moved to the first place. For example, the rotation of array A = [3, 8, 9, 7, 6] is [6, 3, 8, 9, 7] (elements are shifted right by one index and 6 is moved to the first place). The goal is to rotate array A K times; that is, each element of A will be shifted to the right K times.  //Code in Java class Solution { public int [] solution( int [] A, int K) { int [] B = new int [A.length]; for ( int i= 0 ;i<A.length;i++) { int l= A.length; int pos=(i+K)%l; B[pos]=A[i]; } return B; } }

Installation of Oracle Database 11g-R2

Image
Oracle Express Edition can be distributed and can be used to provide third party demonstration and training. (all the above information is taken from  oracle.com ) Prerequisites Software: VMware Workstation ( VMware Workstation Link ) Oracle Enterprise Linux ( Oracle Enterprise Linux Link ) Oracle Database ( Oracle Database Link ) In this guide the below software versions are used:  VMware Workstation v10.0.0 Oracle Enterprise Linux v5.7 x86-64 Oracle Database Express Edition 11g R2 for Linux x86-64 Installation of VMware Workstation and OEL is not covered in this guide because it is straightforward. Just install them, start them. ( Notice that during the installation of OEL you must check oracle-validated-1.1.* package in system tools ) To install Oracle Database Express Edition: Log in as root user and run the executable 'oracle-xe-11.2.0-1.0.x86_64.rpm' You must run '/etc/init.d/oracle-xe configure' as the root user to configure the database. ...

Configure IP address on Oracle Linux

Adding IP address in Oracle Linux can be done by editing the network-scripts. While this procedure is tested on Oracle Linux, i'm sure it should work on  Redhat Enterprise Linux and other versions of Redhat . Editing network - scripts    The network interface configuration files are found in the directory:     /etc/sysconfig/network-scripts/   To add an IP address to an interface eth0  # cd  /etc/sysconfig/network-scripts/  # vi ifcfg-eth0   Enter the below parameters for static configuration   DEVICE="eth0"  BOOTPROTO="static"  BROADCAST="192.168.2.255"  HWADDR="00:0C:29:DS:22:26"  IPADDR="192.168.2.2"  NETMASK="255.255.255.0"    NETWORK="192.168.2.0"     ONBOOT="yes"  TYPE="Ethernet"   Save the file by typing  ESC :wq   R estart the network service for the changes to take effect.    # service network restart   

Oracle Directory Object

Oracle offers two ways  for a session to read or write operating system files. 1.Oracle directories 2. UTL_FILE package UTL_FILE package contains many PL/SQL procedures for manipulating directory objects. Operating system directories that can be accessed by UTL_FILE are only those listed in UTL_FILE_DIR instance parameter. This parameter default to NULL but can be set to any comma separated list as well as * (wildcard) which means any directory in operating system. SQL > SELECT   NAME, VALUE             FROM     V$PARAMETER             WHERE    UPPER(NAME) = 'UTL_FILE_DIR' Result --------------------------------------------------------------------------------------------------- utl_file_dir             NULL All the directories listed will be visible to all sessions. To give a value for UTL_FILE_DIR parameter file use the following command. SQL > sqlplus /...

Oracle RAC Installation – Pre-Installation steps (Part 2)

Image
Installation of Oracle Enterprise Linux 5 Update 1 operating system Install the necessary operating system. Verifying your installation for the existence of the following required packages (if these do not exist please install them) In order to verify the existence of the required packages, you need to execute the command rpm –qa. For example to check if the package binutils-2.17.50.0.6-2.el5 exists we need to execute the command «rpm –qa| grep binutil». The following list contains all the required package versions (or later): • binutils-2.17.50.0.6-2.el5 • compat-libstdc++-33-3.2.3-61 • elfutils-libelf-0.125-3.el5 • elfutils-libelf-devel-0.125 • gcc-4.1.1-52 • gcc-c++-4.1.1-52 • glibc-2.5-12 • glibc-common-2.5-12 • glibc-devel-2.5-12 • glibc-headers-2.5-12 • libaio-0.3.106 • libaio-devel-0.3.106 • libgcc-4.1.1-52 • libstdc++-4.1.1 • libstdc++-devel-4.1.1-52.e15 • make-3.81-1.1 • sysstat-7.0.0 • unixODBC-2.2.11 • unixODBC-devel-2.2.11 Configuring the Linux ...

Oracle RAC Installation - Oracle 11gR1 (11.1.0.6.0) installation guide on Oracle Enterprise Linux 5U1 over VMware Server

Oracle 11gR1Installation – Pre-Installation steps .............................................................. Creation of a virtual machine ........................................................................................ Creation of secondary virtual machine......................................................................... Addition of a network card............................................................................................ Modifications on the VMware configuration file ........................................................ Installation of Oracle Enterprise Linux 5 Update 1 operating system.................... Veryfying your installation for the existence of the following required packages (if these do not exist please install them).................................................................... Configuring the Linux Kernel Parameters ................................................................ Network Configuration for the RAC insta...

Oracle RAC Installation – Pre-Installation steps (Part 1)

Image
1.Creation of a virtual machine  1. Press CTRL-N to create a new virtual machine. 2. New Virtual Machine Wizard: Click on Next. 3. Select the Appropriate Configuration: a) Virtual machine configuration: Select Custom. 4. Select a Guest Operating System: a) Guest operating system: Select Linux. b) Version: Select Red Hat Enterprise Linux 4. Your virtual machine will be Oracle Enterprise Linux 5U1, since VMware is not currently supporting it select the nearest possible (in this case Red Hat Enterprise Linux 4) since the only thing useful from VMware in this case is the time syncing with the host environment. 5. Name the Virtual Machine: a) Virtual machine name: Enter “myrac1.” b) Location: Enter “X:\VMRAC11G\OEL5_RAC1.” 6. Set Access Rights: a) Access rights: Select Make this virtual machine private. 7. Startup / Shutdown Options: a) Virtual machine account: Select User that powers on the virtual machine. 8. Processor Configuration: a) Processors: Select One. 9....