connect &DBA/&DBAPASSWORD@&TNSALIAS
--
create or replace directory DEMOROOT as '&INSTALL_FOLDER'
/
declare 
  res boolean;
  NEW_ACL_PATH varchar2(2000);
begin
  NEW_ACL_PATH := '/sys/acls/all_owner_metadata_enabled_acl.xml';
  if (not dbms_xdb.existsResource(NEW_ACL_PATH)) then
    res := dbms_xdb.createResource(NEW_ACL_PATH,bfilename('DEMOROOT','xml/all_owner_metadata_enabled_acl.xml'));
    commit;
  end if;
  NEW_ACL_PATH := '/sys/acls/ro_all_metadata_enabled_acl.xml';
  if (not dbms_xdb.existsResource(NEW_ACL_PATH)) then
    res := dbms_xdb.createResource(NEW_ACL_PATH,bfilename('DEMOROOT','xml/ro_all_metadata_enabled_acl.xml'));
    commit;
  end if;
  NEW_ACL_PATH := '/sys/acls/bootstrap_metadata_enabled_acl.xml';
  if (not dbms_xdb.existsResource(NEW_ACL_PATH)) then
    res := dbms_xdb.createResource(NEW_ACL_PATH,bfilename('DEMOROOT','xml/bootstrap_metadata_enabled_acl.xml'));
    commit;
  end if;
  NEW_ACL_PATH := '/sys/acls/published_image_folder_acl.xml';
  if (not dbms_xdb.existsResource(NEW_ACL_PATH)) then
    res := dbms_xdb.createResource(NEW_ACL_PATH,bfilename('DEMOROOT','xml/published_image_folder_acl.xml'));
    commit;
  end if;
  NEW_ACL_PATH := '/sys/acls/published_image_acl.xml';
  if (not dbms_xdb.existsResource(NEW_ACL_PATH)) then
    res := dbms_xdb.createResource(NEW_ACL_PATH,bfilename('DEMOROOT','xml/published_image_acl.xml'));
    commit;
  end if;
end;
/
connect &METADATAOWNER/&USERPASSWORD@&TNSALIAS
--
set serveroutput on
--
begin
  xdb_utilities.uploadFiles('xml/sourceFileList.xml','DEMOROOT','/home/' || :METADATAOWNER);
  dbms_xdb.changeOwner('/home/' || :METADATAOWNER,:METADATAOWNER,TRUE);
end;
/
disconnect
--
