Oracle Database Automation Controller (oracle-database)

Copyright 2014 © LimePoint Pty Ltd. All rights reserved.

Welcome to the MintPress Oracle Database automation controller.

This gem provides support for the installation, patching, and configuration of Oracle Database and Grid Infrastructure software and configuring Oracle Databases.

Key Information (oracle-database)

Name: oracle-database
Supported Versions: [ 11.2, 12.1, 12.2, 18.x, 19.x ] Dependencies:
- LimePoint Automation Suite RPC Utils
- MintPress Utilities
- MintPress Logger
- MintPress Common
- Oracle Java Automation Controller

Example: …

require 'oracle-database'

secret = Mint::Secret.new("welcome1")
puts "Secret: #{secret}"
puts "Secret Value: #{secret.value}"

MintPress::Infrastructure::TransportFactory.new(connect_user: 'oracle',
                                                final_user: 'oracle',
                                                keys: [ "~/unpriv.key" ],
                                                admin_connect_user: 'root',
                                                admin_final_user: 'root',
                                                keys: [ "~/priv.key" ])

host1 = MintPress::Infrastructure::Host.new(name: "dbhost1.mintpress.io")

java_opts={
    version: '1.8.0_172',
    java_home: "/oracle/app/xxx/java",
    owner: 'oracle',
    group: 'oinstall',
    software_stage: '/media/stage/jdk/jdk-8u172-linux-x64.tar.gz'
}
java_installation1 = MintPress::OracleJava::Installation.new(java_opts.merge(host: host1))

# The installation method for Oracle database has changed since version 18c and above
# The software_stage for Oracle database versions up to 12.2 should be unzipped and a full patch of the unzipped location should be provided.
# For database version 18c and above the software_stage should be supplied as the zip file for the Oracle database binary.

db_opts={
    version: '19.0.0',
    java_home: java_opts[:java_home],
    oracle_home: '/oracle/app/xxx/db/19.0.0',
    oracle_base: '/oracle/app/xxx',
    inventory_location: '/oracle/app/xxx/oraInventory',
    install_type: 'INSTALL_DB_SWONLY',
    edition: 'EE',
    owner: 'oracle',
    group: 'oinstall',
    group_osdba: 'dba',
    group_osoper: 'oper',
    group_dgdba: 'dgdba',
    group_osbackupdba: 'backupdba',
    group_oskmdba: 'kmdba',
    group_osracdba: 'dba',
    software_stage: '/media/stage/rdbms/Linux-x86_64/19.0.0/database/LINUX.X64_193000_db_home.zip',
    opatch_autoupdate: true,
    opatch_autoupdate_file: '/media/stage/OPatch/p6880880_190000_Linux-x86-64.zip'
}

db_installation1 = MintPress::OracleDatabase::Installation.new(db_opts.merge(java: java_installation1))

patch_details={ name: '30869156',
                stage: '/media/stage/rdbms/Linux-x86_64/19.0.0/database/patches'
              }

db_installation1.add_patch(patch_details)

db_opts = { name: "FOODB",
            db_username: 'sys',
            db_password: secret,
            nodes: db_installation1.node
}

database = MintPress::OracleDatabase::Database.new(db_opts)

# Install software
java_installation1.install
db_installation1.install
db_installation1.patches.each { | x | x.apply }

puts db_installation1.installed_version
puts db_installation1.version_numeric(db_installation1.installed_version).to_s

puts "Database Nodes ..."
database.nodes.each do | k,n |
  puts "Node Name: #{n.name}"
  puts "Transport: #{n.transport.host}"
  puts "node.database.name: #{n.database.name}"
  puts "node.database.cdb: #{n.database.cdb}"
end

p = MintPress::OracleDatabase::Parameter.new(name: "processes", value: 2000, scope: "both")
database.add_parameter(p)

# Set or reset database parameters
# database.parameters.each do | p,v |
#   info "  DB Parameter [ #{p} ] = #{v.value} with SCOPE [ #{v.scope} ]"
#   # Set parameter
#   v.set
#   # Reset parameter
#   v.reset
# end

# Create the database
database.create
# database.create(template: "/tmp/FMW_MetadataRepository.dbc.erb")

# Delete the database
database.delete

Harvesting

Configuration harvesting is native to the MintPress::OracleDatabase::Database class.

require 'oracle-database'

secret = Mint::Secret.new("welcome1")
puts "Secret: #{secret}"
puts "Secret Value: #{secret.value}"

transport_options = {}
transport_options[:user]            = "vagrant"
transport_options[:keys]            = ["~/Development/Workspaces/LimePoint/environmint-chef-repo/chef-repo/cookbooks/oracle-database/.kitchen/kitchen-vagrant/dataguard1-oraclelinux-610/.vagrant/machines/default/virtualbox/private_key"]
transport_options[:port]            = 2222
transport_options[:sudo_user]       = "oracle"
transport_options[:sudo_shell_type] = "su"

transport_factory=LASRpcUtils::TransportFactory.new(default_type: 'ssh', default_transport_options: transport_options)
transport1 = transport_factory.transport('dataguard1-oraclelinux-610')

java_opts={
    version: '1.8.0_172',
    java_home: "/oracle/app/xxx/java",
    owner: 'oracle',
    group: 'oinstall',
    software_stage: '/media/stage/jdk/jdk-8u172-linux-x64.tar.gz'
}

db_opts={
    version: '12.2.0.1',
    java_home: java_opts[:java_home],
    oracle_home: '/oracle/app/xxx/db/19.0.0',
    oracle_base: '/oracle/app/xxx',
    inventory_location: '/oracle/app/xxx/oraInventory',
    install_type: 'INSTALL_DB_SWONLY',
    edition: 'EE',
    owner: 'oracle',
    group: 'oinstall',
    group_osdba: 'dba',
    group_osoper: 'oper',
    group_dgdba: 'dgdba',
    group_osbackupdba: 'backupdba',
    group_oskmdba: 'kmdba',
    group_osracdba: 'dba',
    software_stage: '/media/stage/rdbms/Linux-x86_64/19.0.0/database/LINUX.X64_193000_db_home.zip',
    opatch_autoupdate: true,
    opatch_autoupdate_file: '/media/stage/OPatch/p6880880_190000_Linux-x86-64.zip'
}

java_installation1 = MintPress::OracleJava::Installation.new(java_opts.merge(transport: transport1))

db_installation1 = MintPress::OracleDatabase::Installation.new(db_opts.merge(java: java_installation1))

# Harvest patches applied to the ORACLE_HOME installation
db_installation1.harvest
db_installation1.patches.each do | p |
  puts "Patch ARU: #{p.aru}"
end

License & Authors

  • Author:: LimePoint (support@limepoint.com)

# MintPress® - Automation and Configuration Management Platform
#
# Copyright © 2018 LimePoint. All rights reserved.
#
# This program and its contents are confidential and owned by LimePoint.
# Only licenced users are permitted to access and use of this file.
# This program (or any part of it) may not be disclosed, copied or used
# except as expressly permitted in LimePoint’s End User Licence Agreement.
#
# LimePoint® and MintPress® are Registered Trademarks of LimePoint
# For more information contact LimePoint at http://www.limepoint.com