Tuesday 20 September 2016

Reverting to Release 4.2 in a CDB




To revert to a previous Oracle Application Express release 4.2 in a CDB:
Make sure All PDB's Open at this stage.
alter pluggble database all open;
  1. If you altered your images directory, you must point the text alias /i/ back to images directory for the release you want to revert to. See "Copying the Images Directory."
  2. Change your working directory to apex/core in the 4.2 source.
  3. Cd $OH_HOME/apex/core create below sqls.This your apex5 directory under OH_HOME
  4. Create a new text file in that directory named apx42dgrd1.sql consisting of the following:
    alter session set current_schema = SYS;
     
    @core_sys_views.sql
     
    grant select on sys.wwv_flow_gv$session to APEX_040200;
     
    @wwv_flow_val.sql
    @wwv_flow_val.plb
    @wwv_dbms_sql.sql
    @wwv_dbms_sql.plb
     
    begin
        dbms_utility.compile_schema('APEX_040200');
    end;
    /
    
  5. Create a second new text file in that directory named apx42dgrd.sql consisting of the following:
    set define '^'
     
    whenever sqlerror exit
     
    column :xe_home new_value OH_HOME NOPRINT
    variable xe_home varchar2(255)
     
    set serverout on
    begin
    -- get oracle_home
        sys.dbms_system.get_env('ORACLE_HOME',:xe_home);
        if length(:xe_home) = 0 then
            sys.dbms_output.put_line(lpad('-',80,'-'));
            raise_application_error (
                -20001,
                'Oracle Home environment variable not set' );
        end if;
    end;
    /
    whenever sqlerror continue
     
    set termout off
    select :xe_home from sys.dual;
    set termout on
     
    host ^OH_HOME/perl/bin/perl -I ^OH_HOME/rdbms/admin ^OH_HOME/rdbms/admin/catcon.pl -b apx42dgrd apx42dgrd1.sql
    
  6. Start SQL*Plus and connect to CDB$ROOT of the database where Oracle Application Express is installed as SYS specifying the SYSDBA role:
    On UNIX and Linux:
    $ sqlplus /nolog
    SQL> SQL> CONNECT SYS as SYSDBA
    Enter password: SYS_password
    
  7. Execute the following commands:
    @apx42dgrd.sql
    
  8. Once this is completed successful goto the next step.
  9. Change your working directory to apex in the 4.2 source.
  10. cd $OH_HOME
  11. mv apex apex_5_old
  12. mv apex_old  apex this your old apex4.2 directory and create below sqls under apex4.2 .
  13. Create a new text file in that directory name apx42dgrd1.sql with the following contents:
    set define '^'
     
    ALTER SESSION SET CURRENT_SCHEMA = SYS;
     
    @apexvalidate x x APEX_040200
     
    ALTER SESSION SET CURRENT_SCHEMA = APEX_040200;
    exec apex_040200.wwv_flow_upgrade.switch_schemas('APEX_050000','APEX_040200');
    ALTER SESSION SET CURRENT_SCHEMA = SYS;
    declare
        l_apex_version varchar2(30);
    begin
        l_apex_version := apex_040200.wwv_flows_release;
        dbms_registry.downgrading('APEX','Oracle Application Express','validate_apex','APEX_040200');
        dbms_registry.downgraded('APEX',l_apex_version);
        validate_apex;
    end;
    /
    
  14. Create a second new text file in that directory named apx42dgrd.sql consisting of the following:
    set define '^'
     
    whenever sqlerror exit
     
    column :xe_home new_value OH_HOME NOPRINT
    variable xe_home varchar2(255)
     
    set serverout on
    begin
    -- get oracle_home
        sys.dbms_system.get_env('ORACLE_HOME',:xe_home);
        if length(:xe_home) = 0 then
            sys.dbms_output.put_line(lpad('-',80,'-'));
            raise_application_error (
                -20001,
                'Oracle Home environment variable not set' );
        end if;
    end;
    /
    whenever sqlerror continue
     
    set termout off
    select :xe_home from sys.dual;
    set termout on
     
    host ^OH_HOME/perl/bin/perl -I ^OH_HOME/rdbms/admin ^OH_HOME/rdbms/admin/catcon.pl -b apx42dgrd apx42dgrd1.sql
    
  15. Start SQL*Plus and connect to CDB$ROOT of the database where Oracle Application Express is installed as SYS specifying the SYSDBA role:
    On UNIX and Linux:
    $ sqlplus /nolog
    SQL> SQL> CONNECT SYS as SYSDBA
    Enter password: SYS_password
    
  16. Execute the following:
    @apx42dgrd.sql
  17. SQL> @apx42dgrd.sql
    
    PL/SQL procedure successfully completed.
    
    catcon: ALL catcon-related output will be written to apx42dgrd_catcon_17261.lst
    catcon: See apx42dgrd*.log files for output generated by scripts
    catcon: See apx42dgrd_*.lst files for spool files, if any
    catcon.pl: completed successfully
    
    SQL> commit;
    
    Commit complete.
    
    SQL> select version from sys.dba_registry where comp_id = 'APEX';
    
    VERSION
    ------------------------------
    4.2.5.00.08
    
    SQL> show con_name
    
    CON_NAME
    ------------------------------
    CDB$ROOT
  18. Now you are done with reverting.
    Thanks 
    Srini  

No comments:

Post a Comment


No one has ever become poor by giving