biemond / biemond-oradb

Puppet Oracle Database Module
Apache License 2.0
59 stars 113 forks source link

installdb.pp failing to unzip 18c source due to directory ownership/permission issue #257

Open shammid opened 5 years ago

shammid commented 5 years ago

The issue doesn't exist if oracle home path is pre-created. Otherwise, the path is getting created, but with root ownership for parent directories.

oracle base: /u01/app already exists. path expected: /u01/app/oracle/product/18.0.0/db_home1

Path is getting created, but, oracle, product, & 18.0.0 directories are owned by root. The last one db_home1 is correctly owned by oracle:oinstall. Due to parent directories being 740, the unzip into the newly created path is failing.

The path is being created by this code in installdb.pp:

if ( $version in ['18.0.0.0']) {

add oracle home for the unzip

db_directory_structure{"oracle structure ${version}_${title}":
  ensure            => present,
  oracle_base_dir   => $oracle_base,
  oracle_home_dir   => $oracle_home,
  ora_inventory_dir => $ora_inventory,
  download_dir      => $resp_file_dir,
  os_user           => $user,
  os_group          => $group_install,
}

Likely culprit is db_directory_structure.rb: unless oracle_home.nil? make_directory oracle_home owned_by_oracle oracle_home, user, group end end

def make_directory(path) Puppet.info "creating directory #{path}" FileUtils.mkdir_p path end

def owned_by_oracle(path, user, group) Puppet.info "Setting oracle ownership for #{path} with 0775" FileUtils.chmod 0775, path FileUtils.chown user, group, path end

I couldn't find details on FileUtils.chown, but it appears it is only changing ownership of the full path /u01/app/oracle/product/18.0.0./db_home1 and leaves the parent directories at their original root ownership.

This was not an issue prior to 18c since oracle_home creation wasn't part of db_directory_structure then.

shammid commented 5 years ago

This is indeed and issue.

biemond commented 5 years ago

Hi, what is the issue here. I cannot and will not change the parent dirs because that will do more harm then it solves

shammid commented 5 years ago

Hi,

Well, db_directory_structure is creating the parent directories (FileUtils.mkdir_p path), but changing ownership only for the full path.

This was not an issue prior to 18c since the oracle home path was being created by Oracle’s installer, not your module. You need to create it in 18c since you got to unzip the source image into it.

For me, easy workaround is to pre-create oracle_home structure before calling oradb module, so no biggie.

I just think either this module shouldn’t create the oracle home path, or if it does, it needs to be usable. The way it is being created, unzip will always fail.

Shammi DHALL

From: Edwin Biemond [mailto:notifications@github.com] Sent: Monday, April 29, 2019 5:03 PM To: biemond/biemond-oradb biemond-oradb@noreply.github.com Cc: Shammi X Dhall shammi.x.dhall@us.hsbc.com; State change state_change@noreply.github.com Subject: EXTERNAL: Re: [biemond/biemond-oradb] installdb.pp failing to unzip 18c source due to directory ownership/permission issue (#257)

Hi, what is the issue here. I cannot and will not change the parent dirs because that will do more harm then it solves

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHubhttps://github.com/biemond/biemond-oradb/issues/257#issuecomment-487760046, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AL5WPX4JT7SQIXISIREVVKTPS5V7TANCNFSM4HI2JLXQ.


** This message originated from the Internet. Its originator may or may not be who they claim to be and the information contained in the message and any attachments may or may not be accurate. **


SAVE PAPER - THINK BEFORE YOU PRINT!

This E-mail is confidential.

It may also be legally privileged. If you are not the addressee you may not copy, forward, disclose or use any part of it. If you have received this message in error, please delete it and all copies from your system and notify the sender immediately by return E-mail.

Internet communications cannot be guaranteed to be timely secure, error or virus-free. The sender does not accept liability for any errors or omissions.

biemond commented 5 years ago

you don't need to create it yourself. it just works in https://github.com/biemond/biemond-oradb-vagrant-18.3-CDB-puppet4_3 and with grid https://github.com/biemond/biemond-oradb-vagrant-18.3-ASM-puppet4_3

so what does not work for you and take a look at these vagrant boxes

thanks

sureshr7 commented 4 years ago

On a similar issue, if grid home and oracle home shares the same base directory oracle home is not getting created.

Notice: /Stage[main]/Profile::Oracle::Server/Oradb::Installdb[dbsoftware]/Notify[oradb::installdb /u01/app/oracle/product/19.0.0/dbhome_1 does not exists]/message: defined 'message' as 'oradb::installdb /u01/app/oracle/product/19.0.0/dbhome_1 does not exists' Error: 'unzip -o /u01/app/oracle/patches//oracle19c_july2019psu.zip -d /u01/app/oracle/product/19.0.0/dbhome_1' returned 2 instead of one of [0]

-bash-4.2$ ls -tlr total 4 drwxrwxr-x 84 oracle oinstall 4096 Jan 14 18:04 grid -bash-4.2$ pwd /u01/app/oracle/product/19.0.0

sureshr7 commented 4 years ago

Even after using different path, db software install failed and puppet server log shows db_directory_structure.rb is creating grid home(/u01/app/grid/product/19.0.0/grid) again instead of oracle home (/u01/app/oracle/product/19.0.0/dbhome_1)

Info: configure oracle folders for grid structure 19.0.0.0 Info: create the following directories: /u01/app/grid, /u01/app/oraInventory, /u01/app/oracle/patches/ Info: creating directory /u01/app/grid Info: creating directory /u01/app/oracle/patches/ Info: creating directory /u01/app/oraInventory Info: Setting oracle ownership for /u01/app/grid with 0775 Info: Setting public permissions 0777 for /u01/app/oracle/patches/ Info: Setting oracle ownership for /u01/app/oraInventory with 0775 Info: creating directory /u01/app/grid/product/19.0.0/grid Info: Setting oracle ownership for /u01/app/grid/product/19.0.0/grid with 0775