7 Replies Latest reply on May 16, 2018 8:32 PM by David of Earth

    Workspace Image Migration in Runtime Only Instance

    David of Earth

      Hello,

       

      I'm running APEX 5.1. I have setup my DEV and TEST instances and setup TEST as run-time only. I exported an application and imported it into the TEST instance by now my images are missing. I read another note here that said images aren't included in the application export in APEX 5. How am I supposed to migrate images into run-time only instance?

        • 1. Re: Workspace Image Migration in Runtime Only Instance
          Mike Kutz

          I'm assuming you "exported an application from Development [and committed that script to a code repository]"

          You'll need to "export the images from Development and commit them to the code repository" also.

           

          My $0.02

           

          MK

          • 2. Re: Workspace Image Migration in Runtime Only Instance
            David of Earth

            When you export the image does it create an install script?

            • 3. Re: Workspace Image Migration in Runtime Only Instance
              fac586

              David of Earth wrote:

               

              I'm running APEX 5.1. I have setup my DEV and TEST instances and setup TEST as run-time only. I exported an application and imported it into the TEST instance by now my images are missing. I read another note here that said images aren't included in the application export in APEX 5.

              What "note"? Please provide a link.

              How am I supposed to migrate images into run-time only instance?

              It depends on exactly what you mean by "images". In order to get an effective response to your questions it's necessary to unambiguously communicate the requirements using standard APEX, Oracle, and web terminology.

              • 4. Re: Workspace Image Migration in Runtime Only Instance
                David of Earth

                I don't have the link. I read it in another comment when I searched this space, hoping it's not correct. The image is stored as a workspace file. I need to export and import from my development instance to my test instance. For some reason it's not included in the workspace or application export.

                • 5. Re: Workspace Image Migration in Runtime Only Instance
                  Mike Kutz

                  Since we are talking about APEX Lifecycle, I figure this Oracle Whitepaper might help out.

                   

                  http://www.oracle.com/technetwork/developer-tools/apex/learnmore/apex-life-cycle-management-wp-3030229.pdf

                   

                  MK

                  • 6. Re: Workspace Image Migration in Runtime Only Instance
                    David of Earth

                    I found what I needed over at Orcado. The following will generate an install script for whatever file you want to migrate to another APEX instance. Just save the output as an SQL script and run in other instance.

                     

                    -- create a script to import images
                    declare
                    -- workspace to export the static file from
                    l_workspace varchar2(255):='APEX5';

                    -- cursor for all static workspace files
                        cursor c_file is
                        select w.id
                            ,w.security_group_id
                            ,w.file_name
                            ,w.mime_type
                            ,w.file_charset
                            ,w.file_content
                        from apex_050100.wwv_flow_company_static_files w
                        join apex_050100.wwv_flow_companies c
                            on c.provisioning_company_id = w.security_group_id
                            where c.display_name = '<WORKSPACE NAME>'
                            AND w.file_name = '<FILE NAME>';
                           
                    begin
                    -- loop throug all files
                        for r_file in c_file loop
                        -- start pl/sql block
                        dbms_output.put_line('begin');
                        -- set the security group id to make it possible to use the script outside APEX (toad,sqldeveloper)
                        dbms_output.put_line('  wwv_flow_api.set_security_group_id(p_security_group_id=> '||r_file.security_group_id||');');
                        -- create varchar table to hold the data for the BLOB
                        dbms_output.put_line('  wwv_flow_api.g_varchar2_table := wwv_flow_api.empty_varchar2_table;');
                        -- loop through LOB in blocks of 200 to improve readabiliy of the end script
                        for i in 1 .. trunc(dbms_lob.getlength(r_file.file_content)/200)+sign(mod(dbms_lob.getlength(r_file.file_content),200))
                        loop
                            -- save to raw file data from the blob to a varchar table
                            dbms_output.put_line('  wwv_flow_api.g_varchar2_table('||i||') := '''
                                                ||utl_raw.cast_to_varchar2(utl_raw.cast_to_raw(dbms_lob.substr(r_file.file_content,200,((i-1)*200)+1)))
                                                ||''''||';');
                        end loop;
                        -- create the create_workspace_static_file procedure with the correct parameters
                        dbms_output.put_line('  wwv_flow_api.create_workspace_static_file(');
                        dbms_output.put_line('     p_file_name      => '''||r_file.file_name||'''');
                        dbms_output.put_line('   , p_mime_type      => '''||r_file.mime_type||'''');
                        dbms_output.put_line('   , p_file_charset   => '''||r_file.file_charset||'''');
                        -- convert the varchar table to a blob as input for the procedure
                        dbms_output.put_line('   , p_file_content   => wwv_flow_api.varchar2_to_blob(wwv_flow_api.g_varchar2_table)');
                        dbms_output.put_line('   );');
                        dbms_output.put_line('end;');
                        end loop;
                        -- commit your work
                        dbms_output.put_line('commit;');
                    end;

                    • 7. Re: Workspace Image Migration in Runtime Only Instance
                      David of Earth

                      Did have to remove some unprintable characters at the beginning of lines created by above script.