Overview

This resource allows you to manage an Oracle Database.

This type allows you to create a database. In one of it’s simplest form:

ora_database{'oradb':
  ensure          => present,
  oracle_base     => '/opt/oracle',
  oracle_home     => '/opt/oracle/app/11.04',
  control_file    => 'reuse',
}

The ora_database type uses structured types for some of the parameters. Here is part of an example with some of these structured parameters filled in:

ora_database{'bert':
  logfile_groups => [
      {file_name => 'test1.log', size => '10M'},
      {file_name => 'test2.log', size => '10M'},
    ],
  ...
  default_tablespace => {
    name      => 'USERS',
    datafile  => {
      file_name  => 'users.dbs',
      size       => '1G',
      reuse      =>  true,
    },
    extent_management => {
      type          => 'local',
      autoallocate  => true,
    }
  },
  ...
  datafiles       => [
    {file_name   => 'file1.dbs', size => '1G', reuse => true},
    {file_name   => 'file2.dbs', size => '1G', reuse => true},
  ],
  ...
  default_temporary_tablespace => {
    name      => 'TEMP',
    type      => 'bigfile',
    tempfile  => {
      file_name  => 'tmp.dbs',
      size       => '1G',
      reuse      =>  true,
      autoextend => {
        next    => '10K',
        maxsize => 'unlimited',
      }
    },
    extent_management => {
      type          => 'local',
      uniform_size  => '1G',
    },
  },
  ....
  undo_tablespace   => {
    name      => 'UNDOTBS',
    type      => 'bigfile',
    datafile  => {
      file_name  => 'undo.dbs',
      size       => '1G',
      reuse      =>  true,
    }
  },
  ....
  sysaux_datafiles => [
    {file_name   => 'sysaux1.dbs', size => '1G', reuse => true},
    {file_name   => 'sysaux2.dbs', size => '1G', reuse => true},
  ]

Experience the Power of Puppet for Oracle

If you want to play and experiment with Puppet and Oracle, please take a look at our playgrounds. At our playgrounds, we provide you with a pre-installed environment, where you experiment fast and easy.

Attributes

Attribute Name Short Description
archivelog Enable or disable archive log.
autostart Add autostart to the oratab entry.
character_set Specify the character set the database uses to store data.
config_scripts environment after the initial database fileset has been created.
contained_by Specify the SID of the container database where the pluggable databases should be part of.
container_database Enable or disable the containers and adding pluggable databases
   
control_file Specify reuse, to reuse existing control files.
daemonized Use daemonized sqlplus process for processing.
datafiles One or more files to be used as datafiles.
default Oracle types.
default_tablespace Specify the default tablespace.
default_temporary_tablespace Specify the default temporary tablespace.
disable_corrective_change Disable the modification of a resource when Puppet decides it is a corrective change.
disable_corrective_ensure Disable the creation or removal of a resource when Puppet decides is a corrective change.
ensure The basic property that the resource should be in.
extent_management Specify the extent management.
file_name_convert Enable or disable the containers and adding pluggable databases
   
flashback Enable or disable flashback database.
force_logging Enable or disable the FORCE LOGGING mode.
init_ora_content The content of the init.ora parameters.
install_group The oracle_install group.
instances One or more instances to be enables on the database
   
logfile The file to be used as redo log file.
logfile_groups Specify the logfile groups.
maxdatafiles The initial sizing of the datafiles section of the control file.
maxinstances The maximum number of instances that can simultaneously have this database mounted and open.
maxlogfiles define the limits for the redo log.
maxloghistory define the limits for the redo log.
maxlogmembers The maximum number of members, or copies, for a redo log file group.
name The database name.
national_character_set The national character set used to store data in columns.
options Specify the options that need to be enabled in the database.
oracle_base The oracle_base directory.
oracle_home The oracle_home directory.
oracle_user The oracle user.
oracle_user_password The password for the oracle os user.
overwrite Overwrite existing admin home yes or no.
pdb_admin_password Specify the password for the admin user of the pluggable database.
pdb_admin_user Specify the admin user for the pluggable database.
provider resource.
scan_name The SCAN name for a RAC cluster.
scan_port The scan port number for a RAC cluster.
spfile_location Location of the database’s spfile.
state State of the database, either running, mounted or stopped.
sys_password The password of the SYS account.
sysaux_datafiles One or more files to be used as sysaux datafiles.
system_password The password of the SYSTEM account.
tablespace_type Use this set the default type created tablespaces including SYSTEM and SYSAUX tablespaces.
timeout Timeout for applying a resource in seconds.
timezone Set the time zone of the database.
undo_tablespace Specify the default tablespace.

archivelog

Enable or disable archive log.

Valid values are enabled, disabled.

Back to overview of ora_database

autostart

Add autostart to the oratab entry.

Valid values are true, false.

Back to overview of ora_database

character_set

Specify the character set the database uses to store data.

Back to overview of ora_database

config_scripts

A list of one or more files to be used to create the catalog and/or custom environment after the initial database fileset has been created.

Use this syntax to specify all attributes:

ora_database{'dbname':
  ...
  config_scripts  => [
    { sr01 => template('myconfig/Catalog.sql.erb'),      },
    { sr02 => template('myconfig/Cwmlite.sql.erb'),      },
    { sr03 => template('myconfig/Xdb_Protocol.sql.erb'), },
    { sr04 => template('myconfig/Grants.sql.erb'),       },
  ],
}

Back to overview of ora_database

contained_by

Specify the SID of the container database where the pluggable databases should be part of. This parameter is mandatory when creating a pluggable databases.

ora_database { 'my_database':
  ensure             => present,
  ...
  contained_by       => 'CDB',
  ...
}

Back to overview of ora_database

container_database

Enable or disable the containers and adding pluggable databases

Using this parameter, you can enable this database,beeing a host for plugganle databases.

ora_database { 'my_database':
  ensure             => present,
  ...
  container_database => 'enabled',
  ...
}

Will enable this database to be a host for pluggable databases. This feature needs Oracle 12 or higher. If you use this feature on a database before Oracle 12, SQL will throw an error.

Valid values are enabled, disabled.

Back to overview of ora_database

control_file

Specify reuse, to reuse existing control files.

Back to overview of ora_database

daemonized

Use daemonized sqlplus process for processing.

By default Puppet will create a new sqlplus session for every set of information it needs to retrieve. This can put some strain on the Oracle database. When you want to decrease this, you can set the daemonized setting to true. This wil create a single daemon process for every database it needs to connect to and share this process for all sql processing.

This is however more prone to instability. So use with care.

The default value is true e.g. run sqlplus daemonized

ora_database {'mydb'
  ...
  daemonized => true,
  ...
}

Back to overview of ora_database

datafiles

One or more files to be used as datafiles.

Use this syntax to specify all attributes:

ora_database{'dbname':
  ...
  datafiles       => [
    {file_name   => 'file1.dbs', size => '10G', reuse => true},
    {file_name   => 'file2.dbs', size => '10G', reuse => true},
  ]
}

Back to overview of ora_database

default

When you set this value to true, this database will be used when no explcit sid is specified on the Oracle types.

Many of the of the oracle types, allow you to NOT specfify the sid and use a default sid. This makes puppet manifests easier readable and less verbose when creating a manifest for a single database.

The databasse for which you set the property default to true, is the database that will be used for those operations.

Valid values are true, false.

Back to overview of ora_database

default_tablespace

Specify the default tablespace.

Use this syntax to specify all attributes:

ora_database{'dbname':
  ...
  default_tablespace => {
    name      => 'USERS',
    datafile  => {
      file_name  => 'users.dbs',
      size       => '10G',
      reuse      =>  true,
    }
    extent_management => {
      type          => 'local',
      autoallocate  => true, (mutual exclusive with uniform size)
      uniform_size  => '5G',
    }
  }
}

Back to overview of ora_database

default_temporary_tablespace

Specify the default temporary tablespace.

Use this syntax to specify all attributes:

ora_database{'dbname':
  ...
  default_temporary_tablespace => {
    name      => 'TEMP',
    tempfile  => {
      file_name  => 'tmp.dbs',
      size       => '10G',
      reuse      =>  true,
      autoextend => {
        maxsize => 'unlimited',
        next    => '1G',
      }
    }
    extent_management => {
      type          => 'local',
      autoallocate  => true, (mutual exclusive with uniform segment size)
      uniform_size  => '5G',
    }
  }
}

Back to overview of ora_database

disable_corrective_change

Disable the modification of a resource when Puppet decides it is a corrective change.

(requires easy_type V2.11.0 or higher)

When using a Puppet Server, Puppet knows about adaptive and corrective changes. A corrective change is when Puppet notices that the resource has changed, but the catalog has not changed. This can occur for example, when a user, by accident or willingly, changed something on the system that Puppet is managing. The normal Puppet process then repairs this and puts the resource back in the state as defined in the catalog. This process is precisely what you want most of the time, but not always. This can sometimes also occur when a hardware or network error occurs. Then Puppet cannot correctly determine the current state of the system and thinks the resource is changed, while in fact, it is not. Letting Puppet recreate remove or change the resource in these cases, is NOT wat you want.

Using the disable_corrective_change parameter, you can disable corrective changes on the current resource.

Here is an example of this:

crucial_resource {'be_carefull':
  ...
  disable_corrective_change => true,
  ...
}

When a corrective ensure does happen on the resource Puppet will not modify the resource and signal an error:

    Error: Corrective change present requested by catalog, but disabled by parameter disable_corrective_change
    Error: /Stage[main]/Main/Crucial_resource[be_carefull]/parameter: change from '10' to '20' failed: Corrective change present requested by catalog, but disabled by parameter disable_corrective_change. (corrective)

Back to overview of ora_database

disable_corrective_ensure

Disable the creation or removal of a resource when Puppet decides is a corrective change.

(requires easy_type V2.11.0 or higher)

When using a Puppet Server, Puppet knows about adaptive and corrective changes. A corrective change is when Puppet notices that the resource has changed, but the catalog has not changed. This can occur for example, when a user, by accident or willingly, changed something on the system that Puppet is managing. The normal Puppet process then repairs this and puts the resource back in the state as defined in the catalog. This process is precisely what you want most of the time, but not always. This can sometimes also occur when a hardware or network error occurs. Then Puppet cannot correctly determine the current state of the system and thinks the resource is changed, while in fact, it is not. Letting Puppet recreate remove or change the resource in these cases, is NOT wat you want.

Using the disable_corrective_ensure parameter, you can disable corrective ensure present or ensure absent actions on the current resource.

Here is an example of this:

crucial_resource {'be_carefull':
  ensure                    => 'present',
  ...
  disable_corrective_ensure => true,
  ...
}

When a corrective ensure does happen on the resource Puppet will not create or remove the resource and signal an error:

    Error: Corrective ensure present requested by catalog, but disabled by parameter disable_corrective_ensure.
    Error: /Stage[main]/Main/Crucial_resource[be_carefull]/ensure: change from 'absent' to 'present' failed: Corrective ensure present requested by catalog, but disabled by parameter disable_corrective_ensure. (corrective)

Back to overview of ora_database

ensure

The basic property that the resource should be in.

Valid values are present, absent.

Back to overview of ora_database

extent_management

Specify the extent management.

Use this syntax to specify all attributes:

ora_database{'dbname':
  ...
  extent_management => 'local'
}

Valid values are local.

Back to overview of ora_database

file_name_convert

Specify the conversion rules for seed files of pluggable databases Enable or disable the containers and adding pluggable databases

ora_database { 'my_database':
  ensure             => present,
  ...
  container_database => 'enabled',
  file_name_convert  => {/oracle/dbs/' =>'/oracle/pdbseed/',}
  ...
}

This will create a container database and convert all file names from the seed database containing /oracle/dbs/ to /oracle/pdbseed.

Back to overview of ora_database

flashback

Enable or disable flashback database.

Valid values are enabled, disabled.

Back to overview of ora_database

force_logging

Enable or disable the FORCE LOGGING mode.

Valid values are enabled, disabled.

Back to overview of ora_database

init_ora_content

The content of the init.ora parameters. The next set of parameters are managed by the ora_database custom type:

  • cluster_database
  • remote_listener
  • control_files
  • *.instance_number
  • *.instance_thread
  • *.undo_tablespace

An example:

ora_database{'db1':
  ...
  init_ora_content => template('database/my_init_ora_content.ora.erb')
  ...
}

Back to overview of ora_database

install_group

The oracle_install group.

Back to overview of ora_database

instances

One or more instances to be enables on the database

Use this syntax to specify all attributes:

ora_database{'dbname':
  ...
  instances       => {
    instance1   => host1,
    instance2   => host2,
  }
}

Back to overview of ora_database

logfile

The file to be used as redo log file.

Back to overview of ora_database

logfile_groups

Specify the logfile groups. Array of hashes: [ {file_name => ‘<abs_path_to_file|ASM diskgroup>’, # String, optional when using OMF group => 1, # Integer, optional. When not specified then this property behaves like a parameter(i.e. will not be managed). size => ‘1G’ # String, optional default 100M thread => 1, # Integer, optional default 1 type => ‘<ONLINE|STANDBY>’ # String, optional default ‘ONLINE’ reuse => <true|false> # Boolean, optional } ]

Use this property to specify all attributes of the logfile groups. The most simple form is to specify only the ‘group’ attribute. This requires that OMF is used. The size will be 100M by default and the logfile member(s) will be placed in the location that is specified by the database parameters db_create_online_log_dest_[1..5] or db_create_file_dest and/or db_recovery_file_dest:

ora_database{'dbname':
  ...
  logfile_groups => [
      {group => 1, reuse => true},
      {group => 2, reuse => true},
      {group => 3, reuse => true},
    ],
}

When you want to specify more logfiles per loggroup, use specific log group numbers, assign them to a specific thread and/or create standby logfiles, you need to use the extended implementation:

ora_database{'dbname':
  ...
  logfile_groups => [
      {group => 10, file_name => '/path/to/redo10a.log', size => '10M', reuse => true},
      {group => 10, file_name => '/path/to/redo10b.log', size => '10M', reuse => true},
      {group => 20, file_name => '/path/to/redo20a.log', size => '10M', reuse => true},
      {group => 20, file_name => '/path/to/redo20b.log', size => '10M', reuse => true},
      {group => 30, file_name => '/path/to/redo30a.log', size => '10M', thread => 2, reuse => true},
      {group => 30, file_name => '/path/to/redo30b.log', size => '10M', thread => 2, reuse => true},
      {group => 40, file_name => '/path/to/redo40a.log', size => '10M', thread => 2, reuse => true},
      {group => 40, file_name => '/path/to/redo40b.log', size => '10M', thread => 2, reuse => true},
      {group => 50, file_name => '/path/to/redo_stby50a.log', size => '10M', type => 'STANDBY', reuse => true},
      {group => 50, file_name => '/path/to/redo_stby50b.log', size => '10M', type => 'STANDBY', reuse => true},
      {group => 60, file_name => '/path/to/redo_stby60a.log', size => '10M', type => 'STANDBY', reuse => true},
      {group => 60, file_name => '/path/to/redo_stby60b.log', size => '10M', type => 'STANDBY', reuse => true},
      {group => 70, file_name => '/path/to/redo_stby70a.log', size => '10M', type => 'STANDBY', reuse => true},
      {group => 70, file_name => '/path/to/redo_stby70b.log', size => '10M', type => 'STANDBY', reuse => true},
      {group => 80, file_name => '/path/to/redo_stby80a.log', size => '10M', thread => 2, type => 'STANDBY', reuse => true},
      {group => 80, file_name => '/path/to/redo_stby80b.log', size => '10M', thread => 2, type => 'STANDBY', reuse => true},
      {group => 90, file_name => '/path/to/redo_stby90a.log', size => '10M', thread => 2, type => 'STANDBY', reuse => true},
      {group => 90, file_name => '/path/to/redo_stby90b.log', size => '10M', thread => 2, type => 'STANDBY', reuse => true},
      {group => 100, file_name => '/path/to/redo_stby100a.log', size => '10M', thread => 2, type => 'STANDBY', reuse => true},
      {group => 100, file_name => '/path/to/redo_stby100b.log', size => '10M', thread => 2, type => 'STANDBY', reuse => true},
    ],
}

Back to overview of ora_database

maxdatafiles

The initial sizing of the datafiles section of the control file.

Back to overview of ora_database

maxinstances

The maximum number of instances that can simultaneously have this database mounted and open.

Back to overview of ora_database

maxlogfiles

define the limits for the redo log.

Back to overview of ora_database

maxloghistory

define the limits for the redo log.

Back to overview of ora_database

maxlogmembers

The maximum number of members, or copies, for a redo log file group.

Back to overview of ora_database

name

The database name.

Back to overview of ora_database

national_character_set

The national character set used to store data in columns.

Back to overview of ora_database

options

Specify the options that need to be enabled in the database.

ora_database{‘dbname’: … options => [ ‘OWM’, ‘JServer’, ‘CTX’, ‘ORD’, ‘IM’, ‘OLAP’, ‘SDO’, # Requires XDB(default), JServer and ORD ‘OLS’, ‘Sample’, # Requires installation of Oracle Database Examples ‘APEX’, ‘DV’ ], }

Back to overview of ora_database

oracle_base

The oracle_base directory.

Back to overview of ora_database

oracle_home

The oracle_home directory.

Back to overview of ora_database

oracle_user

The oracle user.

Back to overview of ora_database

oracle_user_password

The password for the oracle os user. Only applicable for Windows systems.

Back to overview of ora_database

overwrite

Overwrite existing admin home yes or no.

When this parameter is set to true, Puppet will (possibly) overwrite an existing admin home, when it determines the database does not exist. To make sure no destructive things happen to existing databases, the default is false, e.g. no overwrite.

You can set this value to true when (for example for CI purposes), you need to recreate a database with the same name.

When Puppet determines that it needs to create a new database, and the admin directory does exist, and overwrite is set to false, Puppet will throw an error and not create the database,

Error: /u01/app/oracle/admin/DB1222 or other sid related directories already exists. Not overwriting.
Error: /Stage[main]/Main/Ora_database[DB1222]/ensure: change from 'absent' to 'present' failed: /u01/app/oracle/admin/DB1222 or other sid related directories already exists. Not overwriting.

Valid values are true, false.

Back to overview of ora_database

pdb_admin_password

Specify the password for the admin user of the pluggable database. This parameter is mandatory when creating a pluggable databases.

ora_database { ‘my_database’: ensure => present, … pdb_admin_password => ‘password’, … }

Back to overview of ora_database

pdb_admin_user

Specify the admin user for the pluggable database. This parameter is mandatory when creating a pluggable databases.

ora_database { ‘my_database’: ensure => present, … pdb_admin_user => ‘password’, … }

Back to overview of ora_database

provider

The specific backend to use for this ora_database resource. You will seldom need to specify this — Puppet will usually discover the appropriate provider for your platform.Available providers are:

simple
Manage an Oracle Database

Back to overview of ora_database

scan_name

The SCAN name for a RAC cluster. This parameter is only used when you are creating a RAC database by specifying the instances parameter. Here is an example:

ora_database{'db':
  ...
  instances   => {'db1' => 'node1', 'db2' => 'node2'},
  scan_name   => 'scan',
  scan_port   => '1521',
}

Back to overview of ora_database

scan_port

The scan port number for a RAC cluster. This parameter is only used when you are creating a RAC database by specicying the instances parameter. Here is an example:

ora_database{'db':
  ...
  instances   => {'db1' => 'node1', 'db2' => 'node2'},
  scan_name   => 'scan',
  scan_port   => '1521',
}

Back to overview of ora_database

spfile_location

Location of the database’s spfile. If you specify this paramater, a spfile will be created at the specified location. If you don’t specify this parameter no spfile will be created.

You can use this parameter like this:

ora_database{'db1':
  ...
  spfile_location => '/opt/oracle/...../dbs/',
}

or

ora_database{'db1':
  ...
  spfile_location => '+RECODG',
}

Back to overview of ora_database

state

State of the database, either running, mounted or stopped.

Valid values are running, stopped, mounted.

Back to overview of ora_database

sys_password

The password of the SYS account. This parameter is mandatory when creating a (container) database.

Back to overview of ora_database

sysaux_datafiles

One or more files to be used as sysaux datafiles.

Use this syntax to specify all attributes:

ora_database{'dbname':
  ...
  sysaux_datafiles       => [
    {file_name   => 'sysaux1.dbs', size => '10G', reuse => true},
    {file_name   => 'sysaux2.dbs', size => '10G', reuse => true},
  ]
}

Back to overview of ora_database

system_password

The password of the SYSTEM account. This parameter is mandatory when creating a (container) database.

Back to overview of ora_database

tablespace_type

Use this set the default type created tablespaces including SYSTEM and SYSAUX tablespaces.

Valid values are bigfile, smallfile.

Back to overview of ora_database

timeout

Timeout for applying a resource in seconds.

To be sure no Puppet operation, hangs a Puppet run, all operations have a timeout. When this timeout expires, Puppet will abort the current operation and signal an error in the Puppet run.

With this parameter, you can specify the length of the timeout. The value is specified in seconds. In this example, the timeout is set to 600 seconds.

ora_type{ ...:
  ...
  timeout => 600,
}

The default value for timeout is 300 seconds.

Back to overview of ora_database

timezone

Set the time zone of the database.

Back to overview of ora_database

undo_tablespace

Specify the default tablespace.

Use this syntax to specify all attributes:

ora_database{'dbname':
  ...
  undo_tablespace => {
    name      => 'UNDOTBS',
    type      => 'bigfile',
    datafile  => {
      file_name  => 'undo.dbs',
      size       => '10G',
      reuse      =>  true,
    }
  }
}

Back to overview of ora_database