biemond-oradb
biemond-oradb copied to clipboard
db_{control,listener} refreshonly always do a service restart
Hi Biemond,
What I wanted to achieve is stop the db instance only once after the opatchupgrade, then apply the patches but for some reason the stop db is being trigger every puppet run.
``Notice: /Stage[main]/Profile::Oracledb::Non_rac/Db_control[orclcondb stop_for_patching]/ensure: ensure changed 'start' to 'stop'`
oradb::opatchupgrade { '12.1.0.1.10':
oracle_home => $oracle_home,
patch_file => 'p6880880_121010_SOLARIS64.zip',
csi_number => undef,
support_id => undef,
opversion => '12.1.0.1.10',
user => $oracle_user,
group => $oracle_group,
download_dir => '/install',
puppet_download_mnt_point => '/var/tmp/oradb_patches',
}
db_control { 'orclcondb stop_for_patching':
ensure => 'stop',
instance_name => 'orclcondb',
oracle_product_home_dir => $oracle_home,
os_user => $oracle_user,
refreshonly => true,
subscribe => Oradb::Opatchupgrade[,'12.1.0.1.10'],
}
oradb::opatch { '21948354':
ensure => 'present',
oracle_product_home => $oracle_home,
patch_id => '21948354',
patch_file => 'p22191659_121020_SOLARIS64.zip',
clusterware => false,
use_opatchauto_utility => true,
bundle_sub_patch_id => undef,
user => $oracle_user,
group => $oracle_group,
ocmrf => true,
puppet_download_mnt_point => '/var/tmp/oradb_patches',
require => Db_listener[ 'orclcondb stop_for_patching'],
`
Hi,
it looks like if opatchupgrade also goes off, maybe opversion => '12.1.0.1.10' is not the same with it retieved.
or you have somewhere a require to Db_control[ 'orclcondb stop_for_patching']
Can you run it with --debug this will show you why Db_control[ 'orclcondb stop_for_patching'] is started
Cursory looks seems the correct opatch is being returned. Another interesting point is if I put a another resource block e.g file {} and have this db_control subscribe to it, it's exhibiting the same behavior.
Debug: Loading facts from /var/opt/lib/pe-puppet/lib/facter/puppet_vardir.rb
Debug: oradb opatch 12.1.0.1.10
<< trimmed >>
Debug: Caching connection for https://puppserver:8140
Debug: Exec[concat_/opt/oracle/product/12.1.0.2.0/db12c/network/admin/tnsnames.ora](provider=posix): Executing check '/var/opt/lib/pe-puppet/concat/bin/concatfragments.rb -o "/var/opt/lib/pe-puppet/concat/_opt_oracle_product_12.1.0.2.0_db12c_network_admin_tnsnames.ora/fragments.concat.out" -d "/var/opt/lib/pe-puppet/concat/_opt_oracle_product_12.1.0.2.0_db12c_network_admin_tnsnames.ora" -l -t'
Debug: Executing '/var/opt/lib/pe-puppet/concat/bin/concatfragments.rb -o "/var/opt/lib/pe-puppet/concat/_opt_oracle_product_12.1.0.2.0_db12c_network_admin_tnsnames.ora/fragments.concat.out" -d "/var/opt/lib/pe-puppet/concat/_opt_oracle_product_12.1.0.2.0_db12c_network_admin_tnsnames.ora" -l -t'
Debug: instance_status /bin/ps awwx | /bin/grep -v grep | /bin/grep 'ora_smon_orclcondb'
Notice: /Stage[main]/Profile::Oracledb::Non_rac/Db_control[orclcondb stop_for_patching]/ensure: ensure changed 'start' to 'stop'
Debug: /Stage[main]/Profile::Oracledb::Non_rac/Db_control[orclcondb stop_for_patching]: The container Class[Profile::Oracledb::Non_rac] will propagate my refresh event
Info: search for patchid 21948354
Info: opatch_status for patch 21948354 command: /opt/oracle/product/12.1.0.2.0/db12c/OPatch/opatch lsinventory -patch_id -oh /opt/oracle/product/12.1.0.2.0/db12c -invPtrLoc /var/opt/oracle/oraInst.loc
mesg: cannot change mode
This code snippet however works as expected.
oradb::opatchupgrade { '12.1.0.1.10':
oracle_home => $oracle_home,
patch_file => 'p6880880_121010_SOLARIS64.zip',
csi_number => undef,
support_id => undef,
opversion => '12.1.0.1.10',
user => $oracle_user,
group => $oracle_group,
download_dir => '/install',
puppet_download_mnt_point => '/var/tmp/oradb_patches',
notify => Exec[ 'stop_db_for_patching' ],
}
# We'll resort to this for now until we got the db_control sorted.
exec { 'stop_db_for_patching':
command => "${oracle_home}/bin/sqlplus /nolog <<-EOF
connect / as sysdba
shutdown immediate
EOF",
environment => [ "ORACLE_HOME=${oracle_home}", "ORACLE_SID=orclcondb",
"LD_LIBRARY_PATH=${oracle_home}/lib"],
logoutput => true,
user => $oracle_user,
onlyif => "/bin/ps -ef | /bin/grep -v grep | /bin/grep 'ora_smon_orclcondb'",
refreshonly => true,
}
you might want to use an unless with opatch_version and/or oradb::is_oracle_patch_installed'
Hello, be carefull the last opatch version for a 12.1 db is a 12.2.0.12 you can see it in Version file inside the zip ... so if you install with opatchupgrade.pp you must set opatch version to 12.2.0.12 even if your db is 12.1