Ok

En poursuivant votre navigation sur ce site, vous acceptez l'utilisation de cookies. Ces derniers assurent le bon fonctionnement de nos services. En savoir plus.

Scripts

  • Ora2PG script creation project

    #!/bin/sh
    #-------------------------------------------------------------------------------
    #
    # Script to create an ora2pg project
    # Author : JJY
    #
    #-------------------------------------------------------------------------------
    #set -vx
    clear
    echo " "
    echo " Welcome in the program to create a migration project. "
    echo " "
    echo " Write the working environment (dev/qa/prd) :"
    echo " "
    read env
    echo " "
    echo " Write the name of your asset :"
    echo " "
    read base
    echo " "
    mkdir -p $ORA2PG_HOME/$env
    ora2pg --project_base $ORA2PG_HOME/$env --init_project $base -c $ORA2PG_CONF
    #cp $ORA2PG_HOME/config/commonstruct.conf $ORA2PG_HOME/$env/$base/config/metadata_ora2pg.conf
    #cp $ORA2PG_HOME/config/commondata.conf $ORA2PG_HOME/$env/$base/config/data_ora2pg.conf
    echo " "
    echo " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
    echo " Working environment created for $base: $ORA2PG_HOME/$env/$base"
    echo " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
    echo " "
    echo " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
    echo " The file  $ORA2PG_HOME/$env/$base/config/metadata_ora2pg.conf         "
    echo " and  $ORA2PG_HOME/$env/$base/config/data_ora2pg.conf have to be fixed."
    echo " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"

    exit 0

  • [Oracle] Calculate the lobs size

    #!/bin/sh
    #script to calculate the lobs size

    sqlplus /nolog<<!EOF 
    conn / as sysdba
    spool req1.sql
    set head off
    set feed off
    select 'SELECT max(dbms_lob.getlength('''||col.column_name||''')) from '||col.owner||'.'||col.table_name||';'
    from sys.dba_tab_columns col inner join sys.dba_tables t on col.owner = t.owner and col.table_name = t.table_name where col.data_type in ('BLOB', 'CLOB', 'NCLOB', 'BFILE') 
    and col.owner not in ('GSMADMIN_INTERNAL','OCOR_OWN','AUDSYS','ANONYMOUS','CTXSYS','DBSNMP','EXFSYS', 'LBACSYS', 'MDSYS', 'MGMT_VIEW','OLAPSYS','OWBSYS','ORDPLUGINS', 'ORDSYS','OUTLN', 'SI_INFORMTN_SCHEMA','SYS','SYSMAN','SYSTEM', 'TSMSYS','WK_TEST', 'WKPROXY','WMSYS','XDB','APEX_040000', 'APEX_PUBLIC_USER','DIP', 'WKSYS', 'FLOWS_30000','FLOWS_FILES','MDDATA', 'ORACLE_OCM', 'XS$NULL', 'SPATIAL_CSW_ADMIN_USR', 'SPATIAL_WFS_ADMIN_USR', 'PUBLIC')
    ;
    spool off
    exit
    !EOF

    sqlplus -s / as sysdba  @req1.sql