Forum Stats

  • 3,874,172 Users
  • 2,266,676 Discussions
  • 7,911,751 Comments

Discussions

SQLcl (22.3) apex export directory to export not working

User_B534Q
User_B534Q Member Posts: 8 Green Ribbon

Hello,

i just update my 22.2 for the 22.3 and i realized that the option -dir with apex export is not working.

if i use : -dir /opt/backup/apex , then it create opt/backup/apex in the CURRENT DIRECTORY.

is there something i can to before to export , maybe set the current working dir with a command ?

thanks for any help.


som

Best Answer

  • Paavo
    Paavo Member Posts: 756 Silver Badge
    Answer ✓

    @User_B534Q - you could benefit of setting perhaps your profile so that it gives better looking name :)

    Just did deployments with SqlCL and used commands like:

    pwd
    cd som_dir
    !ls
    !mkdir apps
    !mkdir apps/MAYBEUSEAPPALIASNAMEHERE
    apex export -api 142 -dir apps/MAYBEUSEAPPALIASNAMEHERE -exporiginalids false -exppubreports true -expsavedreports true -expsupportingobjects Y
    
    --then commit and push changes to your git repo
    --remember to quit this connection before deploying to target
    

    Hint when you want to deploy to your target environment, then I have found that it is easier if the target parsing schema has the same name. One approach is then to use Liquibase to deploy. But this approach goes as well neatly:

    --in your target pdb and schema 
    SQL> begin apex_application_install.set_workspace_id(yourworkspaceidgoeshere); apex_application_install.generate_offset; apex_application_install.generate_application_id; apex_application_install.set_schema('YOURPARSINGSCHEMA'); end; 
     2* /
    PL/SQL procedure successfully completed.
    SQL> @apps/MAYBEUSEAPPALIASNAMEHERE/f142.sql  
    

    rgrds Paavo

Answers

  • Paavo
    Paavo Member Posts: 756 Silver Badge
    Answer ✓

    @User_B534Q - you could benefit of setting perhaps your profile so that it gives better looking name :)

    Just did deployments with SqlCL and used commands like:

    pwd
    cd som_dir
    !ls
    !mkdir apps
    !mkdir apps/MAYBEUSEAPPALIASNAMEHERE
    apex export -api 142 -dir apps/MAYBEUSEAPPALIASNAMEHERE -exporiginalids false -exppubreports true -expsavedreports true -expsupportingobjects Y
    
    --then commit and push changes to your git repo
    --remember to quit this connection before deploying to target
    

    Hint when you want to deploy to your target environment, then I have found that it is easier if the target parsing schema has the same name. One approach is then to use Liquibase to deploy. But this approach goes as well neatly:

    --in your target pdb and schema 
    SQL> begin apex_application_install.set_workspace_id(yourworkspaceidgoeshere); apex_application_install.generate_offset; apex_application_install.generate_application_id; apex_application_install.set_schema('YOURPARSINGSCHEMA'); end; 
     2* /
    PL/SQL procedure successfully completed.
    SQL> @apps/MAYBEUSEAPPALIASNAMEHERE/f142.sql  
    

    rgrds Paavo

  • User_B534Q
    User_B534Q Member Posts: 8 Green Ribbon
  • user4970847
    user4970847 Member Posts: 1 Blue Ribbon
    edited Nov 17, 2022 11:05AM

    @Paavo you mention that you can use Liquibase to deploy but I'm struggling to find an example of where this is done when the source came from the apex export command. Do you have an example you'd be willing to share ?

    Many thanks in advance

  • Paavo
    Paavo Member Posts: 756 Silver Badge

    you could open a new question for this and I would get the correct answer points :) ?

    But here hint - maybe you asked about this kind of approach?

    --- ANSWER:
    SQL> !mkdir otn16853953
    SQL> lb generate-apex-object -applicationid 108 -dir otn16853953 -exporiginalids false -exppubreports true -expsavedreports true -expsupportingobjects Y -exptype APPLICATION_SOURCE
    SQL> lb generate-apex-object -applicationid 108 -dir otn16853953 -exporiginalids false -exppubreports true -expsavedreports true -expsupportingobjects Y -exptype CHECKSUM-SH256
    SQL> lb generate-control-file -changelog-file 20221125_changelog.xml
    -- edit 20221125_changelog.xml
    SQL> !cat 20221125_changelog.xml
    <?xml version="1.0" encoding="UTF-8"?> 
    <databaseChangeLog
      xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
                          http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">
      <include file="otn16853953/f108.xml" relativeToChangelogFile="true"/>
    </databaseChangeLog> 
    --mimic changing to target schema, so clean the changelog to allow forward patching (this is just for demo purposes)
    SQL> drop table DATABASECHANGELOGLOCK;
    SQL> drop table DATABASECHANGELOG_ACTIONS;
    SQL> drop table DATABASECHANGELOG;
    SQL> begin
      2  -- your workspace id  1321312312312312312312312
      3    apex_application_install.set_workspace_id(1321312312312312312312312);
      4    apex_application_install.generate_offset;
      5  end;
      6* /
    SQL> lb update -changelog-file 20221125_changelog.xml
    SQL> apex list
    SQL> select filename,dateexecuted from databasechangelog;
    
    FILENAME                DATEEXECUTED                       
    _______________________ __________________________________ 
    otn16853953/f108.xml    25-NOV-22 04.33.23.302903000 PM