Defined Type: oradb::database_pluggable

Defined in:
manifests/database_pluggable.pp

Overview

database_pluggable

add or delete a pluggable database to a container database

Examples:

pluggable database


oradb::database_pluggable{'pdb1':
  ensure                   => 'present',
  version                  => '12.1',
  oracle_home_dir          => '/oracle/product/12.1/db',
  user                     => 'oracle',
  group                    => 'dba',
  source_db                => 'orcl',
  pdb_name                 => 'pdb1',
  pdb_admin_username       => 'pdb_adm',
  pdb_admin_password       => 'Welcome01',
  pdb_datafile_destination => "/oracle/oradata/orcl/pdb1",
  create_user_tablespace   => true,
  log_output               => true,
}

Parameters:

  • version (Enum['12.1', '12.2']) (defaults to: lookup('oradb::version'))

    Oracle installation version

  • oracle_home_dir (String) (defaults to: undef)

    full path to the Oracle Home directory inside Oracle Base

  • user (String) (defaults to: lookup('oradb::user'))

    operating system user

  • group (String) (defaults to: lookup('oradb::group'))

    the operating group name for using the oracle software

  • log_output (Boolean) (defaults to: false)

    log all output

  • ensure (Enum['present', 'absent']) (defaults to: 'present')

    add or delete the pluggable container

  • source_db (String) (defaults to: undef)

    the source container database

  • pdb_name (String) (defaults to: undef)

    the pluggable DB name

  • pdb_datafile_destination (String) (defaults to: undef)

    the pluggable DB datafile location

  • pdb_admin_username (String) (defaults to: 'pdb_adm')

    the pluggable DB admin username

  • pdb_admin_password (String) (defaults to: undef)

    the pluggable DB admin password

  • create_user_tablespace (Boolean) (defaults to: true)

    create user tablespace for the pluggable DB



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'manifests/database_pluggable.pp', line 36

define oradb::database_pluggable(
  Enum['present', 'absent'] $ensure = 'present',
  Enum['12.1', '12.2'] $version     = lookup('oradb::version'),
  String $oracle_home_dir           = undef,
  String $user                      = lookup('oradb::user'),
  String $group                     = lookup('oradb::group'),
  String $source_db                 = undef,
  String $pdb_name                  = undef,
  String $pdb_datafile_destination  = undef,
  String $pdb_admin_username        = 'pdb_adm',
  String $pdb_admin_password        = undef,
  Boolean $create_user_tablespace   = true,
  Boolean $log_output               = false,
){
  $exec_path = lookup('oradb::exec_path')

  if ( $ensure == 'present') {
    $command = "${oracle_home_dir}/bin/dbca -silent -createPluggableDatabase -sourceDB ${source_db} -pdbName ${pdb_name} -createPDBFrom DEFAULT -pdbAdminUserName ${pdb_admin_username} -pdbAdminPassword ${pdb_admin_password} -pdbDatafileDestination ${pdb_datafile_destination} -createUserTableSpace ${create_user_tablespace}"

    exec { "dbca pdb execute ${title}":
      command   => $command,
      timeout   => 0,
      path      => $exec_path,
      cwd       => $oracle_home_dir,
      user      => $user,
      group     => $group,
      creates   => $pdb_datafile_destination,
      logoutput => $log_output,
    }
  } else {
    $command = "${oracle_home_dir}/bin/dbca -silent -deletePluggableDatabase -sourceDB ${source_db} -pdbName ${pdb_name}"

    exec { "dbca pdb execute ${title}":
      command   => $command,
      timeout   => 0,
      path      => $exec_path,
      cwd       => $oracle_home_dir,
      user      => $user,
      group     => $group,
      onlyif    => "ls ${$pdb_datafile_destination}",
      logoutput => $log_output,
    }

  }
}