From 7fa9890afc895aaa87e7ab1d4735ec8e01a47110 Mon Sep 17 00:00:00 2001 From: Stefan Wendler Date: Thu, 9 Jun 2016 15:40:57 +0200 Subject: [PATCH 1/3] using ora_home instead of install_dir --- recipes/cli_latest_patch.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/recipes/cli_latest_patch.rb b/recipes/cli_latest_patch.rb index 6e32216..1baaae7 100644 --- a/recipes/cli_latest_patch.rb +++ b/recipes/cli_latest_patch.rb @@ -45,14 +45,14 @@ unzip #{node[:oracle][:client][:install_dir]}/#{File.basename(node[:oracle][:client][:opatch_update_url])} EOH3 end - + # Making sure ocm.rsp response file is present. if !node[:oracle][:client][:response_file_url].empty? execute "fetch_response_file" do command "curl #{node[:oracle][:curl_options]} #{node[:oracle][:client][:response_file_url]}" user "oracli" group 'oracli' - cwd node[:oracle][:client][:install_dir] + cwd node[:oracle][:client][:ora_home] end else execute 'gen_response_file' do @@ -73,10 +73,10 @@ notifies :create, "ruby_block[set_latest_patch_install_flag]", :immediately notifies :create, "ruby_block[set_client_version_attr]", :immediately end - + # Set the rdbms version attribute. include_recipe 'oracle::get_cli_version' - + # Set flag indicating latest patch has been applied. ruby_block 'set_latest_patch_install_flag' do block do From efdedf54def125fac67e1f85c06117375f8e201d Mon Sep 17 00:00:00 2001 From: Stefan Wendler Date: Thu, 9 Jun 2016 15:44:49 +0200 Subject: [PATCH 2/3] some formatting --- recipes/get_version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/get_version.rb b/recipes/get_version.rb index 5d1fab4..96332ac 100644 --- a/recipes/get_version.rb +++ b/recipes/get_version.rb @@ -28,7 +28,7 @@ # - the version string: 11.2.0.3.5 in our example. ruby_block 'set_rdbms_version_attr' do block do - patch_info = %x(sudo -u oracle #{node[:oracle][:rdbms][:ora_home]}/OPatch/opatch lsinventory -bugs_fixed | grep -E '(#{node[:oracle][:rdbms][:latest_patch][:dirname]}) {3}\\1.* DATABASE PATCH SET UPDATE') + patch_info = %x(sudo -u oracle #{node[:oracle][:rdbms][:ora_home]}/OPatch/opatch lsinventory -bugs_fixed | grep -E '(#{node[:oracle][:rdbms][:latest_patch][:dirname]}) {3}\\1.* DATABASE PATCH SET UPDATE') node.set[:oracle][:rdbms][:install_info][:patch_nr] = patch_info[/(?!^.+)\b\d+/] node.set[:oracle][:rdbms][:install_info][:timestamp_str] = patch_info[/[MTWFS][a-z]+ [JFMASOND][a-z]+ \d{2} \d{2}:\d{2}:\d{2} [A-Z]+ \d{4}/] node.set[:oracle][:rdbms][:install_info][:version_str] = patch_info[/(\d+\.)+\d+/] From aa3727cf24801569570aa1006d5f7e273beb24c6 Mon Sep 17 00:00:00 2001 From: Stefan Wendler Date: Thu, 9 Jun 2016 15:51:44 +0200 Subject: [PATCH 3/3] Added timeout for DB-Creation and made optional EE components selectable during installation --- attributes/default.rb | 10 ++++++++++ recipes/createdb.rb | 8 +++++--- templates/default/db11R23.rsp.erb | 3 ++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 2f0154d..bcd3070 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -135,3 +135,13 @@ default[:oracle][:rdbms][:dbconsole][:sysman_pw] = 'sysman_pw_goes_here' default[:oracle][:rdbms][:dbconsole][:notification_email] = 'foo@bar.inet' default[:oracle][:rdbms][:dbconsole][:outgoing_mail] = 'mailhost' + +## Has to be either true or false +default[:oracle][:is_ee_options_selectable] = false +## Which optional EE components to install. Comma separated string with extra components to install. +## Can be any or all of the following: oracle.rdbms.partitioning:11.2.0.3.0, oracle.oraolap:11.2.0.3.0, oracle.rdbms.dm:11.2.0.3.0, +## oracle.rdbms.dv:11.2.0.3.0, oracle.rdbms.lbac:11.2.0.3.0, oracle.rdbms.rat:11.2.0.3.0 +default[:oracle][:optional_components] = '' + +## DB creation takes an aweful long time. So we increse the timeout from 1h to 6h ... just to be on the safe side +default[:oracle][:rdbms][:dbcreate_timeout] = 21600 diff --git a/recipes/createdb.rb b/recipes/createdb.rb index 7af6d76..25fd8dc 100644 --- a/recipes/createdb.rb +++ b/recipes/createdb.rb @@ -46,7 +46,7 @@ Chef::Log.warn(":oracle[:rdbms][:dbs] is empty; no database will be created.") end action :create - only_if {node[:oracle][:rdbms][:dbs].empty?} + only_if { node[:oracle][:rdbms][:dbs].empty? } end node[:oracle][:rdbms][:dbs].each_key do |db| @@ -69,6 +69,7 @@ group "oinstall" environment (node[:oracle][:rdbms][:env]) code "dbca -silent -createDatabase -emConfiguration DBEXPRESS -templateName #{node[:oracle][:rdbms][:db_create_template]} -gdbname #{db} -sid #{db} -sysPassword #{node[:oracle][:rdbms][:sys_pw]} -systemPassword #{node[:oracle][:rdbms][:system_pw]}" + timeout node[:oracle][:rdbms][:dbcreate_timeout] end else @@ -78,6 +79,7 @@ group "oinstall" environment (node[:oracle][:rdbms][:env]) code "dbca -silent -createDatabase -templateName #{node[:oracle][:rdbms][:db_create_template]} -gdbname #{db} -sid #{db} -sysPassword #{node[:oracle][:rdbms][:sys_pw]} -systemPassword #{node[:oracle][:rdbms][:system_pw]}" + timeout node[:oracle][:rdbms][:dbcreate_timeout] end # Add to listener.ora a stanza describing the new DB. @@ -99,7 +101,7 @@ end action :create end - + # Configure dbcontrol. if node[:oracle][:rdbms][:dbconsole][:emconfig] # Creating em.rsp file for dbcontrol. @@ -143,7 +145,7 @@ environment (node[:oracle][:rdbms][:env]) end end - + # Making sure shred is available yum_package "coreutils" do action :install diff --git a/templates/default/db11R23.rsp.erb b/templates/default/db11R23.rsp.erb index 1527c74..630fa5e 100644 --- a/templates/default/db11R23.rsp.erb +++ b/templates/default/db11R23.rsp.erb @@ -7,7 +7,8 @@ SELECTED_LANGUAGES=en ORACLE_HOME=<%= node[:oracle][:rdbms][:ora_home] %> ORACLE_BASE=<%= node[:oracle][:ora_base] %> oracle.install.db.InstallEdition=EE -oracle.install.db.EEOptionsSelection=false +oracle.install.db.EEOptionsSelection=<%= node[:oracle][:is_ee_options_selectable] %> +oracle.install.db.optionalComponents=<%= node[:oracle][:optional_components] %> oracle.install.db.DBA_GROUP=dba oracle.install.db.OPER_GROUP=dba oracle.install.db.isRACOneInstall=false