SPOOL AW.LOG

set serveroutput on
execute dbms_aw.execute('show ''Creating utils AW...''');
execute dbms_aw.execute('aw create utils');
execute dbms_aw.execute('cda eifdir');
execute dbms_aw.execute('import all from eif file ''utils.eif'' dfns');
execute dbms_aw.execute('import all from eif file ''utils.eif'' data');
execute dbms_aw.execute('infile ''_migrateaw.pro''');
execute dbms_aw.execute('update');
execute dbms_aw.execute('commit');
execute dbms_aw.execute('aw detach utils');

execute dbms_aw.execute('show ''Creating debug AW...''');
execute dbms_aw.execute('aw create awdebug');
execute dbms_aw.execute('import all from eif file ''awdebug.eif'' dfns');
execute dbms_aw.execute('import all from eif file ''awdebug.eif'' data');
execute dbms_aw.execute('update');
execute dbms_aw.execute('commit');
execute dbms_aw.execute('aw detach awdebug');

execute dbms_aw.execute('show ''Creating shaw AW...''');
execute dbms_aw.execute('aw create shaw');
execute dbms_aw.execute('import all from eif file ''shaw.eif'' dfns');
execute dbms_aw.execute('import all from eif file ''shaw.eif'' data');


execute dbms_aw.execute('show ''Checking the Analytic Workspace version...''');
variable aw_version VARCHAR2(2000);
variable aw_compat  VARCHAR2(2000);
begin
    dbms_utility.db_version(:aw_version, :aw_compat);
    dbms_output.put_line('The Analytic Workspace version is: ' || :aw_version);
    if substr(:aw_version,1,1) <> '9' then
       dbms_aw.execute('show ''Migrating CS_OLAP.SHAW...'';aw attach cs_olap.utils ro last; call _migrateaw(''CS_OLAP.SHAW'')');
    end if;
end;
/   

execute dbms_aw.execute('update');
execute dbms_aw.execute('commit');
execute dbms_aw.execute('aw detach shaw');
execute dbms_aw.execute('show ''AW creation complete''');
SPOOL OFF
quit;
