aririikonen / oracle

Full Oracle cookbook for Chef. Please see the README.md for further details.
http://oraarir.blogspot.fi/
44 stars 50 forks source link

some receipies are missing on oracle 12c cookbook #1

Open sujithbms123 opened 10 years ago

sujithbms123 commented 10 years ago

I am trying to install oracle 12c using chef cookbook. When I tried to create a role ora_12c_quickstart, the role has 'recipe[base]', 'recipe[oracle]' in run_list but I didnot find those recipes in the oracle cookbook

run_list 'recipe[base]', 'recipe[oracle]', 'recipe[oracle::logrotate_alert_log]', 'recipe[oracle::logrotate_listener]', 'recipe[oracle::createdb]'

aririikonen commented 10 years ago

Are you using open source chef, chef-solo, chef-zero or enterprise?

Could you elaborate more on the steps that you did? Created the role "knife role from file ...", downloaded the cookbook, uploaded the cookbook to the chef server, etc.

dsp-eoss commented 10 years ago

Thanks for reporting this.

To address your two issues:

[Edited for clarity and relevance, as I originally failed to realise I was posting here as opposed to emailing Ari :-)]

aririikonen commented 10 years ago

Aha! The 'recipe[base]' on the README.md example is wrong. I have a 'base' recipe on my own testing environment and it slipped to the general guide. I'll remove it.

So, correct role definition is:

name "ora_12c_quickstart" description "Role applied to Oracle 12c quickstart test machines." run_list 'recipe[oracle]', 'recipe[oracle::logrotate_alert_log]', 'recipe[oracle::logrotate_listener]', 'recipe[oracle::createdb]' override_attributes :oracle => {:rdbms => {:latest_patch => {:url => 'https://secure.server.localdomain/path/to/p18031528_121010_Linux-x86-64.zip'}, :opatch_update_url => 'https://secure.server.localdomain/path/to/p6880880_121010_Linux-x86-64.zip', :install_files => ['https://secure.server.localdomain/path/to/linuxamd64_12c_database_1of2.zip', 'https://secure.server.localdomain/path/to/linuxamd64_12c_database_2of2.zip'], :dbbin_version => '12c'}}

aririikonen commented 10 years ago

Hi sujithbms123, Did our solution help you on the issue?

sujithbms123 commented 10 years ago

Hi Ari,

Sorry for the delay. I was not feeling well during last 3 days. I am using chef-server and chef-client downloaded from http://www.getchef.com/chef/install/. i created chef-server in redhat linux machine and workstation in windows machine. I am using knife tool to upload cookbooks and create roles. This is the first time working with chef.

I downloaded cookbook available in github, it is downloaded as oracle-master. I uploaded cookbook as it is without renaming to oracle. So I was not able to get oracle receipe from it. when I rename it to oracle the i can see the receipe but I am not able to find receipe [base]. I removed receipe base and tried it as you said. I am stuck another issue. Since I am using only one latest patch I modified override attributes as below. I removed Opatch_update_url from override_attributes.It didnot work for me.

override_attributes :oracle => {:rdbms => {:latest_patch => {:url => ' http://abc-nvlv-oratst1:90/oracle/install/PSUOCT2013_p17027533_121010_Linux-x86-64.zip'}, :install_files => [' http://abc-nvlv-oratst1:90/oracle/install/linuxamd64_12c_database_1of2.zip', 'http://abc-nvlv-oratst1:90/oracle/install/linuxamd64_12c_database_2of2.zip'], :dbbin_version => '12c'}}

Also could you please suggest me is there any way to install only oracle binaries and donot apply latest patch

Thanks a lot

sujith

On Mon, Sep 1, 2014 at 10:10 AM, Ari Riikonen notifications@github.com wrote:

Hi sujithbms123, Did our solution help you on the issue?

— Reply to this email directly or view it on GitHub https://github.com/aririikonen/oracle/issues/1#issuecomment-54079553.

aririikonen commented 10 years ago

Hi sujithbms123,

I hope you are feeling better now.

Ok. If you don't want to patch the binaries, here's what I propose. The code which controls the installation of the latest patch is on the default recipe, https://github.com/aririikonen/oracle/blob/master/recipes/default.rb . At the end you can comment out the following section from the default recipe of the oracle cookbook:

...
## Patching oracle binaries to the latest patch
# Node attribute changes for 12c, if default[:oracle][:rdbms][:dbbin_version] is set to 12c
if node[:oracle][:rdbms][:dbbin_version] == "12c"
  node.set[:oracle][:rdbms][:ora_home] = node[:oracle][:rdbms][:ora_home_12c]
  node.set[:oracle][:rdbms][:env] = node[:oracle][:rdbms][:env_12c]
  node.set[:oracle][:rdbms][:latest_patch][:dirname] = node[:oracle][:rdbms][:latest_patch][:dirname_12c]
  include_recipe 'oracle::latest_dbpatch' unless node[:oracle][:rdbms][:latest_patch][:is_installed]
else
  include_recipe 'oracle::latest_dbpatch' unless node[:oracle][:rdbms][:latest_patch][:is_installed]
end

Upload the changed cookbook to chef-server and try to bootstrap a VM.

You don't need to modify the role, unless you want to leave the :latest_patch and the :opatch_update_url off from the override_attributes on ora_quickstart role. This would just mean, that the default values would be used from the default attributes, https://github.com/aririikonen/oracle/blob/master/attributes/default.rb . Although this doesn't mean that the patch(s) would be installed, just that they would show up as node attributes on the node after the bootstrap.

Another way would be to change the default parameter which "flags", if the patch has been installed or not. Change the value of the following default attribute to true (set to false by default) on https://github.com/aririikonen/oracle/blob/master/attributes/default.rb

...
default[:oracle][:rdbms][:latest_patch][:is_installed] = true
...

Of course again, upload the changed cookbook to the chef-server and try to bootstrap a VM. Personally I haven't tested this, but it should work. I want all of my Oracle installations to have the latest patches (especially security), when I'm building new environments. Saves the time to patch it afterwards.

Please let me know, if you need any further assistance.

Br, Ari

sujithbms123 commented 10 years ago

Thanks A lot Ari. I will modify the cookbook accordingly and let you know. I want to test all scenarios especially I am trying to understand your cookbook so that I could install diffferent versions of oracle.

Thanks a lot once again.

On Tue, Sep 2, 2014 at 11:43 AM, Ari Riikonen notifications@github.com wrote:

Hi sujithbms123,

I hope you are feeling better now.

Ok. If you don't want to patch the binaries, here's what I propose. The code which controls the installation of the latest patch is on the default recipe, https://github.com/aririikonen/oracle/blob/master/recipes/default.rb . At the end you can comment out the following section from the default recipe of the oracle cookbook:

Patching oracle binaries to the latest patch

Node attribute changes for 12c, if default[:oracle][:rdbms][:dbbin_version] is set to 12c

if node[:oracle][:rdbms][:dbbin_version] == "12c" node.set[:oracle][:rdbms][:ora_home] = node[:oracle][:rdbms][:ora_home_12c] node.set[:oracle][:rdbms][:env] = node[:oracle][:rdbms][:env_12c] node.set[:oracle][:rdbms][:latest_patch][:dirname] = node[:oracle][:rdbms][:latest_patch][:dirname_12c] include_recipe 'oracle::latest_dbpatch' unless node[:oracle][:rdbms][:latest_patch][:is_installed] else include_recipe 'oracle::latest_dbpatch' unless node[:oracle][:rdbms][:latest_patch][:is_installed] end

Upload the changed cookbook to chef-server and try to bootstrap a VM.

You don't need to modify the role, unless you want to leave the :latest_patch and the :opatch_update_url off from the override_attributes on ora_quickstart role. This would just mean, that the default values would be used from the default attributes, https://github.com/aririikonen/oracle/blob/master/attributes/default.rb . Although this doesn't mean that the patch(s) would be installed, just that they would show up as node attributes on the node after the bootstrap.

Another way would be to change the default parameter which "flags", if the patch has been installed or not. Change the value of the following default attribute to true on https://github.com/aririikonen/oracle/blob/master/attributes/default.rb . Of course again, upload the changed cookbook to the chef-server and try to bootstrap a VM. Personally I haven't tested this, but it should work. I want all of my Oracle installations to have the latest patches (especially security), when I'm building new environments. Saves the time to patch it afterwards.

Please let me know, if you need any further assistance.

Br, Ari

— Reply to this email directly or view it on GitHub https://github.com/aririikonen/oracle/issues/1#issuecomment-54198265.

sujithbms123 commented 10 years ago

HI Ari,

I was able to install oracle 12c with your cookbook. Thanks a lot. I was wondering how receipe [oracle::createdb] is called. I didnot find that in default.rb file in receipies. Could you please let me know how you are calling receipe [oracle::createdb]

Thank you, Sujith

On Tue, Sep 2, 2014 at 11:56 AM, Srinivas Sujith Kumar Balaram Mahanthi < sujith.a380@gmail.com> wrote:

Thanks A lot Ari. I will modify the cookbook accordingly and let you know. I want to test all scenarios especially I am trying to understand your cookbook so that I could install diffferent versions of oracle.

Thanks a lot once again.

On Tue, Sep 2, 2014 at 11:43 AM, Ari Riikonen notifications@github.com wrote:

Hi sujithbms123,

I hope you are feeling better now.

Ok. If you don't want to patch the binaries, here's what I propose. The code which controls the installation of the latest patch is on the default recipe, https://github.com/aririikonen/oracle/blob/master/recipes/default.rb . At the end you can comment out the following section from the default recipe of the oracle cookbook:

Patching oracle binaries to the latest patch

Node attribute changes for 12c, if default[:oracle][:rdbms][:dbbin_version] is set to 12c

if node[:oracle][:rdbms][:dbbin_version] == "12c" node.set[:oracle][:rdbms][:ora_home] = node[:oracle][:rdbms][:ora_home_12c] node.set[:oracle][:rdbms][:env] = node[:oracle][:rdbms][:env_12c] node.set[:oracle][:rdbms][:latest_patch][:dirname] = node[:oracle][:rdbms][:latest_patch][:dirname_12c] include_recipe 'oracle::latest_dbpatch' unless node[:oracle][:rdbms][:latest_patch][:is_installed] else include_recipe 'oracle::latest_dbpatch' unless node[:oracle][:rdbms][:latest_patch][:is_installed] end

Upload the changed cookbook to chef-server and try to bootstrap a VM.

You don't need to modify the role, unless you want to leave the :latest_patch and the :opatch_update_url off from the override_attributes on ora_quickstart role. This would just mean, that the default values would be used from the default attributes, https://github.com/aririikonen/oracle/blob/master/attributes/default.rb . Although this doesn't mean that the patch(s) would be installed, just that they would show up as node attributes on the node after the bootstrap.

Another way would be to change the default parameter which "flags", if the patch has been installed or not. Change the value of the following default attribute to true on https://github.com/aririikonen/oracle/blob/master/attributes/default.rb . Of course again, upload the changed cookbook to the chef-server and try to bootstrap a VM. Personally I haven't tested this, but it should work. I want all of my Oracle installations to have the latest patches (especially security), when I'm building new environments. Saves the time to patch it afterwards.

Please let me know, if you need any further assistance.

Br, Ari

— Reply to this email directly or view it on GitHub https://github.com/aririikonen/oracle/issues/1#issuecomment-54198265.

aririikonen commented 10 years ago

Hi sujithbms123,

You can see the recipe[oracle::createdb] on the ora_quickstart role's run_list. We wanted to separate it from the default.rb.

name "ora_12c_quickstart"
description "Role applied to Oracle 12c quickstart test machines."
run_list 'recipe[oracle]', 'recipe[oracle::logrotate_alert_log]', 'recipe[oracle::logrotate_listener]', 'recipe[oracle::createdb]'
...

And if you didn't already know recipe[oracle] means recipe[oracle::default].

Br, Ari

sujithbms123 commented 10 years ago

Thank you Ari.

If I dont want to create a database using chef, I just need to remove remove recipe [oracle::createdb] from the run list right ? or shall I remove below line highlighted in red color knife bootstrap HOSTNAME -r 'role[ora_12c_quickstart]' -j '{"oracle" : {"rdbms": {"dbs": {"FOO" : false}}}}'

Thank you Sujith

On Wed, Sep 3, 2014 at 11:50 PM, Ari Riikonen notifications@github.com wrote:

Hi sujithbms123,

You can see the recipe[oracle::createdb] on the ora_quickstart role's _runlist. We wanted to separate it from the default.rb.

name "ora_12c_quickstart" description "Role applied to Oracle 12c quickstart test machines." run_list 'recipe[oracle]', 'recipe[oracle::logrotate_alertlog]', 'recipe[oracle::logrotate listener]', 'recipe[oracle::createdb]' ...

Br, Ari

— Reply to this email directly or view it on GitHub https://github.com/aririikonen/oracle/issues/1#issuecomment-54416876.

aririikonen commented 10 years ago

You can just leave out the '-j ...' option out from the bootstrap, so

knife bootstrap HOSTNAME -r 'role[ora_12c_quickstart]'

Br, Ari

On 4.9.2014, at 19.53, sujithbms123 notifications@github.com wrote:

Thank you Ari.

If I dont want to create a database using chef, I just need to remove remove recipe [oracle::createdb] from the run list right ? or shall I remove below line highlighted in red color knife bootstrap HOSTNAME -r 'role[ora_12c_quickstart]' -j '{"oracle" : {"rdbms": {"dbs": {"FOO" : false}}}}'

Thank you Sujith

On Wed, Sep 3, 2014 at 11:50 PM, Ari Riikonen notifications@github.com wrote:

Hi sujithbms123,

You can see the recipe[oracle::createdb] on the ora_quickstart role's _runlist. We wanted to separate it from the default.rb.

name "ora_12c_quickstart" description "Role applied to Oracle 12c quickstart test machines." run_list 'recipe[oracle]', 'recipe[oracle::logrotate_alertlog]', 'recipe[oracle::logrotate listener]', 'recipe[oracle::createdb]' ...

Br, Ari

— Reply to this email directly or view it on GitHub https://github.com/aririikonen/oracle/issues/1#issuecomment-54416876.

— Reply to this email directly or view it on GitHub.

sujithbms123 commented 10 years ago

Thank you. I appreciate your help. You made my life easier

On Thu, Sep 4, 2014 at 10:38 AM, Ari Riikonen notifications@github.com wrote:

You can just leave out the '-j ...' option out from the bootstrap, so

knife bootstrap HOSTNAME -r 'role[ora_12c_quickstart]'

Br, Ari

On 4.9.2014, at 19.53, sujithbms123 notifications@github.com wrote:

Thank you Ari.

If I dont want to create a database using chef, I just need to remove remove recipe [oracle::createdb] from the run list right ? or shall I remove below line highlighted in red color knife bootstrap HOSTNAME -r 'role[ora_12c_quickstart]' -j '{"oracle" : {"rdbms": {"dbs": {"FOO" : false}}}}'

Thank you Sujith

On Wed, Sep 3, 2014 at 11:50 PM, Ari Riikonen notifications@github.com

wrote:

Hi sujithbms123,

You can see the recipe[oracle::createdb] on the ora_quickstart role's _runlist. We wanted to separate it from the default.rb.

name "ora_12c_quickstart" description "Role applied to Oracle 12c quickstart test machines." run_list 'recipe[oracle]', 'recipe[oracle::logrotate_alertlog]', 'recipe[oracle::logrotate listener]', 'recipe[oracle::createdb]' ...

Br, Ari

— Reply to this email directly or view it on GitHub https://github.com/aririikonen/oracle/issues/1#issuecomment-54416876.

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHub https://github.com/aririikonen/oracle/issues/1#issuecomment-54515344.

sujithbms123 commented 10 years ago

Hi Ari,

Sorry to bug you again. I installed oracle 12c but I want to reinstall it again on the same server. I noticed set[:oracle][:rdbms][:is_installed] = true in dbbin.rb. How could I set set it back to false and reinstall oracle in the server. I uninstalled oracle manually.

Set a flag to indicate the rdbms has been successfully installed.

ruby_block 'set_rdbms_install_flag' do block do node.set[:oracle][:rdbms][:is_installed] = true end action :create end

On Thu, Sep 4, 2014 at 11:45 AM, Srinivas Sujith Kumar Balaram Mahanthi < sujith.a380@gmail.com> wrote:

Thank you. I appreciate your help. You made my life easier

On Thu, Sep 4, 2014 at 10:38 AM, Ari Riikonen notifications@github.com wrote:

You can just leave out the '-j ...' option out from the bootstrap, so

knife bootstrap HOSTNAME -r 'role[ora_12c_quickstart]'

Br, Ari

On 4.9.2014, at 19.53, sujithbms123 notifications@github.com wrote:

Thank you Ari.

If I dont want to create a database using chef, I just need to remove remove recipe [oracle::createdb] from the run list right ? or shall I remove below line highlighted in red color knife bootstrap HOSTNAME -r 'role[ora_12c_quickstart]' -j '{"oracle" : {"rdbms": {"dbs": {"FOO" : false}}}}'

Thank you Sujith

On Wed, Sep 3, 2014 at 11:50 PM, Ari Riikonen notifications@github.com

wrote:

Hi sujithbms123,

You can see the recipe[oracle::createdb] on the ora_quickstart role's _runlist. We wanted to separate it from the default.rb.

name "ora_12c_quickstart" description "Role applied to Oracle 12c quickstart test machines." run_list 'recipe[oracle]', 'recipe[oracle::logrotate_alertlog]', 'recipe[oracle::logrotate listener]', 'recipe[oracle::createdb]' ...

Br, Ari

— Reply to this email directly or view it on GitHub https://github.com/aririikonen/oracle/issues/1#issuecomment-54416876.

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHub https://github.com/aririikonen/oracle/issues/1#issuecomment-54515344.

aririikonen commented 10 years ago

Hi Sujith,

Easiest way is to create a new VM and perform a new bootstrap on it. It's way faster than changing the existing environment and chef node attributes (unless you script it or create a recipe for it).

If you really need to perform the installation on the same server (= chef node) (physical hardware for example), you need to delete few things from the server and reset few of the node attributes to false. I have a cleanup script at work, so I'll post it tomorrow.

NOTE: This applies only, if you have installed the 12c binaries without the oracle binary patch and if you have created a database using chef. If you have patched the binaries and/or created a database(s), the procedure has more steps.

Basic steps:

service stop oracle
rm -rf /opt/oracle; rm -rf oraInventory
knife node edit <node_name>

or use knife exec

knife exec -E 'nodes.find("name:<node_name>") {|n| n.set[:oracle][:rdbms][:is_installed] = false; n.save}'

You can check the node attribute with

knife node show <node_name> -a oracle.rdbms.is_installed
chef-client --once

You're done, awesome!

Actually tested this procedure on my testing environment, but as mentioned, it only works for a plain non-patched 12c oracle binary installation. Didn't test it for 11g, but it should work the similar way.

Br, Ari

sujithbms123 commented 10 years ago

Hi Ari,

Thank you for your kind support. I found some bugs in createdb.rb files. it seems to me like it will work fine for oracle 11g but for oracle 12c, there is no script to make changes in linsener.ora or tnsnames.ora. the tnsnames.ora is pointing to oracle 11g path. It seems to me like add listener.ora, tnsnames.ora in if condition and renaming ora_home to ora_home_12c would fix this. Correct me if I am wrong. below is a part of script you provided. i didnot make any changes here as i am a beginner in chef.

Create database.

if node[:oracle][:rdbms][:dbbin_version] == "12c"

12c

bash "dbca_createdb_#{db}" do
  user "oracle"
  group "dba"
  environment (node[:oracle][:rdbms][:env_12c])
  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]}"

end

else

11g

bash "dbca_createdb_#{db}" do
  user "oracle"
  group "dba"
  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]}"

end
# Add to listener.ora a stanza describing the new DB.
ruby_block "append_#{db}_stanza_to_lsnr_conf" do
  block do
    lsnr_conf =

"#{node[:oracle][:rdbms][:ora_home]}/network/admin/listener.ora" sid_desc_body = "(SID_DESC=(GLOBAL_DBNAME=#{db})(ORACLE_HOME=#{node[:oracle][:rdbms][:ora_home]})(SID_NAME=#{db})))"

On Thu, Sep 4, 2014 at 7:34 PM, Ari Riikonen notifications@github.com wrote:

Hi Sujith,

Easiest way is to create a new VM and perform a new bootstrap on it. It's way faster than changing the existing environment and chef node attributes (unless you script it or create a recipe for it).

If you really need to perform the installation on the same server (= chef node) (physical hardware for example), you need to delete few things from the server and reset few of the node attributes to false. I have a cleanup script at work, so I'll post it tomorrow.

NOTE: This applies only, if you have installed the 12c binaries without the oracle binary patch and if you have created a database using chef. If you have patched the binaries and/or created a database(s), the procedure has more steps.

Basic steps:

  • Stop/kill all oracle processes from the server as root. Check that you don't see any oracle processes running with 'ps -ef | grep oracle'

service stop oracle

  • Remove all files and folders from /opt

rm -rf /opt/oracle; rm -rf oraInventory**

  • Change the node[:oracle][:rdbms][:is_installed] to false, there's few ways to do this, Use knife node edit and edit the JSON directly

knife node edit

or use knife exec

knife exec -E 'nodes.find("name:") {|n| n.set[:oracle][:rdbms][:is_installed] = false; n.save}'

You can check the node attribute with

knife node show -a oracle.rdbms.is_installed

  • Login to the node as root and rerun the chef-client

chef-client --once

You're done, awesome!

Actually tested this procedure on my testing environment, but as mentioned, it only works for a plain non-patched 12c oracle binary installation. Didn't test it for 11g, but it should work the similar way.

Br, Ari

— Reply to this email directly or view it on GitHub https://github.com/aririikonen/oracle/issues/1#issuecomment-54575127.

aririikonen commented 10 years ago

Hi Sujith,

The difference with 12c and 11g is, that 12c has DBEXPRESS and 11g has the old dbcontrol. I left out the database specific configuration off from listener.ora due to it. However Oracle will auto discover the databases with 12c installation regardless of the missing database specific configurations on listener.ora. This normally takes 1-2 minutes from listener startup. If I recall correctly, I tried to replicate the 12c listener.ora configuration similar way as 11g, but faced some issues with it and decided to drop the idea for a simpler model.

Br, Ari

sujithbms123 commented 10 years ago

Hi Ari,

When i tried to install oracle 12c using the cookbook, it is trying to create tns entry in tnsnames.ora, but it is looking for 11g path instead of 12c. I will send you an email tomorrow with the error.

Thank you, Sujith

On Sat, Sep 6, 2014 at 2:34 PM, Ari Riikonen notifications@github.com wrote:

Hi Sujith,

The difference with 12c and 11g is, that 12c has DBEXPRESS and 11g has the old dbcontrol. I left out the database specific configuration off from listener.ora due to it. However Oracle will auto discover the databases with 12c installation regardless of the missing database specific configurations on listener.ora. This normally takes 1-2 minutes from listener startup. If I recall correctly, I tried to replicate the 12c listener.ora configuration similar way as 11g, but faced some issues with it and decided to drop the idea for a simpler model.

Br, Ari

— Reply to this email directly or view it on GitHub https://github.com/aririikonen/oracle/issues/1#issuecomment-54729116.

aririikonen commented 10 years ago

Hi Sujith,

Just checked the code. You do have a point. The tnsnames.ora record is generated after the dbca execution which is inside an if statement for the node[:oracle][:rdbms][:dbbin_version] check. I'll run some tests today to verify it. I'll push an update after confirming/fix.

Thank you for pointing this out.

Br, Ari

aririikonen commented 10 years ago

Hi Sujith,

Verified the case. It works ok on my testing environment. I also found the reason why it works. If you check the default.rb more closely, at the end you can find that the node.set[:oracle][:rdbms][:ora_home] is being replaced by node.set[:oracle][:rdbms][:ora_home_12c], resulting the correct path for the tnsnames.ora for the created database for 12c also.

## Patching oracle binaries to the latest patch
# Node attribute changes for 12c, if default[:oracle][:rdbms][:dbbin_version] is set to 12c
if node[:oracle][:rdbms][:dbbin_version] == "12c"
  node.set[:oracle][:rdbms][:ora_home] = node[:oracle][:rdbms][:ora_home_12c]
  node.set[:oracle][:rdbms][:env] = node[:oracle][:rdbms][:env_12c]
  node.set[:oracle][:rdbms][:latest_patch][:dirname] = node[:oracle][:rdbms][:latest_patch][:dirname_12c]
  include_recipe 'oracle::latest_dbpatch' unless node[:oracle][:rdbms][:latest_patch][:is_installed]
else
  include_recipe 'oracle::latest_dbpatch' unless node[:oracle][:rdbms][:latest_patch][:is_installed]
end

Br, Ari

sujithbms123 commented 10 years ago

oh ok. I didnot do the patching. So i got an issue. Thank you Ari. Thanks a lot for your support

On Tue, Sep 9, 2014 at 12:57 PM, Ari Riikonen notifications@github.com wrote:

Hi Sujith,

Verified the case. It works ok on my testing environment. I also found the reason why it works. If you check the default.rb more closely, at the end you can find that the node.set[:oracle][:rdbms][:ora_home] is being replaced by node.set[:oracle][:rdbms][:ora_home_12c], resulting the correct path for the tnsnames.ora for the created database for 12c also.

Patching oracle binaries to the latest patch

Node attribute changes for 12c, if default[:oracle][:rdbms][:dbbin_version] is set to 12c

if node[:oracle][:rdbms][:dbbin_version] == "12c" node.set[:oracle][:rdbms][:ora_home] = node[:oracle][:rdbms][:ora_home_12c] node.set[:oracle][:rdbms][:env] = node[:oracle][:rdbms][:env_12c] node.set[:oracle][:rdbms][:latest_patch][:dirname] = node[:oracle][:rdbms][:latest_patch][:dirname_12c] include_recipe 'oracle::latest_dbpatch' unless node[:oracle][:rdbms][:latest_patch][:is_installed] else include_recipe 'oracle::latest_dbpatch' unless node[:oracle][:rdbms][:latest_patch][:is_installed] end

Br, Ari

— Reply to this email directly or view it on GitHub https://github.com/aririikonen/oracle/issues/1#issuecomment-55024132.

sujithbms123 commented 10 years ago

Hi Ari,

I tried to modify createdb.rb file to create DB in oracle 12c without patching. I am getting the following error. Could you please let me know how to fix it and what does ruby block do. Please find the attached script in this email. Thank you.

abc-nvlv-oratst2 ←[0m abc-nvlv-oratst2 Resource Declaration:←[0m abc-nvlv-oratst2 ---------------------←[0m abc-nvlv-oratst2 # In /var/chef/cache/cookbooks/oracle/recipes/createdb.rb abc-nvlv-oratst2 abc-nvlv-oratst2 90: rubyblock "append#{db}_stanza_to_lsnr_conf" do abc-nvlv-oratst2 91: block do abc-nvlv-oratst2 92: lsnr_conf = "#{node[:oracle][:rdbms][:ora_home_12c]}/network/admin/listener.ora" abc-nvlv-oratst2 93: sid_desc_body = "(SID_DESC=(GLOBAL_DBNAME=#{db})(ORACLE_HOME=#{node[:oracle][:rdbms][:ora_home_12c]})(SID_NAME=#{db})))" abc-nvlv-oratst2 94: abort("Could not back up #{lsnr_conf}; bailing out") unless system "cp --preserve=mode,ownership #{lsnr_conf}

{lsnr_conf}.bak-$(date +%Y-%m-%d-%H%M%S)"

abc-nvlv-oratst2 95: File.open lsnr_conf, 'r+' do |f| abc-nvlv-oratst2 96: content = f.readlines abc-nvlv-oratst2 97: last_line = content[-1] abc-nvlv-oratst2 98: sid_desc_header = (last_line =~ /^SID/) ? '' : 'SID_LIST_LISTENER=(SID_LIST=' abc-nvlv-oratst2 99: sid_desc = sid_desc_header + sid_desc_body abc-nvlv-oratst2 100: content[-1] = last_line.sub(/[)\s]$/, sid_desc) abc-nvlv-oratst2 101: f.rewind abc-nvlv-oratst2 102: f.truncate(f.pos) abc-nvlv-oratst2 103: f.write content.join abc-nvlv-oratst2 104: end abc-nvlv-oratst2 105: end abc-nvlv-oratst2 106: action :create abc-nvlv-oratst2 107: end abc-nvlv-oratst2 108: abc-nvlv-oratst2 ←[0m abc-nvlv-oratst2 abc-nvlv-oratst2 ←[0m abc-nvlv-oratst2 Compiled Resource:←[0m abc-nvlv-oratst2 ------------------←[0m abc-nvlv-oratst2 # Declared in /var/chef/cache/cookbooks/oracle/recipes/createdb.rb:90:in block in from_file' abc-nvlv-oratst2 abc-nvlv-oratst2 ruby_block("append_SAMPLE_stanza_to_lsnr_conf") do abc-nvlv-oratst2 action [:create] abc-nvlv-oratst2 retries 0 abc-nvlv-oratst2 retry_delay 2 abc-nvlv-oratst2 guard_interpreter :default abc-nvlv-oratst2 block_name "append_SAMPLE_stanza_to_lsnr_conf" abc-nvlv-oratst2 cookbook_name "oracle" abc-nvlv-oratst2 recipe_name "createdb" abc-nvlv-oratst2 block #<Proc:0x0000000387d950@ /var/chef/cache/cookbooks/oracle/recipes/createdb.rb:91> abc-nvlv-oratst2 end abc-nvlv-oratst2 ←[0m abc-nvlv-oratst2 abc-nvlv-oratst2 ←[0m abc-nvlv-oratst2 abc-nvlv-oratst2 Running handlers:←[0m abc-nvlv-oratst2 [2014-09-12T18:42:32-04:00] ERROR: Running exception handlers abc-nvlv-oratst2 Running handlers complete abc-nvlv-oratst2 ←[0m abc-nvlv-oratst2 [2014-09-12T18:42:32-04:00] ERROR: Exception handlers complete abc-nvlv-oratst2 [2014-09-12T18:42:32-04:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out abc-nvlv-oratst2 Chef Client failed. 1 resources updated in 1034.669640674 seconds←[0m abc-nvlv-oratst2 [2014-09-12T18:42:32-04:00] ERROR: ruby_block[append_SAMPLE_stanza_to_lsnr_conf] (oracle::createdb line 90) had an error: NoMethodError: undefined methodsub' for nil:NilClass abc-nvlv-oratst2 [2014-09-12T18:42:33-04:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

On Tue, Sep 9, 2014 at 7:42 PM, Srinivas Sujith Kumar Balaram Mahanthi < sujith.a380@gmail.com> wrote:

oh ok. I didnot do the patching. So i got an issue. Thank you Ari. Thanks a lot for your support

On Tue, Sep 9, 2014 at 12:57 PM, Ari Riikonen notifications@github.com wrote:

Hi Sujith,

Verified the case. It works ok on my testing environment. I also found the reason why it works. If you check the default.rb more closely, at the end you can find that the node.set[:oracle][:rdbms][:ora_home] is being replaced by node.set[:oracle][:rdbms][:ora_home_12c], resulting the correct path for the tnsnames.ora for the created database for 12c also.

Patching oracle binaries to the latest patch

Node attribute changes for 12c, if default[:oracle][:rdbms][:dbbin_version] is set to 12c

if node[:oracle][:rdbms][:dbbin_version] == "12c" node.set[:oracle][:rdbms][:ora_home] = node[:oracle][:rdbms][:ora_home_12c] node.set[:oracle][:rdbms][:env] = node[:oracle][:rdbms][:env_12c] node.set[:oracle][:rdbms][:latest_patch][:dirname] = node[:oracle][:rdbms][:latest_patch][:dirname_12c] include_recipe 'oracle::latest_dbpatch' unless node[:oracle][:rdbms][:latest_patch][:is_installed] else include_recipe 'oracle::latest_dbpatch' unless node[:oracle][:rdbms][:latest_patch][:is_installed] end

Br, Ari

— Reply to this email directly or view it on GitHub https://github.com/aririikonen/oracle/issues/1#issuecomment-55024132.

aririikonen commented 10 years ago

Hi Sujith,

We're bringing out a new version v1.3.0 of the cookbook which will address also this issue. v1.3.0 should be ready in two weeks to be launched.

In the mean time, try to add the same block to "reset" the node attribute at the beginning of the createdb.rb. I haven't tested it yet, but I'll look into the workaround in next few days. I'll get back to you on this.

Br, Ari

On Sat, Sep 13, 2014 at 1:58 AM, sujithbms123 notifications@github.com wrote:

Hi Ari,

I tried to modify createdb.rb file to create DB in oracle 12c without patching. I am getting the following error. Could you please let me know how to fix it and what does ruby block do. Please find the attached script in this email. Thank you.

abc-nvlv-oratst2 ←[0m abc-nvlv-oratst2 Resource Declaration:←[0m abc-nvlv-oratst2 ---------------------←[0m abc-nvlv-oratst2 # In /var/chef/cache/cookbooks/oracle/recipes/createdb.rb abc-nvlv-oratst2 abc-nvlv-oratst2 90: rubyblock "append#{db}_stanza_to_lsnr_conf" do abc-nvlv-oratst2 91: block do abc-nvlv-oratst2 92: lsnr_conf = "#{node[:oracle][:rdbms][:ora_home_12c]}/network/admin/listener.ora" abc-nvlv-oratst2 93: sid_desc_body = "(SID_DESC=(GLOBAL_DBNAME=#{db})(ORACLE_HOME=#{node[:oracle][:rdbms][:ora_home_12c]})(SID_NAME=#{db})))"

abc-nvlv-oratst2 94: abort("Could not back up #{lsnr_conf}; bailing out") unless system "cp --preserve=mode,ownership #{lsnr_conf}

{lsnr_conf}.bak-$(date +%Y-%m-%d-%H%M%S)"

abc-nvlv-oratst2 95: File.open lsnr_conf, 'r+' do |f| abc-nvlv-oratst2 96: content = f.readlines abc-nvlv-oratst2 97: last_line = content[-1] abc-nvlv-oratst2 98: sid_desc_header = (last_line =~ /^SID/) ? '' : 'SID_LIST_LISTENER=(SID_LIST=' abc-nvlv-oratst2 99: sid_desc = sid_desc_header + sid_desc_body abc-nvlv-oratst2 100: content[-1] = last_line.sub(/[)\s]$/, sid_desc) abc-nvlv-oratst2 101: f.rewind abc-nvlv-oratst2 102: f.truncate(f.pos) abc-nvlv-oratst2 103: f.write content.join abc-nvlv-oratst2 104: end abc-nvlv-oratst2 105: end abc-nvlv-oratst2 106: action :create abc-nvlv-oratst2 107: end abc-nvlv-oratst2 108: abc-nvlv-oratst2 ←[0m abc-nvlv-oratst2 abc-nvlv-oratst2 ←[0m abc-nvlv-oratst2 Compiled Resource:←[0m abc-nvlv-oratst2 ------------------←[0m abc-nvlv-oratst2 # Declared in /var/chef/cache/cookbooks/oracle/recipes/createdb.rb:90:in block in from_file' abc-nvlv-oratst2 abc-nvlv-oratst2 ruby_block("append_SAMPLE_stanza_to_lsnr_conf") do abc-nvlv-oratst2 action [:create] abc-nvlv-oratst2 retries 0 abc-nvlv-oratst2 retry_delay 2 abc-nvlv-oratst2 guard_interpreter :default abc-nvlv-oratst2 block_name "append_SAMPLE_stanza_to_lsnr_conf" abc-nvlv-oratst2 cookbook_name "oracle" abc-nvlv-oratst2 recipe_name "createdb" abc-nvlv-oratst2 block #<Proc:0x0000000387d950@ /var/chef/cache/cookbooks/oracle/recipes/createdb.rb:91> abc-nvlv-oratst2 end abc-nvlv-oratst2 ←[0m abc-nvlv-oratst2 abc-nvlv-oratst2 ←[0m abc-nvlv-oratst2 abc-nvlv-oratst2 Running handlers:←[0m abc-nvlv-oratst2 [2014-09-12T18:42:32-04:00] ERROR: Running exception handlers abc-nvlv-oratst2 Running handlers complete abc-nvlv-oratst2 ←[0m abc-nvlv-oratst2 [2014-09-12T18:42:32-04:00] ERROR: Exception handlers complete abc-nvlv-oratst2 [2014-09-12T18:42:32-04:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out abc-nvlv-oratst2 Chef Client failed. 1 resources updated in 1034.669640674 seconds←[0m abc-nvlv-oratst2 [2014-09-12T18:42:32-04:00] ERROR: ruby_block[append_SAMPLE_stanza_to_lsnr_conf] (oracle::createdb line 90) had an error: NoMethodError: undefined methodsub' for nil:NilClass abc-nvlv-oratst2 [2014-09-12T18:42:33-04:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

On Tue, Sep 9, 2014 at 7:42 PM, Srinivas Sujith Kumar Balaram Mahanthi < sujith.a380@gmail.com> wrote:

oh ok. I didnot do the patching. So i got an issue. Thank you Ari. Thanks a lot for your support

On Tue, Sep 9, 2014 at 12:57 PM, Ari Riikonen notifications@github.com

wrote:

Hi Sujith,

Verified the case. It works ok on my testing environment. I also found the reason why it works. If you check the default.rb more closely, at the end you can find that the node.set[:oracle][:rdbms][:ora_home] is being replaced by node.set[:oracle][:rdbms][:ora_home_12c], resulting the correct path for the tnsnames.ora for the created database for 12c also.

Patching oracle binaries to the latest patch

Node attribute changes for 12c, if

default[:oracle][:rdbms][:dbbin_version] is set to 12c if node[:oracle][:rdbms][:dbbin_version] == "12c" node.set[:oracle][:rdbms][:ora_home] = node[:oracle][:rdbms][:ora_home_12c] node.set[:oracle][:rdbms][:env] = node[:oracle][:rdbms][:env_12c] node.set[:oracle][:rdbms][:latest_patch][:dirname] = node[:oracle][:rdbms][:latest_patch][:dirname_12c] include_recipe 'oracle::latest_dbpatch' unless node[:oracle][:rdbms][:latest_patch][:is_installed] else include_recipe 'oracle::latest_dbpatch' unless node[:oracle][:rdbms][:latest_patch][:is_installed] end

Br, Ari

— Reply to this email directly or view it on GitHub https://github.com/aririikonen/oracle/issues/1#issuecomment-55024132.

— Reply to this email directly or view it on GitHub https://github.com/aririikonen/oracle/issues/1#issuecomment-55470860.

sujithbms123 commented 10 years ago

Thank you Ari

On Sun, Sep 14, 2014 at 12:50 AM, Ari Riikonen notifications@github.com wrote:

Hi Sujith,

We're bringing out a new version v1.3.0 of the cookbook which will address also this issue. v1.3.0 should be ready in two weeks to be launched.

In the mean time, try to add the same block to "reset" the node attribute at the beginning of the createdb.rb. I haven't tested it yet, but I'll look into the workaround in next few days. I'll get back to you on this.

Br, Ari

On Sat, Sep 13, 2014 at 1:58 AM, sujithbms123 notifications@github.com wrote:

Hi Ari,

I tried to modify createdb.rb file to create DB in oracle 12c without patching. I am getting the following error. Could you please let me know how to fix it and what does ruby block do. Please find the attached script in this email. Thank you.

abc-nvlv-oratst2 ←[0m abc-nvlv-oratst2 Resource Declaration:←[0m abc-nvlv-oratst2 ---------------------←[0m abc-nvlv-oratst2 # In /var/chef/cache/cookbooks/oracle/recipes/createdb.rb abc-nvlv-oratst2 abc-nvlv-oratst2 90: rubyblock "append#{db}_stanza_to_lsnr_conf" do abc-nvlv-oratst2 91: block do abc-nvlv-oratst2 92: lsnr_conf = "#{node[:oracle][:rdbms][:ora_home_12c]}/network/admin/listener.ora" abc-nvlv-oratst2 93: sid_desc_body =

"(SID_DESC=(GLOBAL_DBNAME=#{db})(ORACLE_HOME=#{node[:oracle][:rdbms][:ora_home_12c]})(SID_NAME=#{db})))"

abc-nvlv-oratst2 94: abort("Could not back up #{lsnr_conf}; bailing out") unless system "cp --preserve=mode,ownership #{lsnr_conf}

{lsnr_conf}.bak-$(date +%Y-%m-%d-%H%M%S)"

abc-nvlv-oratst2 95: File.open lsnr_conf, 'r+' do |f| abc-nvlv-oratst2 96: content = f.readlines abc-nvlv-oratst2 97: last_line = content[-1] abc-nvlv-oratst2 98: sid_desc_header = (last_line =~ /^SID/) ? '' : 'SID_LIST_LISTENER=(SID_LIST=' abc-nvlv-oratst2 99: sid_desc = sid_desc_header + sid_desc_body abc-nvlv-oratst2 100: content[-1] = last_line.sub(/[)\s]$/, sid_desc) abc-nvlv-oratst2 101: f.rewind abc-nvlv-oratst2 102: f.truncate(f.pos) abc-nvlv-oratst2 103: f.write content.join abc-nvlv-oratst2 104: end abc-nvlv-oratst2 105: end abc-nvlv-oratst2 106: action :create abc-nvlv-oratst2 107: end abc-nvlv-oratst2 108: abc-nvlv-oratst2 ←[0m abc-nvlv-oratst2 abc-nvlv-oratst2 ←[0m abc-nvlv-oratst2 Compiled Resource:←[0m abc-nvlv-oratst2 ------------------←[0m abc-nvlv-oratst2 # Declared in /var/chef/cache/cookbooks/oracle/recipes/createdb.rb:90:in block in from_file' abc-nvlv-oratst2 abc-nvlv-oratst2 ruby_block("append_SAMPLE_stanza_to_lsnr_conf") do abc-nvlv-oratst2 action [:create] abc-nvlv-oratst2 retries 0 abc-nvlv-oratst2 retry_delay 2 abc-nvlv-oratst2 guard_interpreter :default abc-nvlv-oratst2 block_name "append_SAMPLE_stanza_to_lsnr_conf" abc-nvlv-oratst2 cookbook_name "oracle" abc-nvlv-oratst2 recipe_name "createdb" abc-nvlv-oratst2 block #<Proc:0x0000000387d950@ /var/chef/cache/cookbooks/oracle/recipes/createdb.rb:91> abc-nvlv-oratst2 end abc-nvlv-oratst2 ←[0m abc-nvlv-oratst2 abc-nvlv-oratst2 ←[0m abc-nvlv-oratst2 abc-nvlv-oratst2 Running handlers:←[0m abc-nvlv-oratst2 [2014-09-12T18:42:32-04:00] ERROR: Running exception handlers abc-nvlv-oratst2 Running handlers complete abc-nvlv-oratst2 ←[0m abc-nvlv-oratst2 [2014-09-12T18:42:32-04:00] ERROR: Exception handlers complete abc-nvlv-oratst2 [2014-09-12T18:42:32-04:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out abc-nvlv-oratst2 Chef Client failed. 1 resources updated in 1034.669640674 seconds←[0m abc-nvlv-oratst2 [2014-09-12T18:42:32-04:00] ERROR: ruby_block[append_SAMPLE_stanza_to_lsnr_conf] (oracle::createdb line 90) had an error: NoMethodError: undefined methodsub' for nil:NilClass abc-nvlv-oratst2 [2014-09-12T18:42:33-04:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

On Tue, Sep 9, 2014 at 7:42 PM, Srinivas Sujith Kumar Balaram Mahanthi < sujith.a380@gmail.com> wrote:

oh ok. I didnot do the patching. So i got an issue. Thank you Ari. Thanks a lot for your support

On Tue, Sep 9, 2014 at 12:57 PM, Ari Riikonen < notifications@github.com>

wrote:

Hi Sujith,

Verified the case. It works ok on my testing environment. I also found the reason why it works. If you check the default.rb more closely, at the end you can find that the node.set[:oracle][:rdbms][:ora_home] is being replaced by node.set[:oracle][:rdbms][:ora_home_12c], resulting the correct path for the tnsnames.ora for the created database for 12c also.

Patching oracle binaries to the latest patch

Node attribute changes for 12c, if

default[:oracle][:rdbms][:dbbin_version] is set to 12c if node[:oracle][:rdbms][:dbbin_version] == "12c" node.set[:oracle][:rdbms][:ora_home] = node[:oracle][:rdbms][:ora_home_12c] node.set[:oracle][:rdbms][:env] = node[:oracle][:rdbms][:env_12c] node.set[:oracle][:rdbms][:latest_patch][:dirname] = node[:oracle][:rdbms][:latest_patch][:dirname_12c] include_recipe 'oracle::latest_dbpatch' unless node[:oracle][:rdbms][:latest_patch][:is_installed] else include_recipe 'oracle::latest_dbpatch' unless node[:oracle][:rdbms][:latest_patch][:is_installed] end

Br, Ari

— Reply to this email directly or view it on GitHub https://github.com/aririikonen/oracle/issues/1#issuecomment-55024132.

— Reply to this email directly or view it on GitHub https://github.com/aririikonen/oracle/issues/1#issuecomment-55470860.

  • Ari

— Reply to this email directly or view it on GitHub https://github.com/aririikonen/oracle/issues/1#issuecomment-55518432.

dilshath commented 7 years ago

Hi Ari,

I am trying to install Oracle 12c without patch.

can you please help me ?

Dilshath