Skip to content
Menu
ChaoTic
  • Home
  • Python
  • APEX
  • PL/SQL
  • Oralce DB
  • Docker
  • OCI
  • Nginx
  • C#
  • Linux
  • JavaScript
  • Privacy Policy
ChaoTic

Migrate APEX to Autonomous Database with custom ORDS (notes)

Posted on November 18, 2022February 12, 2023
  • OCI Identity Concepts
    • create user
    • create group (admin / user )
    • assign users to group
    • create policies ( enable [GROUP / SERVICE] to [manage/ inspect/ use/ read ] resources )
      • Click here to see more common policies
    • create compartments ( logical isolation)
    • within compartments create resources
OCI identity concepts
  • Virtual Network
    • All OCI resources needs to reside within a virtual network

Create And Manage Your Custom ORDs

  • Create a ATP in a private Subnet
  • In Subnet Security List open Port 1521, 1522 and 8080
  • Create VM (oracle linux cloud developer) this image has sqlplus installed in Private Or Public Subnet
  • Open Port 8080 with firewall-cmd (opc user)
  • reload Firewall-cmd (opc user)
  • download your ATP wallet and store it in /tmp folder on VM (opc user)
  • create folder /opt/oracle/network/admin (oracle user)
  • unzip /tmp/wallet **** .zip to /opt/oracle/network/admin (oracle user)
  • write : export TNS_ADMIN=/opt/oracle/network/admin(oracle user)
  • cd $TNS_ADMIN (oracle user)
  • nano sqlnet.ora (oracle user)
  • and change the location of the wallet, which should be the PWD (current working directory) (oracle user)
  • sqlplus admin@YOURADMINPASS (oracle user)
-- 1. Create the database user.
create user custom_ords_public_user identified by YOURPASSWORD;

-- 2. Allow the user to connect to the database.
grant connect to custom_ords_public_user;

-- 3. Perform some magic.
begin
    ords_admin.provision_runtime_role(
        p_user => 'CUSTOM_ORDS_PUBLIC_USER'
        , p_proxy_enabled_schemas => true
    );
end;
/

credits goes two these two links

https://fuzziebrain.com/content/id/2004/

https://www.linkedin.com/pulse/run-your-oracle-apex-apps-autonomous-database-own-domain-kurt-liu/

  • also set the CDN image location
begin 
  apex_instance_admin.set_parameter(
      p_parameter => 'IMAGE_PREFIX',
      p_value     => 'https://static.oracle.com/cdn/apex/22.2.0/');
  commit;
end;
/
# Use the following to verify:
SELECT apex_instance_admin.get_parameter('IMAGE_PREFIX') FROM dual;
  • and to reset it (in case u need it )
-- On-Premise Instance.
begin
  apex_instance_admin.set_parameter
   (p_parameter => 'IMAGE_PREFIX',   
    p_value     => '/i/' );
   commit;   
 end;
/
-- Autonomous example for APEX 22.1
-- Note: The value can change after Oracle applies patch sets 22.1.0, 22.1.1, etc.
begin
  apex_instance_admin.set_parameter
   (p_parameter => 'IMAGE_PREFIX',   
    p_value     => '/i/22.2.0/' );
   commit;   
 end;
/
  • intall ORDS (opc user ) sudo yum install ords -y
  • switch to Oracle user sudo su - oracle
ORDS_CONFIG_DIR=/opt/oracle/ords/config && mkdir -p $ORDS_CONFIG_DIR/ords/conf

ORDS_USER=CUSTOM_ORDS_PUBLIC_USER
ORDS_PASSWORD=YOURPASSWORD
SERVICE_NAME=prd_low(change it to your own )
WALLET_BASE64=`base64 -w 0 /tmp/wallet_prd.zip`(change it to your own)


cat << EOF > $ORDS_CONFIG_DIR/ords/conf/apex_pu.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
  <entry key="db.username">$ORDS_USER</entry>
  <entry key="db.password">!$ORDS_PASSWORD</entry>
  <entry key="db.wallet.zip.service">$SERVICE_NAME</entry>
  <entry key="db.wallet.zip"><![CDATA[$WALLET_BASE64]]></entry>
</properties>
EOF

cat << EOF > $ORDS_CONFIG_DIR/ords/defaults.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
  <entry key="plsql.gateway.enabled">true</entry>
  <entry key="jdbc.InitialLimit">5</entry>
  <entry key="jdbc.MaxLimit">10</entry>
</properties>
EOF
# recently found a better to install 
yum install ords -y

ords install

# choose 1 to install ords on desired  db when prompt for 1, install , 2 pool and install , 3 pool . 

#follow up the requirements 


# this will create two files <databases> and <globals>
# control + C to get out standalone mode 
ords serve 
#to start it ords again 

How to enable web sql-developer https://host/ords/sql-developer

two ways to enable it.

Go to Apex and enable rest for the parsing schema. make your the alias is in smallcase.

or

logon to the schema and write this plsql block to enable it. (read here and here for more information)

BEGIN
  ORDS.enable_schema(
    p_enabled             => TRUE,
    p_schema              => '${YOURSCHEMA}',
    p_url_mapping_type    => 'BASE_PATH',
    p_url_mapping_pattern => '${yourschema}',
    p_auto_rest_auth      => FALSE
  );
    
  COMMIT;
END;
/

Leave a Reply Cancel reply

You must be logged in to post a comment.

Recent Posts

  • Oracle APEX cheat sheets (on going)
  • Second Take on React Native – ReadCast
  • Switch Between APEX builder Authentication schemes
  • Use BitBucket Pipelines to Automate Oracle APEX deployment
  • MARKDown TEST

Categories

  • APEX
  • C#
  • chatgpt
  • Docker
  • JavaScript
  • Linux
  • Nginx
  • OCI
  • Oracle APEX
  • Oralce DB
  • PL/SQL
  • Python
  • Uncategorized
©2025 ChaoTic | Powered by SuperbThemes
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
Cookie SettingsAccept All
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT
Scroll Up