SPOOL postDbCreation.log

-- SE EXECUTA LOGAT CU USERUL SYSTEM

PROMPT
PROMPT CREATING PUBLIC SYNONYMS
PROMPT ========================
PROMPT

drop public synonym SYN_LUNILEAN; 
drop public synonym SYN_PACK_DREPTURI;
drop public synonym syn_vdef_util_grup;
drop public synonym syn_def_grup_drept;
drop public synonym syn_utilizatori;
drop public synonym syn_vdef_util_programe; 
drop public synonym SYN_VDEF_UTIL_OBIECTE;
drop public synonym syn_vutilizatori;
drop public synonym syn_nom_programe; 
drop public synonym syn_def_programe;
drop public synonym SYN_NOM_FIRME; 
drop public synonym syn_vdef_util_programe; 
drop public synonym syn_helpcont; 
drop public synonym stringAgg;

drop public synonym char_row; 
drop public synonym char_tab;
drop public synonym num_row; 
drop public synonym num_tab;

drop public synonym uw_sel_row;
drop public synonym uw_sel_tab;

drop public synonym getwordcount;
drop public synonym getwordnum;
drop public synonym charc2collection;
drop public synonym charn2collection;


drop public synonym SYN_V_NOM_FIRME;
drop public synonym syn_nom_forme_juridice;
drop public synonym syn_nom_forme_organizare;
drop public synonym syn_nom_tip_societate;
drop public synonym syn_nom_forme_proprietate;

drop synonym contafin_oracle.vdef_programe_serii;


create context sesiune using contafin_oracle.set_variabile;

CREATE PUBLIC SYNONYM SYN_DEF_GRUP FOR CONTAFIN_ORACLE.DEF_GRUP;
GRANT SELECT ON SYN_DEF_GRUP TO PUBLIC;
GRANT REFERENCES ON SYN_DEF_GRUP TO PUBLIC;

CREATE PUBLIC SYNONYM SYN_DEF_PROGRAME FOR CONTAFIN_ORACLE.DEF_PROGRAME;
GRANT SELECT ON SYN_DEF_PROGRAME TO PUBLIC;
GRANT REFERENCES ON SYN_DEF_PROGRAME TO PUBLIC;

CREATE PUBLIC SYNONYM SYN_VDEF_PROGRAME FOR CONTAFIN_ORACLE.VDEF_PROGRAME;
GRANT SELECT ON SYN_VDEF_PROGRAME TO PUBLIC;
GRANT REFERENCES ON SYN_VDEF_PROGRAME TO PUBLIC;

CREATE PUBLIC SYNONYM SYN_LUNILEAN FOR CONTAFIN_ORACLE.LUNILEAN;
GRANT SELECT ON SYN_LUNILEAN TO PUBLIC;
GRANT REFERENCES ON SYN_LUNILEAN TO PUBLIC;

CREATE PUBLIC SYNONYM SYN_NOM_FIRME FOR CONTAFIN_ORACLE.NOM_FIRME;
GRANT SELECT ON SYN_NOM_FIRME TO PUBLIC;
GRANT REFERENCES ON SYN_NOM_FIRME TO PUBLIC;

CREATE PUBLIC SYNONYM SYN_NOM_PROGRAME FOR CONTAFIN_ORACLE.NOM_PROGRAME;
GRANT SELECT ON SYN_NOM_PROGRAME TO PUBLIC;
GRANT REFERENCES ON SYN_NOM_PROGRAME TO PUBLIC;

CREATE PUBLIC SYNONYM SYN_PACK_DREPTURI FOR CONTAFIN_ORACLE.PACK_DREPTURI;
GRANT EXECUTE ON SYN_PACK_DREPTURI TO PUBLIC;
--GRANT REFERENCES ON SYN_PACK_DREPTURI TO PUBLIC;

CREATE PUBLIC SYNONYM SYN_UTILIZATORI FOR CONTAFIN_ORACLE.UTILIZATORI;
GRANT SELECT ON SYN_UTILIZATORI TO PUBLIC;
GRANT REFERENCES ON SYN_UTILIZATORI TO PUBLIC;

create public synonym syn_vdef_util_programe for CONTAFIN_ORACLE.VDEF_UTIL_PROGRAME;
grant select on syn_vdef_util_programe to public;

create public synonym syn_vdef_util_firme for CONTAFIN_ORACLE.VDEF_UTIL_firme;
grant select on syn_vdef_util_firme TO PUBLIC;
grant references on syn_vdef_util_firme to public;

CREATE PUBLIC SYNONYM SYN_VDEF_UTIL_OBIECTE FOR CONTAFIN_ORACLE.VDEF_UTIL_OBIECTE;
GRANT SELECT ON SYN_VDEF_UTIL_OBIECTE TO PUBLIC;
GRANT REFERENCES ON SYN_VDEF_UTIL_OBIECTE TO PUBLIC;

CREATE PUBLIC SYNONYM SYN_VUTILIZATORI FOR CONTAFIN_ORACLE.VUTILIZATORI;
GRANT SELECT ON SYN_VUTILIZATORI TO PUBLIC;
GRANT REFERENCES ON SYN_VUTILIZATORI TO PUBLIC;

CREATE PUBLIC SYNONYM SYN_vdef_util_grup FOR CONTAFIN_ORACLE.vdef_util_grup;
GRANT SELECT ON SYN_vdef_util_grup TO PUBLIC;
GRANT REFERENCES ON SYN_vdef_util_grup TO PUBLIC;

CREATE PUBLIC SYNONYM syn_def_grup_drept FOR CONTAFIN_ORACLE.def_grup_drept;
GRANT SELECT ON syn_def_grup_drept TO PUBLIC;
GRANT REFERENCES ON syn_def_grup_drept TO PUBLIC;

create public synonym SYN_OPTIUNI_PROGRAME for CONTAFIN_ORACLE.OPTIUNI_PROGRAME;
grant select on SYN_OPTIUNI_PROGRAME to public;

create public synonym syn_helpcont for CONTAFIN_ORACLE.helpcont;
grant select on syn_helpcont to public;

CREATE PUBLIC SYNONYM syn_v_nom_firme FOR CONTAFIN_ORACLE.V_NOM_FIRME;
GRANT SELECT ON SYN_V_NOM_FIRME TO PUBLIC;

create public synonym syn_nom_forme_juridice for CONTAFIN_ORACLE.nom_forme_juridice;
grant select on syn_nom_forme_juridice to public;

create public synonym syn_nom_forme_organizare for CONTAFIN_ORACLE.nom_forme_organizare;
grant select on syn_nom_forme_organizare to public;

create public synonym syn_nom_tip_societate for CONTAFIN_ORACLE.nom_tip_societate;
grant select on syn_nom_tip_societate to public;

create public synonym syn_nom_forme_proprietate for CONTAFIN_ORACLE.nom_forme_proprietate;
grant select on syn_nom_forme_proprietate to public;

create public synonym stringAgg for CONTAFIN_ORACLE.stringAgg;
grant execute on stringAgg to public;
grant execute on StringAggType to public;

create public synonym char_row for CONTAFIN_ORACLE.char_row; 
create public synonym char_tab for CONTAFIN_ORACLE.char_tab;
create public synonym num_row for CONTAFIN_ORACLE.num_row; 
create public synonym num_tab for CONTAFIN_ORACLE.num_tab;

grant execute on num_row to public;
grant execute on num_tab to public;
grant execute on char_row to public;
grant execute on char_tab to public;


create public synonym uw_sel_row for CONTAFIN_ORACLE.uw_sel_row;
create public synonym uw_sel_tab for CONTAFIN_ORACLE.uw_sel_tab;
grant execute on uw_sel_row to public;
grant execute on uw_sel_tab to public;

create public synonym valoaretag for CONTAFIN_ORACLE.valoaretag;
grant execute on valoaretag to public;

create public synonym getwordcount for contafin_oracle.getwordcount;
create public synonym getwordnum for contafin_oracle.getwordnum;
create public synonym charc2collection for contafin_oracle.charc2collection;
create public synonym charn2collection for contafin_oracle.charn2collection;
grant execute on getwordcount to public;
grant execute on getwordnum to public;
grant execute on charc2collection to public;
grant execute on charn2collection to public;


CREATE SYNONYM CONTAFIN_ORACLE.VDEF_PROGRAME_SERII FOR SYS.VAUTH_SERII;
GRANT SELECT ON CONTAFIN_ORACLE.VDEF_PROGRAME_sERII TO CONTAFIN_ORACLE;

create public synonym syn_vnom_valute_iso for CONTAFIN_ORACLE.VNOM_VALUTE_ISO;
grant select on syn_vnom_valute_iso to public;

CREATE PUBLIC SYNONYM SYN_CURS_ACTUALIZARI FOR CONTAFIN_ORACLE.CURS_ACTUALIZARI;
GRANT SELECT ON SYN_CURS_ACTUALIZARI TO PUBLIC;
GRANT REFERENCES ON SYN_CURS_ACTUALIZARI TO PUBLIC;

CREATE PUBLIC SYNONYM syn_nom_valute_iso FOR CONTAFIN_ORACLE.NOM_VALUTE_ISO;
GRANT SELECT ON syn_nom_valute_iso TO PUBLIC;
GRANT REFERENCES ON syn_nom_valute_iso TO PUBLIC;

CREATE PUBLIC SYNONYM syn_curs_cotatii FOR CONTAFIN_ORACLE.CURS_COTATII;
GRANT SELECT ON syn_curs_cotatii TO PUBLIC;
GRANT REFERENCES ON syn_curs_cotatii TO PUBLIC;

grant references on syn_nom_forme_juridice to public;
grant references on syn_nom_forme_organizare to public;
grant references on syn_nom_tip_societate to public;
grant references on syn_nom_forme_proprietate to public;

create public synonym syn_nom_cetatenii for contafin_oracle.nom_cetatenii;
grant select on syn_nom_cetatenii to public;
grant references on syn_nom_cetatenii to public;

create public synonym syn_nom_tari for contafin_oracle.nom_tari;
grant select on syn_nom_tari to public;
grant references on syn_nom_tari to public;

create public synonym syn_sal_nom_temei for contafin_oracle.sal_nom_temei;
grant select on syn_sal_nom_temei to public;
grant references on syn_sal_nom_temei to public;

create public synonym syn_sal_nom_tipautorizatie for contafin_oracle.sal_nom_tipautorizatie;
grant select on syn_sal_nom_tipautorizatie to public;
grant references on syn_sal_nom_tipautorizatie to public;

create public synonym syn_sal_nom_tip_spor for contafin_oracle.sal_nom_tip_spor;
grant select on syn_sal_nom_tip_spor to public;
grant references on syn_sal_nom_tip_spor to public;

create public synonym syn_sal_nom_tip_norme for contafin_oracle.sal_nom_tip_norme;
grant select on syn_sal_nom_tip_norme to public;
grant references on syn_sal_nom_tip_norme to public;

create public synonym syn_sal_nom_stari_ctr for contafin_oracle.sal_nom_stari_ctr;
grant select on syn_sal_nom_stari_ctr to public;
grant references on syn_sal_nom_stari_ctr to public;

create public synonym syn_sal_nom_durata_munca for contafin_oracle.sal_nom_durata_munca;
grant select on syn_sal_nom_durata_munca to public;
grant references on syn_sal_nom_durata_munca to public;

create public synonym syn_sal_nom_repartizare_munca for contafin_oracle.sal_nom_repartizare_munca;
grant select on syn_sal_nom_repartizare_munca to public;
grant references on syn_sal_nom_repartizare_munca to public;

create public synonym syn_sal_nom_intervale_munca for contafin_oracle.sal_nom_intervale_munca;
grant select on syn_sal_nom_intervale_munca to public;
grant references on syn_sal_nom_intervale_munca to public;

create public synonym syn_sal_cor for contafin_oracle.sal_cor;
grant select on syn_sal_cor to public;
grant references on syn_sal_cor to public;

create public synonym syn_sal_actualizare_cor for contafin_oracle.sal_actualizare_cor;
grant select on syn_sal_actualizare_cor to public;
grant references on syn_sal_actualizare_cor to public;

create public synonym syn_sal_nom_intervale_munca for contafin_oracle.sal_nom_intervale_munca;
grant select on syn_sal_nom_intervale_munca to public;
grant references on syn_sal_nom_intervale_munca to public;

CREATE PUBLIC SYNONYM SYN_ATAS_ATASAMENTE FOR CONTAFIN_ORACLE.ATAS_ATASAMENTE;
GRANT SELECT ON SYN_ATAS_ATASAMENTE TO PUBLIC;
GRANT REFERENCES ON SYN_ATAS_ATASAMENTE TO PUBLIC;

CREATE PUBLIC SYNONYM SYN_ATAS_REFERINTE FOR CONTAFIN_ORACLE.ATAS_REFERINTE;
GRANT SELECT ON SYN_ATAS_REFERINTE TO PUBLIC;
GRANT REFERENCES ON SYN_ATAS_REFERINTE TO PUBLIC;

create public synonym pack_update for pack_update;
grant execute on pack_update to public;

CREATE PUBLIC SYNONYM PACK_UTILS FOR PACK_UTILS;
GRANT EXECUTE ON PACK_UTILS TO PUBLIC;

CREATE PUBLIC SYNONYM SYN_NOM_CODURI_CAEN FOR CONTAFIN_ORACLE.NOM_CODURI_CAEN;
GRANT SELECT ON SYN_NOM_CODURI_CAEN TO PUBLIC;
GRANT REFERENCES ON SYN_NOM_CODURI_CAEN TO PUBLIC;

--------------------------------------------------

DROP PUBLIC SYNONYM SYN_NOM_JUDETE;
CREATE PUBLIC SYNONYM SYN_NOM_JUDETE FOR CONTAFIN_ORACLE.NOM_JUDETE;
GRANT SELECT ON SYN_NOM_JUDETE TO PUBLIC;
GRANT REFERENCES ON SYN_NOM_JUDETE TO PUBLIC;


DROP PUBLIC SYNONYM SYN_NOM_LOCALITATI;
CREATE PUBLIC SYNONYM SYN_NOM_LOCALITATI FOR CONTAFIN_ORACLE.NOM_LOCALITATI;
GRANT SELECT ON SYN_NOM_LOCALITATI TO PUBLIC;
GRANT REFERENCES ON SYN_NOM_LOCALITATI TO PUBLIC;

DROP PUBLIC SYNONYM SYN_VNOM_JUDETE;
CREATE PUBLIC SYNONYM SYN_VNOM_JUDETE FOR CONTAFIN_ORACLE.VNOM_JUDETE;
GRANT SELECT ON SYN_VNOM_JUDETE TO PUBLIC;

DROP PUBLIC SYNONYM SYN_VNOM_LOCALITATI;
CREATE PUBLIC SYNONYM SYN_VNOM_LOCALITATI FOR CONTAFIN_ORACLE.VNOM_LOCALITATI;
GRANT SELECT ON SYN_VNOM_LOCALITATI TO PUBLIC;

DROP PUBLIC SYNONYM SYN_VNOM_TARI;
CREATE PUBLIC SYNONYM SYN_VNOM_TARI FOR CONTAFIN_ORACLE.VNOM_TARI;
GRANT SELECT ON SYN_VNOM_TARI TO PUBLIC;

DROP PUBLIC SYNONYM SYN_PACK_DEF_CO;
CREATE PUBLIC SYNONYM SYN_PACK_DEF_CO FOR CONTAFIN_ORACLE.PACK_DEF_CO;
GRANT EXECUTE ON SYN_PACK_DEF_CO TO PUBLIC;
---------------------------------------------------
DROP TYPE CONTAFIN_ORACLE.CONTRACT_M;
DROP TYPE CONTAFIN_ORACLE.SAL_CONTRACT_M;

CREATE OR REPLACE TYPE CONTAFIN_ORACLE.SAL_CONTRACT_M AS OBJECT
(
  variabila varchar2(5),
  valoare   VARCHAR2(1000)
);
/
grant execute on CONTAFIN_ORACLE.SAL_CONTRACT_M to PUBLIC;


CREATE OR REPLACE TYPE CONTAFIN_ORACLE.CONTRACT_M IS TABLE OF sal_contract_m;
/
grant execute on CONTAFIN_ORACLE.CONTRACT_M to PUBLIC;

--------------------------------------------------------
DROP PUBLIC SYNONYM CONTRACT_M;
CREATE PUBLIC SYNONYM CONTRACT_M FOR CONTAFIN_ORACLE.CONTRACT_M;
GRANT EXECUTE ON CONTRACT_M TO PUBLIC

DROP PUBLIC SYNONYM SAL_CONTRACT_M;
CREATE PUBLIC SYNONYM SAL_CONTRACT_M FOR CONTAFIN_ORACLE.SAL_CONTRACT_M;
GRANT EXECUTE ON SAL_CONTRACT_M TO PUBLIC

DROP PUBLIC SYNONYM SAL_RED;
CREATE PUBLIC SYNONYM SAL_RED FOR CONTAFIN_ORACLE.SAL_RED;
GRANT EXECUTE ON SAL_RED TO PUBLIC;

DROP PUBLIC SYNONYM SAL_CAMPURI_RED;
CREATE PUBLIC SYNONYM SAL_CAMPURI_RED FOR CONTAFIN_ORACLE.SAL_CAMPURI_RED;
GRANT EXECUTE ON SAL_CAMPURI_RED TO PUBLIC;

DROP PUBLIC SYNONYM TABSTERS;
CREATE PUBLIC SYNONYM TABSTERS FOR CONTAFIN_ORACLE.TABSTERS;
GRANT EXECUTE ON TABSTERS TO PUBLIC;

DROP PUBLIC SYNONYM SAL_TABELESTERS;
CREATE PUBLIC SYNONYM SAL_TABELESTERS FOR CONTAFIN_ORACLE.SAL_TABELESTERS;
GRANT EXECUTE ON SAL_TABELESTERS TO PUBLIC;

DROP PUBLIC SYNONYM FF_SUME;
CREATE PUBLIC SYNONYM FF_SUME FOR CONTAFIN_ORACLE.FF_SUME;
GRANT EXECUTE ON FF_SUME TO PUBLIC;

DROP PUBLIC SYNONYM FF_PERSINTRET;
CREATE PUBLIC SYNONYM FF_PERSINTRET FOR CONTAFIN_ORACLE.FF_PERSINTRET;
GRANT EXECUTE ON FF_PERSINTRET TO PUBLIC;

DROP PUBLIC SYNONYM VANZARI_DETALII_TAB;
CREATE PUBLIC SYNONYM VANZARI_DETALII_TAB FOR CONTAFIN_ORACLE.VANZARI_DETALII_TAB;
GRANT EXECUTE ON VANZARI_DETALII_TAB TO PUBLIC;

DROP PUBLIC SYNONYM PIVOT_TABLE;
CREATE PUBLIC SYNONYM PIVOT_TABLE FOR CONTAFIN_ORACLE.PIVOT_TABLE;
GRANT EXECUTE ON PIVOT_TABLE TO PUBLIC;

DROP PUBLIC SYNONYM tabinchideretva;
CREATE PUBLIC SYNONYM tabinchideretva FOR CONTAFIN_ORACLE.tabinchideretva;
GRANT EXECUTE ON tabinchideretva TO PUBLIC;

DROP PUBLIC SYNONYM tabelavaloritaguri;
CREATE PUBLIC SYNONYM tabelavaloritaguri FOR CONTAFIN_ORACLE.tabelavaloritaguri;
GRANT EXECUTE ON tabelavaloritaguri TO PUBLIC;

DROP PUBLIC SYNONYM vanzari_detalii_tab;
CREATE PUBLIC SYNONYM vanzari_detalii_tab FOR CONTAFIN_ORACLE.vanzari_detalii_tab;
GRANT EXECUTE ON vanzari_detalii_tab TO PUBLIC;

DROP PUBLIC SYNONYM randinchideretva;
CREATE PUBLIC SYNONYM randinchideretva FOR CONTAFIN_ORACLE.randinchideretva;
GRANT EXECUTE ON randinchideretva TO PUBLIC;


DROP PUBLIC SYNONYM PIVOT_ROW;
CREATE PUBLIC SYNONYM PIVOT_ROW FOR CONTAFIN_ORACLE.PIVOT_ROW;
GRANT EXECUTE ON PIVOT_ROW TO PUBLIC;

DROP PUBLIC SYNONYM SERVER_INFO;
CREATE PUBLIC SYNONYM SERVER_INFO FOR CONTAFIN_ORACLE.SERVER_INFO;
GRANT SELECT,UPDATE ON SERVER_INFO TO PUBLIC;

DROP PUBLIC SYNONYM PACK_UTILS;
CREATE PUBLIC SYNONYM PACK_UTILS FOR CONTAFIN_ORACLE.PACK_UTILS;
GRANT EXECUTE ON PACK_UTILS TO PUBLIC;

DROP PUBLIC SYNONYM PACK_UTILS_FILE;
CREATE PUBLIC SYNONYM PACK_UTILS_FILE FOR CONTAFIN_ORACLE.PACK_UTILS_FILE;
GRANT EXECUTE ON PACK_UTILS_FILE TO PUBLIC;

create public synonym pack_roartvai for contafin_oracle.pack_roartvai;
grant execute on pack_roartvai to public;

create or replace public synonym syn_nom_tipapatrid for contafin_oracle.nom_tipapatrid;
GRANT SELECT ON syn_nom_tipapatrid TO PUBLIC;
grant references on syn_nom_tipapatrid to PUBLIC;

create or replace public synonym syn_vnom_um_iso for contafin_oracle.vnom_um_iso;
grant select, references on syn_vnom_um_iso to public;
grant select, references on contafin_oracle.nom_um_iso to public;

create public synonym rtvai_agenti for contafin_oracle.rtvai_agenti;
create public synonym rtvai_istoric for contafin_oracle.rtvai_istoric;
grant select on rtvai_agenti to public;
grant select on rtvai_istoric to public;

--------------------------------------------------------
GRANT ALL ON DIRECTORY DMPDIR TO PUBLIC;   
GRANT EXECUTE ON UTL_FILE TO PUBLIC;

GRANT EXECUTE ON UTL_INADDR TO CONTAFIN_ORACLE;
GRANT EXECUTE ON UTL_TCP TO CONTAFIN_ORACLE;
GRANT EXECUTE ON UTL_SMTP TO CONTAFIN_ORACLE;
GRANT EXECUTE ON UTL_HTTP TO CONTAFIN_ORACLE;
GRANT EXECUTE ON UTL_MAIL TO CONTAFIN_ORACLE;

grant execute on dbms_lock to public;
---------------------------------------------------------

-----------------------------------
BEGIN
   DBMS_NETWORK_ACL_ADMIN.DROP_ACL(acl => 'roaupdate.xml'); 
END;
/

BEGIN
  DBMS_NETWORK_ACL_ADMIN.CREATE_ACL(acl         => 'roaupdate.xml',
                                    description => 'Permissions to send mail',
                                    principal   => 'CONTAFIN_ORACLE',
                                    is_grant    => true,
                                    privilege   => 'connect');
 
  DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(acl       => 'roaupdate.xml',
                                       principal => 'CONTAFIN_ORACLE',
                                       is_grant  => true,
                                       privilege => 'resolve');
 
  DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL(acl  => 'roaupdate.xml',
                                    host => '*');
END;
/
COMMIT;

SPOOL OFF

disconnect
quit