171. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 10/2/2017 1:40:11 PM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

171.1 Files compared

# Location File Last Modified
1 chef-repo.zip\chef-repo\wrapper_cookbooks\oracle_wrapper\recipes create_dbs.rb Thu Mar 23 16:44:19 2017 UTC
2 chef-repo.zip\chef-repo\wrapper_cookbooks\oracle_wrapper\recipes create_dbs.rb Mon Oct 2 15:44:48 2017 UTC

171.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 382
Changed 1 2
Inserted 0 0
Removed 0 0

171.3 Comparison options

Whitespace
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

171.4 Active regular expressions

No regular expressions were active.

171.5 Comparison detail

  1   #
  2   # Cookbook  Name:: or acle_wrapp er
  3   # Recipe::  create_db s
  4   #
  5  
  6   # most of  this recip e is taken  from the  createdb r ecipe from  the third  party coo kbook
  7   # changes  and additi ons are ma de to supp ort versio n 11.2.0.1  and make  the recipe  idempoten t and are  marked wit h comments
  8   # see orig inal recip e for orig inal comme nts
  9  
  10   directory  node[:orac le][:rdbms ][:dbs_roo t] do
  11     owner 'o racle'
  12     group 'o install'
  13     mode '07 55'
  14   end
  15  
  16   template " #{node[:or acle][:rdb ms][:ora_h ome]}/assi stants/dbc a/template s/default_ template.d bt" do
  17     owner 'o racle'
  18     group 'o install'
  19     mode '06 44'
  20     variable s({
  21     :archive LogMode =>  node[:ora cle_wrappe r][:archiv e_log_mode ]
  22     })
  23   end
  24  
  25   template " #{node[:or acle][:rdb ms][:ora_h ome]}/assi stants/dbc a/template s/midrange _template. dbt" do
  26     owner 'o racle'
  27     group 'o install'
  28     mode '06 44'
  29     cookbook  'oracle'
  30   end
  31  
  32   ruby_block  "print_em pty_db_has h_warning"  do
  33     block do
  34       Chef:: Log.warn(" :oracle[:r dbms][:dbs ] is empty ; no datab ase will b e created. ")
  35     end
  36     action : create
  37     only_if  {node[:ora cle][:rdbm s][:dbs].e mpty?}
  38   end
  39  
  40   # switch s kip db con ditional f rom databa se attribu te to chec king for t he spfile[ DB_NAME].o ra
  41   node[:orac le][:rdbms ][:dbs].ea ch_key do  |db|
  42     if File. exists? "# {node[:ora cle][:rdbm s][:ora_ho me]}/dbs/s pfile#{db} .ora"
  43       ruby_b lock "prin t_#{db}_sk ipped_msg"  do
  44         bloc k do
  45           Ch ef::Log.in fo("Databa se #{db} h as already  been crea ted on thi s node- sk ipping it. ")
  46         end
  47         acti on :create
  48       end
  49  
  50       next
  51     end
  52  
  53     # remove  user and  group defi nition and  add "sudo  -Eu oracl e" and add  path to d bca to fix  "DBCA can not be run  as root."  error
  54     bash "db ca_created b_#{db}" d o
  55       enviro nment (nod e[:oracle] [:rdbms][: env])
  56       code " sudo -Eu o racle #{no de[:oracle ][:rdbms][ :ora_home] }/bin/dbca  -silent - createData base -temp lateName # {node[:ora cle][:rdbm s][:db_cre ate_templa te]} -gdbn ame #{db}  -sid #{db}  -sysPassw ord #{node [:oracle][ :rdbms][:s ys_pw]} -s ystemPassw ord #{node [:oracle][ :rdbms][:s ystem_pw]} "
  57     end
  58  
  59     ruby_blo ck "append _#{db}_sta nza_to_lsn r_conf" do
  60       block  do
  61         lsnr _conf = "# {node[:ora cle][:rdbm s][:ora_ho me]}/netwo rk/admin/l istener.or a"
  62         sid_ desc_body  = "(SID_DE SC=(GLOBAL _DBNAME=#{ db})(ORACL E_HOME=#{n ode[:oracl e][:rdbms] [:ora_home ]})(SID_NA ME=#{db})) )"
  63         abor t("Could n ot back up  #{lsnr_co nf}; baili ng out") u nless syst em "cp --p reserve=mo de,ownersh ip #{lsnr_ conf} #{ls nr_conf}.b ak-$(date  +%Y-%m-%d- %H%M%S)"
  64         File .open lsnr _conf, 'r+ ' do |f|
  65           co ntent = f. readlines
  66           la st_line =  content[-1 ]
  67           si d_desc_hea der = (las t_line =~  /^SID/) ?  '' : 'SID_ LIST_LISTE NER=(SID_L IST='
  68           si d_desc = s id_desc_he ader + sid _desc_body
  69           co ntent[-1]  = last_lin e.sub(/[)\ s]$/, sid_ desc)
  70           f. rewind
  71           f. truncate(f .pos)
  72           f. write cont ent.join
  73         end
  74       end
  75       action  :create
  76     end
  77     
  78     if node[ :oracle][: rdbms][:db console][: emconfig]
  79       templa te "#{node [:oracle][ :rdbms][:o ra_home]}/ em.rsp" do
  80         owne r 'oracle'
  81         grou p 'oinstal l'
  82         mode  '0644'
  83         cook book 'orac le'
  84       end
  85  
  86       bash " prepare_db snmp_user_ #{db}" do
  87         user  "oracle"
  88         grou p "oinstal l"
  89         envi ronment (n ode[:oracl e][:rdbms] [:env])
  90         code  <<-EOH2
  91           ex port ORACL E_SID=#{db }
  92           sq lplus / as  sysdba << -EOL1
  93           AL TER USER D BSNMP ACCO UNT UNLOCK ;
  94           AL TER USER D BSNMP IDEN TIFIED BY  #{node[:or acle][:rdb ms][:dbsnm p_pw]};
  95           ex it
  96           EO L1
  97         EOH2
  98       end
  99  
  100       execut e "set_sid _to_em-rsp _#{db}" do
  101         comm and "sed - i '2s/.*/S ID=#{db}/'  #{node[:o racle][:rd bms][:ora_ home]}/em. rsp"
  102         user  'oracle'
  103         grou p 'oinstal l'
  104       end
  105  
  106       servic e 'restart  oracle em config' do
  107         serv ice_name ' oracle'
  108         acti on :restar t
  109       end
  110  
  111       execut e "conf_db control_#{ db}" do
  112         comm and "expor t ORACLE_H OME=#{node [:oracle][ :rdbms][:o ra_home]};  emca -con fig dbcont rol db -re pos create  -respFile  #{node[:o racle][:rd bms][:ora_ home]}/em. rsp"
  113         user  'oracle'
  114         grou p 'oinstal l'
  115         envi ronment (n ode[:oracl e][:rdbms] [:env])
  116       end
  117     end
  118     
  119     yum_pack age "coreu tils" do
  120       action  :install
  121       arch ' x86_64'
  122     end
  123  
  124     execute  "shred_em_ rsp_#{db}"  do
  125       comman d "/usr/bi n/shred -z u #{node[: oracle][:r dbms][:ora _home]}/em .rsp"
  126       user ' root'
  127       group  'root'
  128     end
  129  
  130     ruby_blo ck "set_#{ db}_instal l_flag" do
  131       block  do
  132         node .set[:orac le][:rdbms ][:dbs][db ] = true
  133       end
  134       action  :create
  135     end
  136  
  137     execute  "append_#{ db}_to_tns names.ora"  do
  138         command "e cho '#{db}  =\n    (DESCRIPTI ON =\n      (ADDRESS_L IST =\n        (ADDRESS =  (PROTOCOL  = TCP)(HO ST = #{nod e[:fqdn]}) (PORT =  PORT ))\n      )\n      (CONNECT_D ATA =\n        (SERVICE_N AME = #{db })\n      )\n    )\n\n' >>  #{node[:or acle][:rdb ms][:ora_h ome]}/netw ork/admin/ tnsnames.o ra"
  139       not_if  "grep #{d b} #{node[ :oracle][: rdbms][:or a_home]}/n etwork/adm in/tnsname s.ora > /d ev/null 2> &1"
  140     end
  141  
  142     execute  "edit_orat abs_#{db}_ config" do
  143       comman d "sed -i. old '/^#{d b}/s/N$/Y/ ' /etc/ora tab"
  144       cwd '/ etc'
  145     end
  146  
  147     service  'restart o racle' do
  148       servic e_name 'or acle'
  149       action  :restart
  150     end
  151  
  152     director y "#{node[ :oracle][: rdbms][:db s_root]}/# {db}/expor t" do
  153       owner  'oracle'
  154       group  'dba'
  155       mode ' 0755'
  156     end
  157  
  158     bash "bl ock_change _tracking_ #{db}" do
  159       user " oracle"
  160       group  "oinstall"
  161       enviro nment (nod e[:oracle] [:rdbms][: env])
  162       code < <-EOH3
  163          exp ort ORACLE _SID=#{db}
  164          sql plus / as  sysdba <<- EOL2
  165          ALT ER DATABAS E ENABLE B LOCK CHANG E TRACKING  USING FIL E '#{node[ :oracle][: rdbms][:db s_root]}/# {db}/data1 /#{db}_blo ck_change_ tracking.t rk';
  166          CRE ATE DIRECT ORY "EXPOR T" AS '#{n ode[:oracl e][:rdbms] [:dbs_root ]}/#{db}/e xport';
  167          exi t
  168          EOL 2
  169       EOH3
  170     end
  171  
  172     director y "#{node[ :oracle][: rdbms][:db s_root]}/# {db}/backu p1" do
  173       owner  'oracle'
  174       group  'oinstall'
  175       mode ' 0755'
  176     end
  177  
  178     execute  "set_oracl e_sid_to_o racle_prof ile_#{db}"  do
  179       comman d "sed -i  's/ORACLE_ SID=.*/ORA CLE_SID=#{ db}/g' /ho me/oracle/ .profile"
  180       user ' oracle'
  181       group  'oinstall'
  182       enviro nment (nod e[:oracle] [:rdbms][: env])
  183     end
  184  
  185     execute  "set_oracl e_unqname_ to_oracle_ profile_#{ db}" do
  186       comman d "sed -i  's/ORACLE_ UNQNAME=.* /ORACLE_UN QNAME=#{db }/g' /home /oracle/.p rofile"
  187       user ' oracle'
  188       group  'oinstall'
  189       enviro nment (nod e[:oracle] [:rdbms][: env])
  190     end
  191  
  192   end