Tuesday, May 16, 2017

Install oracle 11g on Scientific Linux 6,Oracle Teacher Sourav,Kolkata 09748184075

installing oracle 11g on scientific linux 6

as root

yum -y install openssh-server

service sshd start

chkconfig sshd on

yum -y install nano

nano /etc/group

make the line look like this

wheel:x:10:root,sourav

save and exit

nano /etc/pam.d/su

uncomment the following two lines to make sourav as powerful 

as root

# Uncomment the following line to implicitly trust users in 

the "wheel" group.

auth            sufficient      pam_wheel.so trust use_uid

# Uncomment the following line to require a user to be in the 

"wheel" group.

auth            required        pam_wheel.so use_uid


save and exit


stop and disable iptables by

/etc/rc.d/init.d/iptables stop 

chkconfig iptables off 


stop and disable ip6tables by

/etc/rc.d/init.d/ip6tables stop 

chkconfig ip6tables off

disable selinux

by 

nano /etc/sysconfig/selinux

change the line 

SELINUX=enforcing to

SELINUX=disabled

save and exit

set the hostname to oracle.sourav by

nano /etc/hosts

127.0.0.1       oracle.sourav   sourav  localhost.localdomain 

localhost
::1             localhost6.localdomain6 localhost6

save and exit

nano /etc/sysconfig/network

make the file look like this

NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=oracle.sourav


save and exit

i am using dhcp so my network card file should look like this

 nano /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0

BOOTPROTO=dhcp

ONBOOT=yes

NM_CONTROLLED=no

PEERDNS=no

DNS1=8.8.8.8

DNS2=4.2.2.2


save and exit

to set the dns

  nano /etc/resolv.conf

# Generatedby NetworkManager
search google.com
nameserver 8.8.8.8
nameserver 4.2.2.2


save and exit

to stop the NetworkManager

 service NetworkMnager stop

to make sure NetworkManager won't start at the next reboot

 chkconfig NetworkManager off


to restart the network

/etc/rc.d/init.d/network restart 

 chkconfig network on 


let's reboot and let's see if everything going just fine

ok everything is fine

one more thing 

let us disable ipv6 as it is not needed here

 echo "install ipv6 /bin/true" > /etc/modprobe.d/disable-

ipv6.conf

ok everything is set 

now let's try to install oracle's dependencies 

yum -y install binutils compat-libstdc++-33 elfutils-libelf 

elfutils-libelf-devel glibc glibc-common glibc-devel gcc 

gcc-c++ libaio libaio-devel libgcc libstdc++ libstdc++-devel 

make sysstat unixODBC unixODBC-devel 

after installing now let's set some kernel parameters

nano /etc/sysctl.conf 

comment out those three lines

#net.bridge.bridge-nf-call-ip6tables = 0
#net.bridge.bridge-nf-call-iptables = 0
#net.bridge.bridge-nf-call-arptables = 0


and also comment out 

#kernel.shmmax = 4294967295


and



#kernel.shmall = 268435456


at the end add this section

net.ipv4.ip_local_port_range = 9000 65500
fs.file-max =65536
kernel.shmall = 10523004
kernel.shmmax = 6465333657
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.core.rmem_default=262144
net.core.wmem_default=262144
net.core.rmem_max=4194304
net.core.wmem_max=1048576 



save and exit

using the sysctl -p check out the output

it should be like

net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
net.ipv4.ip_local_port_range = 9000 65500
fs.file-max = 65536
kernel.shmall = 10523004
kernel.shmmax = 6465333657
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.core.rmem_default = 262144
net.core.wmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_max = 1048576


ok now let's create an user for oracle

groupadd -g 200 oinstall 

groupadd -g 201 dba 

useradd -u 440 -g oinstall -G dba -d /usr/oracle oracle 

passwd oracle

set the password

nano /etc/pam.d/login


add this line

session   required   pam_limits.so

before the line

session    optional     pam_keyinit.so force revoke

save and exit

nano /etc/security/limits.conf 

add these lines at the end


before # End of file

oracle   soft   nproc   2047
oracle   hard   nproc   16384
oracle   soft   nofile   1024
oracle   hard   nofile   65536


save and exit

nano /etc/profile

at the end add these lines

if [ $USER = "oracle" ]; then
       if [ $SHELL = "/bin/ksh" ]; then
            ulimit -p 16384
            ulimit -n 65536
       else
            ulimit -u 16384 -n 65536
       fi
 fi


save and exit

now switch to the user oracle

su oracle

cd ~

chmod 755 /usr/oracle 


mkdir /usr/oracle/app 


chmod 775 /usr/oracle/app 

mkdir /usr/oracle/oradata 

chmod 775 /usr/oracle/oradata

nano ~/.bash_profile 

at the end add these lines

umask 022
export ORACLE_BASE=/usr/oracle/app

save and exit

mkdir tmp

using winscp copy the oracle 11g installation files in the 

target machine

ok before trying to install oracle as root you need

to execute the command xhost + in the target machine

 unzip linux_11gR2_database_1of2.zip

 unzip linux_11gR2_database_2of2.zip

Now to avoid pdksh error

go to

/usr/oracle/tmp/database/stage/cvu/cv/admin

Edit cvu_config and change the following line 

CV_ASSUME_DISTID=OEL4 to CV_ASSUME_DISTID=OEL6

save and exit

source://https://unix.stackexchange.com/questions/29554/pdksh

-missing-from-rhel-6-and-centos-6


now

./database/runInstaller  as oracle

you will be presented with an error 

environment does not meet minimum requirements error

probably a bug but i still tried installing java and some 

more

steps but the same error shows up,so i ignored it and

went on

abiding by the default settings 

now when asked 

run this script 
/usr/oracle/oraInventory/orainstRoot.sh 
as root

and 

 /usr/oracle/app/product/11.2.0/dbhome_1/root.sh 

as root

and press enter for defaults

after it's done press ok

the installation should complete successfully
nano ~/.bash_profile 

export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
 export PATH=$PATH:$ORACLE_HOME/bin



source ~/.bash_profile 

rm -rf tmp 


source:https://www.server-world.info/en/note?os=Scientific_Linux_6&p=oracle11g&f=2

Wednesday, May 10, 2017

using dd command on ubuntu 16 to create iso from dvd,Sourav Bhattacharya,RHCE Faculty,Kolkata 09748184075

First check the block size and volume size using this command

isoinfo -d -i /dev/cdrom | grep -i -E 'block size|volume size'

then

dd if=/dev/cdrom of=/home/sourav/centos.iso bs=block size found from previous command 

 count=volume size found from previous command

source://https://www.thomas-krenn.com/en/wiki/Create_an_ISO_Image_from_a_source_CD_or_DVD_under_Linux

Saturday, March 25, 2017

Tuesday, March 7, 2017

from a list of companies calculate for each company the logarithmic daily return using yahoo finance and vba,vba teacher sourav,kolkata 09748184075




Option Explicit

Private Sub test_portfolio()
Application.DisplayAlerts = False
On Error Resume Next
Workbooks("table.csv").Close
Workbooks("Part3.xlsm").Activate
   Dim Symbol As String
   Dim StartDate As Date
   Dim EndDate As Date
   
   
   
   Dim StartDay As Integer
   Dim StartMonth As Integer
   Dim StartYear As Integer
   Dim EndDay As Integer
   Dim EndMonth As Integer
   Dim tempdateval As Date
   Dim previousclosingrate As Date
   
   Dim EndYear As Integer
   Dim closingrate As Double
   
   Dim URL As String
   Dim temppos As String
   
  Sheets("Portfolio").Select
  Range("A2").Select
  
   temppos = Replace(ActiveCell.Address, "$", "")
   Range(temppos).Select
   While ActiveCell.Value <> ""
   temppos = Replace(ActiveCell.Address, "$", "")
   tempdateval = CDate(ActiveCell.Offset(0, 3).Value)
   
   
     Symbol = ActiveCell.Value
     ActiveCell.Offset(0, 3).Select
     
     
     

     StartDate = CDate(ActiveCell.Value)
     
     EndDate = CDate(ActiveCell.Value)
     
     
On Error GoTo 0
'StartDate = CDate(StartDate - 1)

     StartDay = Day(StartDate)
     
     StartMonth = Month(StartDate) - 1
     
     
     StartYear = Year(StartDate)
     
     EndDay = Day(EndDate)
     
     
     EndMonth = Month(EndDate) - 1
          
     EndYear = Year(EndDate)

     URL = "http://real-chart.finance.yahoo.com/table.csv?s=" _
     & Symbol & "&d=" & EndMonth & "&e=" & EndDay & "&f=" & EndYear _
     & "&g=d&a=" & StartMonth & "&b=" & StartDay & "&c=" _
     & StartYear & "&ignore=.csv"
     
     
    ' MsgBox URL
     On Error Resume Next
     
     Workbooks.Open (URL)
       If Err.Number <> 0 Then
       GoTo comingback
       Else
       
     Cells(1, 1).CurrentRegion.Copy
     
     'Workbooks("Assets.xlsm").Activate
     
     Sheets.Add After:=Sheets(Sheets.Count)

     ActiveSheet.Name = Symbol

     ActiveSheet.Paste

     Columns(1).AutoFit
Application.CutCopyMode = False

  Workbooks("table.csv").Activate
  
  Range("E2").Select
  Selection.Copy
  Workbooks("Part3.xlsm").Activate
  Sheets("Portfolio").Select
  Range(temppos).Select
  ActiveCell.Offset(0, 4).Select
  
  
      Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
   
closingrate = CDbl(ActiveCell.Value)
ActiveCell.Value = 1

ActiveCell.Value = closingrate * (ActiveCell.Offset(0, -2).Value)
ActiveCell.Select
Selection.NumberFormat = "0.00;[Red]0.00"

Workbooks("table.csv").Activate
On Error Resume Next
ActiveWorkbook.Close
End If
 Call lastclosingrate(temppos, closingrate)

comingback:

Workbooks("Part3.xlsm").Activate
Range(temppos).Select
ActiveCell.Offset(1, 0).Select
temppos = Replace(ActiveCell.Address, "$", "")

Wend

Application.DisplayAlerts = True

End Sub

Sub lastclosingrate(ByVal temppos As String, ByVal closingratefirst As Double)

On Error Resume Next
Workbooks("table.csv").Close
Workbooks("Part3.xlsm").Activate
   Dim Symbol As String
   Dim StartDate As Date
   Dim EndDate As Date
   
   
   
   Dim StartDay As Integer
   Dim StartMonth As Integer
   Dim StartYear As Integer
   Dim EndDay As Integer
   Dim EndMonth As Integer
   Dim tempdateval As Date
   Dim previousclosingrate As Date
   
   Dim EndYear As Integer
   Dim closingratesecond As Double
   
   Dim URL As String
   'Dim temppos As String
   
  Sheets("Portfolio").Select
  
   Range(temppos).Select
  
   tempdateval = CDate(ActiveCell.Offset(0, 3).Value)
   
   
     Symbol = ActiveCell.Value
     ActiveCell.Offset(0, 3).Select
     
     
     

     StartDate = CDate(ActiveCell.Value) - 1
     
     EndDate = CDate(ActiveCell.Value) - 1
     
     
     
On Error GoTo 0
'StartDate = CDate(StartDate - 1)

     StartDay = Day(StartDate)
     
     StartMonth = Month(StartDate) - 1
     
     
     StartYear = Year(StartDate)
     
     EndDay = Day(EndDate)
     
     
     EndMonth = Month(EndDate) - 1
          
     EndYear = Year(EndDate)

     URL = "http://real-chart.finance.yahoo.com/table.csv?s=" _
     & Symbol & "&d=" & EndMonth & "&e=" & EndDay & "&f=" & EndYear _
     & "&g=d&a=" & StartMonth & "&b=" & StartDay & "&c=" _
     & StartYear & "&ignore=.csv"
     
     
    ' MsgBox UR
     
     Workbooks.Open (URL)
       If Err.Number <> 0 Then
       GoTo comingback
       Else
       
     Cells(1, 1).CurrentRegion.Copy
     
     'Workbooks("Assets.xlsm").Activate
     
     Sheets.Add After:=Sheets(Sheets.Count)

     ActiveSheet.Name = Symbol

     ActiveSheet.Paste

     Columns(1).AutoFit
Application.CutCopyMode = False

  Workbooks("table.csv").Activate
  
  Range("E2").Select
  closingratesecond = CDbl(ActiveCell.Value)
  Selection.Copy
  Workbooks("Part3.xlsm").Activate
  Sheets("Portfolio").Select
  Range(temppos).Select
  ActiveCell.Offset(0, 5).Select
  
  
      Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
   If closingratefirst <> 0 And closingratesecond <> 0 Then
   ActiveCell.Value = (closingratefirst / closingratesecond)
   Else
   ActiveCell.Value = "Not available"
   End If
   
   

ActiveCell.Select
Selection.NumberFormat = "0.00;[Red]0.00"

Workbooks("table.csv").Activate
On Error Resume Next
ActiveWorkbook.Close
End If

comingback:

Workbooks("Part3.xlsm").Activate
Range(temppos).Select

  


End Sub

Sunday, March 5, 2017

get stock data for a given date for a list of companies from yahoo finance api(historical data) using vba,vba teacher sourav,kolkata 09748184075

Option Explicit

Private Sub test_portfolio()
Application.DisplayAlerts = False
On Error Resume Next
Workbooks("table.csv").Close
Workbooks("Part3.xlsm").Activate
   Dim Symbol As String
   Dim StartDate As Date
   Dim EndDate As Date
   
   
   
   Dim StartDay As Integer
   Dim StartMonth As Integer
   Dim StartYear As Integer
   Dim EndDay As Integer
   Dim EndMonth As Integer
   Dim tempdateval As Date
   
   Dim EndYear As Integer
   Dim closingrate As Double
   
   Dim URL As String
   Dim temppos As String
   
  Sheets("Portfolio").Select
  Range("A2").Select
  
   temppos = Replace(ActiveCell.Address, "$", "")
   Range(temppos).Select
   While ActiveCell.Value <> ""
   temppos = Replace(ActiveCell.Address, "$", "")
   tempdateval = CDate(ActiveCell.Offset(0, 3).Value)
   
   
     Symbol = ActiveCell.Value
     ActiveCell.Offset(0, 3).Select
     
     
     

     StartDate = CDate(ActiveCell.Value)
     
     EndDate = CDate(ActiveCell.Value)
     
     
On Error GoTo 0
'StartDate = CDate(StartDate - 1)

     StartDay = Day(StartDate)
     
     StartMonth = Month(StartDate) - 1
     
     
     StartYear = Year(StartDate)
     
     EndDay = Day(EndDate)
     
     
     EndMonth = Month(EndDate) - 1
          
     EndYear = Year(EndDate)

     URL = "http://real-chart.finance.yahoo.com/table.csv?s=" _
     & Symbol & "&d=" & EndMonth & "&e=" & EndDay & "&f=" & EndYear _
     & "&g=d&a=" & StartMonth & "&b=" & StartDay & "&c=" _
     & StartYear & "&ignore=.csv"
     
     
    ' MsgBox URL
     On Error Resume Next
     
     Workbooks.Open (URL)
       If Err.Number <> 0 Then
       GoTo comingback
       Else
       
     Cells(1, 1).CurrentRegion.Copy
     
     'Workbooks("Assets.xlsm").Activate
     
     Sheets.Add After:=Sheets(Sheets.Count)

     ActiveSheet.Name = Symbol

     ActiveSheet.Paste

     Columns(1).AutoFit
Application.CutCopyMode = False

  Workbooks("table.csv").Activate
  
  Range("E2").Select
  Selection.Copy
  Workbooks("Part3.xlsm").Activate
  Sheets("Portfolio").Select
  Range(temppos).Select
  ActiveCell.Offset(0, 4).Select
  
  
      Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
   
closingrate = CDbl(ActiveCell.Value)
ActiveCell.Value = 1

ActiveCell.Value = closingrate * (ActiveCell.Offset(0, -2).Value)
ActiveCell.Select
Selection.NumberFormat = "0.00;[Red]0.00"

Workbooks("table.csv").Activate
On Error Resume Next
ActiveWorkbook.Close
End If

comingback:

Workbooks("Part3.xlsm").Activate
Range(temppos).Select
ActiveCell.Offset(1, 0).Select
temppos = Replace(ActiveCell.Address, "$", "")

Wend

End Sub