biemond / biemond-oradb

Puppet Oracle Database Module
Apache License 2.0
59 stars 113 forks source link

using oradb::autostartdatabase for multiple databases per server failing #267

Open sureshr7 opened 4 years ago

sureshr7 commented 4 years ago

Hi,

oradb::autostartdatabase { 'DEV': oracle_home => '/u01/oracle/product/12.1.0.2/db', db_name => 'DEV', user => 'oracle', service_name => 'DEV', } oradb::autostartdatabase { 'STG': oracle_home => '/u01/oracle/product/12.1.0.2/dbstage', db_name => 'STG', user => 'oracle', service_name => 'STG', } Using above code on a single server fails with error message

Error while evaluating a Resource Statement, Duplicate declaration: Class[Oradb::Prepareautostart] is already declared at (file: modules/oradb/manifests/autostartdatabase.pp, line: 27); cannot redeclare (file:modules/oradb/manifests/autostartdatabase.pp, line: 27)

Thanks Suresh

sureshr7 commented 4 years ago

Looks like using virtual resource solves this problem. I will test and confirm

@oradb::autostartdatabase { 'DEV': oracle_home => '/u01/oracle/product/12.1.0.2/db', db_name => 'DEV', user => 'oracle', service_name => 'DEV', } @oradb::autostartdatabase { 'STG': oracle_home => '/u01/oracle/product/12.1.0.2/dbstage', db_name => 'STG', user => 'oracle', service_name => 'STG', }

sureshr7 commented 4 years ago

Still its failing with same error if i use realize in the class

biemond commented 4 years ago

yep, need to make a tempate Prepareautostart for this, class can only exists once.

sureshr7 commented 4 years ago

Thanks for the quick ack Edwin. Any workarounds to handle this ?

biemond commented 4 years ago

I think I need to make this a define https://github.com/biemond/biemond-oradb/blob/puppet4_3_data/manifests/prepareautostart.pp but maybe you only need to define it once and update oratab to y for the 2nd instance. I think the service will start both.

sureshr7 commented 4 years ago

yes. You are correct. making https://github.com/biemond/biemond-oradb/blob/puppet4_3_data/manifests/prepareautostart.pp as define and removing the class call in https://github.com/biemond/biemond-oradb/blob/puppet4_3_data/manifests/autostartdatabase.pp fixes the problem

Call both resources explicity
oradb::autostartdatabase { $db_name: oracle_home => $oracle_home, db_name => $db_name, user => $user, service_name => $db_name, }

oradb::prepareautostart{ $db_name: oracle_home => $oracle_home, user => $user, service_name => $db_name, }

sureshr7 commented 4 years ago

Hi Edwin,

Is it possible to push this fix ?

Thanks Suresh