Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sureshr7 opened this issue Jan 17, 2020 · 7 comments
Open

Comments

@sureshr7
Copy link

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
Copy link
Author

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
Copy link
Author

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

@biemond
Copy link
Owner

biemond commented Jan 17, 2020

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

@sureshr7
Copy link
Author

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

@biemond
Copy link
Owner

biemond commented Jan 17, 2020

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
Copy link
Author

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
Copy link
Author

Hi Edwin,

Is it possible to push this fix ?

Thanks
Suresh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants