Oracle Client Installation with .RSP file

I recently needed to deploy an Oracle client with an .RSP file I previously had generated. As I need to supply these files to a few of my other colleagues, I created this little PowerShell script in order to allow them to hit the script, enter in the location of the .RSP file and the rest of the Oracle installation bits, and have an idea about how far along the installer is.

I did this because when you silently deploy with a .RSP file, it was silent... Not a surprise to me, but I noticed people opening up taskmgr and just watching and waiting for oui.exe and setup.exe to collapse before they called it 'done.'

[String]$startupfolder=Get-Location
$here=Get-Location
$startupfolder=$startupfolder+'\'
$responsefile=$startupfolder+'Oracle_12c_32bit_ODBCOnly.rsp'
$setuplocation = $startupfolder+'client32\setup.exe'
[String]$computernameFQDN=$env:COMPUTERNAME+'.riston.me'

if (Test-Path $responsefile) {
    Write-Host "Found our response file."

    if ( $here.ProviderPath -like "\\*" ) {
        Write-Warning "This folder MUST be local. Copy it to a local drive and run it from there. This can not be run from a network drive!!!"
        Read-Host Press Any Key to Exit....
        exit }
  


    $script = $setuplocation+" -silent "+'"ORACLE_HOSTNAME='+$computernameFQDN+'"'+' -responseFile "'+$responsefile+'"'
  write-host $script

  Read-Host Press Enter to process the above command.
  Write-Host Beginning...

    Invoke-Expression -Command $script -Verbose

    Start-Sleep -Seconds 30
  
$instances = Get-Process oui* 
$count = ($instances).count
$instances = Get-Process java*
$count += ($instances).Count


Write-Host count is now $count

if ($count -eq 0 ) {
    Write-Warning "Oui isn't running. Something went wrong. Exiting";
    exit;
    } 
        else {
        while ( $count -gt 0 ) { 
            start-sleep -Seconds 2; 
            write-host Oracle Universal Installer is currently running. Number of instances: $count; 
            $instances = Get-Process oui* 
            $count = ($instances).count
            $instances = Get-Process java*
            $count += ($instances).Count
            }

        Write-Warning "Oracle Universal Installer is finally finished! Continuing script!"
}
#################

Write-Warning "Only continue if Oracle Universal Installer announced a success!!!"

Read-Host "Do you want to continue?"

Read-Host "Are you sure?"
      
    #read-host "Press Enter when Complete..."

    [Environment]::SetEnvironmentVariable("TNS_ADMIN","C:\app\client\Riston\product\12.1.0\client_1\NETWORK\ADMIN\","Machine")

    start-sleep -Seconds 2

    Copy-Item $startupfolder\tnsnames.ora -Destination c:\app\client\Riston\Product\12.1.0\client_1\NETWORK\ADMIN\ -Verbose
    
    start-sleep -Seconds 2

    if ($env:PROCESSOR_ARCHITECTURE -eq "AMD64") {
            Invoke-Command -ScriptBlock {
            Set-Location $env:windir
            .\sysWOW64\odbcad32.exe
            } Else {
            Invoke-Command -ScriptBlock {
                 Set-Location $env:windir
                .\system32\odbcad32.exe
                }
                }
                }
    } Else {
        Write-Host "Response file not found."
        Write-Host "Restart this script in the Oracle 12.1_32bit folder"
        read-host "Press any key to exit..."
        Out-Null
        }

For those wondering, I needed to just deploy the parts required for the ODBC connector. Here is the contents of my Oracle_12c_32bit_ODBCOnly.rsp file that is referenced in the script above.

###############################################################################
## Copyright(c) Oracle Corporation 1998,2013. All rights reserved.           ##
##                                                                           ##
## Specify values for the variables listed below to customize                ##
## your installation.                                                        ##
##                                                                           ##
## Each variable is associated with a comment. The comment                   ##
## can help to populate the variables with the appropriate                   ##
## values.                    ##
##                                                                           ##
###############################################################################


#-------------------------------------------------------------------------------
# Do not change the following system generated value. 
#-------------------------------------------------------------------------------
oracle.install.responseFileVersion=/oracle/install/rspfmt_clientinstall_response_schema_v12.1.0

#-------------------------------------------------------------------------------
# This variable holds the hostname of the system as set by the user. 
# It can be used to force the installation to use an alternative   
# hostname rather than using the first hostname found on the system
# (e.g., for systems with multiple hostnames and network interfaces).
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Unix group to be set for the inventory directory.
#------------------------------------------------------------------------------- 
UNIX_GROUP_NAME=

#-------------------------------------------------------------------------------
# Inventory location.
#-------------------------------------------------------------------------------
INVENTORY_LOCATION=C:\Program Files (x86)\Oracle\Inventory

#-------------------------------------------------------------------------------
# Specify the languages in which the components will be installed.             
#
# en   : English                  ja   : Japanese                  
# fr   : French                   ko   : Korean                    
# ar   : Arabic                   es   : Latin American Spanish    
# bn   : Bengali                  lv   : Latvian                   
# pt_BR: Brazilian Portuguese     lt   : Lithuanian                
# bg   : Bulgarian                ms   : Malay                     
# fr_CA: Canadian French          es_MX: Mexican Spanish           
# ca   : Catalan                  no   : Norwegian                 
# hr   : Croatian                 pl   : Polish                    
# cs   : Czech                    pt   : Portuguese                
# da   : Danish                   ro   : Romanian                  
# nl   : Dutch                    ru   : Russian                   
# ar_EG: Egyptian                 zh_CN: Simplified Chinese        
# en_GB: English (Great Britain)  sk   : Slovak                    
# et   : Estonian                 sl   : Slovenian                 
# fi   : Finnish                  es_ES: Spanish                   
# de   : German                   sv   : Swedish                   
# el   : Greek                    th   : Thai                      
# iw   : Hebrew                   zh_TW: Traditional Chinese       
# hu   : Hungarian                tr   : Turkish                   
# is   : Icelandic                uk   : Ukrainian                 
# in   : Indonesian               vi   : Vietnamese                
# it   : Italian                                                   
#
# all_langs   : All languages
#
# Specify value as the following to select any of the languages.
# Example : SELECTED_LANGUAGES=en,fr,ja
#
# Specify value as the following to select all the languages.
# Example : SELECTED_LANGUAGES=all_langs
#-------------------------------------------------------------------------------
SELECTED_LANGUAGES=en

#-------------------------------------------------------------------------------
# Complete path of the Oracle Home
#-------------------------------------------------------------------------------  
ORACLE_HOME=C:\app\client\UserName\product\12.1.0\client_1

#-------------------------------------------------------------------------------
# Complete path of the Oracle Base.
#-------------------------------------------------------------------------------
ORACLE_BASE=C:\app\client\UserName
#--------------------------------------------------------------------------------------------
# Specify the Oracle Home user.                 
#
# Use Built-in Account or specify a Windows User Account with limited privilege to 
# install and configure the Oracle Home.
#
# Set oracle.install.IsBuiltInAccount to true if you want to use BuiltIn Account.
#
# Set oracle.install.IsBuiltInAccount to false if you want to use Windows Account
# user as Oracle Home user. 
#--------------------------------------------------------------------------------------------
oracle.install.IsBuiltInAccount=true
oracle.install.OracleHomeUserName=
oracle.install.OracleHomeUserPassword=

#------------------------------------------------------------------------------
#Name       : INSTALL_TYPE
#Datatype   : String
#Description: Installation type of the component.
#
#             The following choices are available. The value should contain
#             only one of these choices.
#               - InstantClient
#               - Administrator
#               - Runtime
#               - Custom
#
#Example    : INSTALL_TYPE = Administrator
#------------------------------------------------------------------------------
oracle.install.client.installType=Custom

#-------------------------------------------------------------------------------
# Name       : oracle.install.client.customComponents
# Datatype   : StringList
#
# This property is considered only if INSTALL_TYPE is set to "Custom"
#
# Description: List of Client Components you would like to install
#
#   The following choices are available. You may specify any
#   combination of these choices.  The components you choose should
#   be specified in the form "internal-component-name:version"
#   Below is a list of components you may specify to install.
#
# oracle.sqlj:12.1.0.1.0 -- "Oracle SQLJ"
# oracle.rdbms.util:12.1.0.1.0 -- "Oracle Database Utilities"
# oracle.javavm.client:12.1.0.1.0 -- "Oracle Java Client"
# oracle.sqlplus:12.1.0.1.0 -- "SQL*Plus"
# oracle.dbjava.jdbc:12.1.0.1.0 -- "Oracle JDBC/THIN Interfaces"
# oracle.ldap.client:12.1.0.1.0 -- "Oracle Internet Directory Client"
# oracle.rdbms.oci:12.1.0.1.0 -- "Oracle Call Interface (OCI)"
# oracle.precomp:12.1.0.1.0 -- "Oracle Programmer"
# oracle.xdk:12.1.0.1.0 -- "Oracle XML Development Kit"
# oracle.network.aso:12.1.0.1.0 -- "Oracle Advanced Security"
# oracle.oraolap.mgmt:12.1.0.1.0 -- "OLAP Analytic Workspace Manager and Worksheet"
# oracle.network.client:12.1.0.1.0 -- "Oracle Net"
# oracle.network.cman:12.1.0.1.0 -- "Oracle Connection Manager"
# oracle.network.listener:12.1.0.1.0 -- "Oracle Net Listener"
# oracle.ordim.client:12.1.0.1.0 -- "Oracle Multimedia Client Option"
# oracle.odbc:12.1.0.1.0 -- "Oracle ODBC Driver"
# oracle.has.client:12.1.0.1.0 -- "Oracle Clusterware High Availability API"
# oracle.dbdev:12.1.0.1.0 -- "Oracle SQL Developer"
# oracle.rdbms.scheduler:12.1.0.1.0 -- "Oracle Scheduler Agent" 
# oracle.ntoramts:12.1.0.1.0 -- "Oracle Services For Microsoft Transaction Server"
# oracle.ntrdbms.admin:12.1.0.1.0 -- "Oracle Administration Assistant for Windows"
# oracle.ntoledb:12.1.0.1.0 -- "Oracle Provider for OLE DB"
# oracle.ntoledb.odp_net_2:12.1.0.1.0 -- "Oracle Data Provider for .NET"
# oracle.aspnet_2:12.1.0.1.0 -- "Oracle Providers for ASP.NET" 
#
# Example    : oracle.install.client.customComponents="oracle.precomp:12.1.0.1.0","oracle.oraolap.mgmt:12.1.0.1.0","oracle.rdbms.scheduler:12.1.0.1.0"
#-------------------------------------------------------------------------------
oracle.install.client.customComponents=oracle.rdbms.util:12.1.0.1.0,oracle.javavm.client:12.1.0.1.0,oracle.sqlplus:12.1.0.1.0,oracle.rdbms.oci:12.1.0.1.0,oracle.network.client:12.1.0.1.0,oracle.network.cman:12.1.0.1.0,oracle.network.listener:12.1.0.1.0,oracle.odbc:12.1.0.1.0,oracle.ntrdbms.admin:12.1.0.1.0,oracle.ntoledb:12.1.0.1.0,oracle.ntoledb.odp_net_2:12.1.0.1.0,oracle.aspnet_2:12.1.0.1.0

#-------------------------------------------------------------------------------
# Host name to be used for by the Oracle Scheduler Agent.
# This needs to be entered in case oracle.rdbms.scheduler is selected in the
# list of custom components during custom install
#
# Example    : oracle.install.client.schedulerAgentHostName = acme.domain.com
#------------------------------------------------------------------------------
oracle.install.client.schedulerAgentHostName=

#------------------------------------------------------------------------------
# Port number to be used for by the Oracle Scheduler Agent.
# This needs to be entered in case oracle.rdbms.scheduler is selected in the
# list of custom components during custom install
#
# Example: oracle.install.client.schedulerAgentPortNumber = 1500
#------------------------------------------------------------------------------
oracle.install.client.schedulerAgentPortNumber=

#------------------------------------------------------------------------------
# Specify the auto-updates option. It can be one of the following:
#   - MYORACLESUPPORT_DOWNLOAD
#   - OFFLINE_UPDATES
#   - SKIP_UPDATES
#------------------------------------------------------------------------------
oracle.installer.autoupdates.option=SKIP_UPDATES

#------------------------------------------------------------------------------
# In case MYORACLESUPPORT_DOWNLOAD option is chosen, specify the location where
# the updates are to be downloaded.
# In case OFFLINE_UPDATES option is chosen, specify the location where the updates
# are present.
#------------------------------------------------------------------------------
oracle.installer.autoupdates.downloadUpdatesLoc=

#------------------------------------------------------------------------------
# Specify the My Oracle Support Account Username which has the patches download privileges  
# to be used for software updates.
#  Example   : [email protected]
#------------------------------------------------------------------------------
AUTOUPDATES_MYORACLESUPPORT_USERNAME=

#------------------------------------------------------------------------------
# Specify the My Oracle Support Account Username password which has the patches download privileges  
# to be used for software updates.
#
# Example    : AUTOUPDATES_MYORACLESUPPORT_PASSWORD=password
#------------------------------------------------------------------------------
AUTOUPDATES_MYORACLESUPPORT_PASSWORD=

#------------------------------------------------------------------------------
# Specify the Proxy server name. Length should be greater than zero.
#
# Example    : PROXY_HOST=proxy.domain.com 
#------------------------------------------------------------------------------
PROXY_HOST=

#------------------------------------------------------------------------------
# Specify the proxy port number. Should be Numeric and atleast 2 chars.
#
# Example    : PROXY_PORT=25 
#------------------------------------------------------------------------------
PROXY_PORT=0

#------------------------------------------------------------------------------
# Specify the proxy user name. Leave PROXY_USER and PROXY_PWD 
# blank if your proxy server requires no authentication.
#
# Example    : PROXY_USER=username 
#------------------------------------------------------------------------------
PROXY_USER=

#------------------------------------------------------------------------------
# Specify the proxy password. Leave PROXY_USER and PROXY_PWD  
# blank if your proxy server requires no authentication.
#
# Example    : PROXY_PWD=password 
#------------------------------------------------------------------------------
PROXY_PWD=

#------------------------------------------------------------------------------
# Specify the proxy realm.
#
# Example    : PROXY_REALM=metalink
#------------------------------------------------------------------------------
PROXY_REALM=


Comments

  1. Thank you for the good article.
    We are facing constant growing of data amount in both the Web and personal computers. And the more information we need to proceed the more time it takes. That is why I think that due diligence data room would be perfect for world’s needs today.

    ReplyDelete

Post a Comment

Popular Posts