Oracle® Database Express Edition Application Express User's Guide Release 2.1 Part Number B25309-01 |
|
|
View PDF |
This section describes how to deploy an application built within Application Builder.
This section contains the following topics:
About the Oracle Application Express Application Development Life Cycle
How to Deploy an Application to Another Oracle Application Express Instance
See Also:
"Managing HTTP Access to the User Interface", "Advanced Programming Techniques" and "Managing Application Express End Users"When developing applications using Application Builder, you need to find a balance between two dramatically different development methodologies:
Iterative, rapid application development
Planned, linear style development
The first approach offers so much flexibility, you run the risk of never completing your project. In contrast, the second approach can yield applications that do not meet the needs of end users even if they meet the stated requirements on paper.
The system development life cycle (SDLC) is the overall process of developing software using a series of defined steps. There are a number of SDLC models that work well for developing applications in Oracle Application Express.
The SDLC waterfall is probably the best known model. In this methodology, the development process is broken down into the following stages:
Project Planning
Requirements Definition
Design
Development
Integration and Testing
Installation and Acceptance
Maintenance
This methodology is referred to as a waterfall because the output from one stage is the input for the next stage. One of the primary problems with this approach is that it is assumed that all requirements can be established in advanced. Unfortunately, requirements often change and evolve during the development process.
The Oracle Application Express development environment enables developers to take a more iterative approach to development. Unlike many other development environments, creating prototypes is easy. With Oracle Application Express, developers can:
Use built-in wizards to quickly design an application user interface
Make protoypes available to users and gather feedback
Implement changes in real time, creating new prototypes instantly
Other methodologies what work well with Oracle Application Express include:
Spiral - This approach is actually a series of short waterfall cycles. Each waterfall cycle yields new requirements and enables the development team to create a robust series of prototypes.
Rapid application development (RAD) life cycle - This approach has a heavy emphasis on creating a prototype that closely resembles the final product. The prototype is an essential part of the requirements phase. One disadvantage of this model is that the emphasis on creating the prototype can cause scope creep, Developers can lose sight of their initial goals in the attempt to create the perfect application.
Deploying an application from one Oracle Application Express instance to another is a two step process:
Move the supporting database objects. Review the Database Dependencies report to determine what objects to move. See "About the Database Object Dependencies Report".
Move the application definition and all associated files. See "How to Deploy an Application to Another Oracle Application Express Instance".
This section contains the following topics:
When you develop an application in Application Builder, you create the application within a specific database user account (or workspace). Each workspace has a unique ID and name. A common scenario is to create the application in a development instance and then deploy it to a production instance.
During the deployment process, you need to decide whether you want to use the existing application ID, the existing workspace, the existing database, or the existing Oracle HTTP Server, or create new ones. Deployment options to consider include:
Create Application Express End Users. The simplest way to deploy an application is to create Application Express end users and then send the URL and login information to users. This approach works well for applications with a small and tolerant user population. See "About Publishing the Application URL" and "Managing Application Express End Users".
Same workspace and same schema. Export and then import the application and install it using a different application ID. The approach works well when there are few changes to the underlying objects, but frequent changes to the application functionality.
Different workspace and same schema. Export and then import the application into a different workspace. This is an effective way to prevent a production application from being modified by developers.
Different workspace and different schema. Export and then import the application into a different workspace and install it using a different schema.
Different database with all its variations. Export and then import the application into a different Oracle Application Express instance and install it using a different schema and database.
When deciding whether or not to copy an existing workspace (or database user account) is a matter of preference. Keep in mind that the production version must have access to all the appropriate objects. For example, you might want to copy a workspace in the following situations:
When the application subscribes to other objects within the workspace.
When the application relies on Oracle Application Express authentication. Copying the workspace automatically migrates all the required user data.
When deciding whether or not to copy the database, remember that the schema against which the application runs must have access to the same objects as the development instance. The actual name of the schema is unimportant. You can change it during the import process.
See Also:
"Importing Export Files"It is not necessary to have matching application IDs for a development version and production version of an application. In fact, as a best practice never hard code the application ID into your application. Instead, use the application alias (defined on the Edit Application Attributes page), or use a built-in substitution string (such as APP_ID
and APP_ALIAS
). Using a substitution string is the best approach because it enables you to change the application ID without affecting any application functionality.
See Also:
"Name" for information about defining an application alias and "Built-in Substitution Strings" for information about usingAPP_ID
and APP_ALIAS
Whether you want to move an application to another database user account or just make a copy of it, the deployment process involves the following steps:
Move the supporting database objects (if appropriate). Review the Database Dependencies report to determine what objects to move. See "About the Database Object Dependencies Report".
Export the application definition and all related files. See "Exporting an Application and Related Files".
Import the exported files into the target Oracle Application Express instance. See "Importing Export Files".
Note that if the target instance is a different schema, you also need to export and import any required database objects.
Install the exported files from Export Repository. See "Installing Export Files".
You can import an application into your workspace regardless of the workspace in which it was developed.
Before you export an application and the appropriate related files, you need to determine if you also need to migrate the database objects referenced by the application. If you are unsure of which database objects to move, review the Database Object Dependencies report.
If the target schema is different from the schema used in the development environment, you will need to migrate the database objects referenced by the application. In many cases, this process can be as simple as using Oracle database export and import utilities to copy the application schema from the development environment to target instance. The following are two common scenarios where this approach will not work:
When the object development schema refers to tablespaces to which the target instance schema does not have access
When the development instance schema has sample data that you do not want to migrate to the target instance schema
You export and import application definitions and all associated files using the Workspace, Application, CSS, Images, Script Files, Themes, and User Interface Defaults buttons located at the top the Export page.
Topics in this section include:
When you export a application, Oracle Application Express generates a text file containing PL/SQL API calls.
To export an application:
On the Database Home Page, click the Application Builder icon.
Select an application.
On the Application Builder, click Export/Import.
When prompted to select a task, select Export and click Next.
From File Format, select how rows in the export file will be formatted:
Choose UNIX to have the resulting file contain rows delimited by line feeds.
Choose DOS to have the resulting file contain rows delimited by carriage returns and line feeds.
From Build Status Override, select one of the following:
Run Application Only - Developers can only run an application
Run and Build Application - Developers can both run and edit an application
Selecting Run Application Only is an effective way to protect an application from modifications from other developers. Note that if you select Run Application Only you cannot set the argument p_trace
to Yes
.
Use the As of field to export your application as it was previously defined. Specify the number of minutes in the field provided.
This utility uses the DBMS_FLASHBACK
package. Because the timestamp to System Change Number (SCN) mapping is refreshed approximately every five minutes, you may have to wait that amount of time to locate the version for which you are looking. The time undo information is retained and influenced by the startup parameter UNDO_RETENTION
(the default is three hours). However, this only influences the size of the undo tablespace. While two databases can have the same UNDO_RETENTION
parameter, you will be able to go back further in time on a database with fewer transactions because it is not filling the undo tablespace, forcing older data to be archived.
Click Export Application.
In addition to exporting the actual application file, you may also need to export other related files such cascading style sheets, images, and script files.
See Also:
"Enabling SQL Tracing and Using TKPROF"You can make an application available to other users by creating Application Express end users. When you export Application Express end users, Oracle Application Express creates an ASCII text SQL script of users and any defined user groups.
See Also:
"Managing Application Express End Users"To export Application Express end users:
On the Database Home Page, click the Application Builder icon.
Select an application.
On the Application Builder, click Export/Import.
When prompted to select a task, select Export and click Next.
From File Format, select how rows in the export file will be formatted:
Choose UNIX to have the resulting file contain rows delimited by line feeds.
Choose DOS to have the resulting file contain rows delimited by carriage returns and line feeds.
Click Export Workspace Users.
You can export a specific page within an application by clicking the Export button on the Page Definition. When exporting a page, remember the following:
Exported pages can only be imported sucessfully if they have the same application ID and workspace ID.
Some pages may reference shared components. To export all pages within an application as well as application shared components, you need to export the entire application.
To export a page in an application:
Navigate to the appropriate Page Definition:
Navigate to the Database Home Page.
Click the Application Builder icon.
Select an application.
Select a page.
The Page Definition appears.
On the Page Definition, click Export at the top of the page.
From Page, select the page to be exported.
From File Format, select how rows in the export file will be formatted:
Choose UNIX to have the resulting file contain rows delimited by line feeds.
Choose DOS to have the resulting file contain rows delimited by carriage returns and line feeds.
Use the As of field to export a page as it was previously defined. Specify the number of minutes in the field provided.
This utility uses the DBMS_FLASHBACK
package. Because the timestamp to System Change Number (SCN) mapping is refreshed approximately every five minutes, you may have to wait that amount of time to locate the version for which you are looking. The time undo information is retained and influenced by the startup parameter UNDO_RETENTION
(the default is three hours). However, this only influences the size of the undo tablespace. While two databases may have the same UNDO_RETENTION
parameter, you will be able to go back further in time on a database with fewer transactions because it is not filling the undo tablespace, forcing older data to be archived.
Click Export Page.
Use the Export Cascading Style Sheets utility to export uploaded cascading style sheets. Note that you can only use this utility to export uploaded cascading style sheets.
To export related cascading style sheets:
On the Database Home Page, click the Application Builder icon.
Select an application.
On the Application Builder, click Export/Import.
When prompted to select a task, select Export and click Next.
Click CSS at the top of the page.
On the Export Cascading Style Sheets page:
Select the cascading style sheets
From File Format, select how rows in the export file will be formatted:
Choose UNIX to have the resulting file contain rows delimited by line feeds.
Choose DOS to have the resulting file contain rows delimited by carriage returns and line feeds.
Click Export Style Sheets.
Use the Export Images utility to export uploaded images. When you export images using this utility, the images are converted to a text document. Note that you can only use this utility to export uploaded images.
To export upload images:
On the Database Home Page, click the Application Builder icon.
Select an application.
On the Application Builder, click Export/Import.
When prompted to select a task, select Export and click Next.
Click Images at the top of the page.
On the Export Images page:
Select an application from which to export images.
Be aware that selecting Workspace Images only exports those images in your repository that are not associated with a specific application. If all of your images are associated with specific applications, then the workspace image export file will be empty.
From File Format, select how rows in the export file will be formatted:
Choose UNIX to have the resulting file contain rows delimited by line feeds.
Choose DOS to have the resulting file contain rows delimited by carriage returns and line feeds.
Click Export Images.
Use the Export Static Files utility to export static files you have imported. Note that you can only use this utility to export uploaded static files.
To export related static files:
On the Database Home Page, click the Application Builder icon.
Select an application.
On the Application Builder, click Export/Import.
When prompted to select a task, select Export and click Next.
Click Files at the top of the page.
On Export Static Files:
Select the files to be exported.
From File Format, select how rows in the export file will be formatted:
Choose UNIX to have the resulting file contain rows delimited by line feeds.
Choose DOS to have the resulting file contain rows delimited by carriage returns and line feeds.
Click Export File(s).
Note that you cannot use the Web interface described in this section to import exported static files into another Oracle Application Express instance. To import exported static files into another Oracle Application Express instance, use SQL Command Line (SQL*Plus) while connected as the Oracle Application Express database user. Note that you must export from and to a workspace having the same name and workspace ID.
See Also:
"Using SQL Command Line" in Oracle Database Express Edition 2 Day Developer GuideYou can transfer selected scripts from your current Script Repository to a Script Repository in a different Workspace by using the Export and Import tasks.
See Also:
"Using SQL Scripts"To export script files:
On the Database Home Page, click the SQL icon.
Click SQL Scripts.
On the Tasks list, click Export.
Select the appropriate script files and click Add to Export.
Review the file name and click Export All.
Select the Remove check box to remove the script.
Use the Export Theme utility to export themes from one Oracle Application Express development instance to a file.
To export an application theme from the Export page:
On the Database Home Page, click the Application Builder icon.
Select an application.
On the Application Builder home page, click Export/Import.
When prompted to select a task, select Export and click Next.
Click Themes at the top of the page.
On the Export Application Theme page:
Select the theme to be exported.
From File Format, select how rows in the export file will be formatted:
Choose UNIX to have the resulting file contain rows delimited by line feeds.
Choose DOS to have the resulting file contain rows delimited by carriage returns and line feeds.
Click Export Theme.
To export an application theme from the Themes page:
On the Database Home Page, click the Application Builder icon.
Select an application.
On the Application Builder home page, click Shared Components.
Under User Interface, select Themes.
The Themes page appears.
On the Tasks list, click Export Theme.
The Export page appears.
Click Themes at the top of the page.
On the Export Application Theme page:
Select the theme to be exported.
From File Format, select how rows in the export file will be formatted:
Choose UNIX to have the resulting file contain rows delimited by line feeds.
Choose DOS to have the resulting file contain rows delimited by carriage returns and line feeds.
Click Export Theme.
See Also:
"Managing Themes"Exporting User Interface Defaults is useful when you plan to develop on the target machine.
When you export User Interface Defaults, all User Interface Defaults for the selected schema are exported to a single SQL Command script. When prompted, save this file to your hard drive. The file contains an API call to create table hints by making calls to the application PL/SQL API. You can use this file to import User Interface Defaults to another database and Oracle Application Express instance.
See Also:
"How to Deploy an Application to Another Oracle Application Express Instance" and "Managing User Interface Defaults"To export User Interface Defaults from the Export page:
On the Database Home Page, click the Application Builder icon.
Select an application.
On the Application Builder home page, click Export/Import.
When prompted to select a task, select Export and click Next.
Click User Interface Defaults at the top of the page.
On the Export User Interface Defaults page:
From Schema, select the schema that owns the table associated with the User Interface Defaults.
From File Format, select how rows in the export file will be formatted:
Choose UNIX to have the resulting file contain rows delimited by line feeds.
Choose DOS to have the resulting file contain rows delimited by carriage returns and line feeds.
Click Export.
To export User Interface Defaults from the User Interface Defaults page:
On the Database Home Page, click the Application Builder icon.
Select an application.
On the Application Builder home page, click Shared Components.
Under User Interface, select User Interface Defaults.
The User Interface Defaults page appears.
Click Export.
The Export page appears.
Click Themes at the top of the page.
On the Export User Interface Defaults page:
From Schema, select the schema that owns the table associated with the User Interface Defaults.
From File Format, select how rows in the export file will be formatted:
Choose UNIX to have the resulting file contain rows delimited by line feeds.
Choose DOS to have the resulting file contain rows delimited by carriage returns and line feeds.
Click Export.
See Also:
"Managing User Interface Defaults"Once you export an application and any related files, you need to import them into the target Oracle Application Express instance before you can install them. As a general rule, always import the application first and then the related files.
To import an application and related files:
On the Database Home Page, click the Application Builder icon.
Select an application.
On the Application Builder home page, click Export/Import.
When prompted to select a task, select Import and click Next.
On Import File:
In Import file, specify the file you are importing.
From File Type, select the type of file you are importing.
Once you have imported a file, you have the option to install it. You can also install it later from the Export Repository.
Verify that File Character Set is correct.
Click Next.
To install an imported file, click Install. On the Application Install page:
From Parse As Schema, select a schema.
This is the schema against which all of the application's SQL and PL/SQL will be parsed.
From Build Status Override, select one of the following:
Run Application Only - Users can only run an application.
Run and Build Application - Users can run an application and developers can both run and edit an application
Selecting Run Application Only is an effective way to protect an application from modifications from other developers.
From Install As Application, select one of the following:
Auto Assign New Application ID
Reuse Application ID From Export File
Change Application ID
Use these options to avoid application ID conflicts. These options come in handy when you need to have two versions of the same application in the same instance. For example, you might be migrating an application to a production instance and still need to maintain development version.
Click Install Application.
There are two ways to install export files:
Import the export files into Application Builder and then install the files from the Export Repository
Install the export files from SQL Command Line (SQL*Plus)
Topics in this section include:
After you import files into the target Oracle Application Express instance, you must install them before they can become active or available in Application Builder.
To install files stored in the Export Repository:
On the Database Home Page, click the Application Builder icon.
Select an application.
On the Application Builder home page, click Export/Import.
Select View Repository on the bottom of the page.
Select the file to be installed and click Install in the Action column adjacent to the appropriate file.
From Parse As Schema, select a schema.
This is the schema against which all of the application's SQL and PL/SQL will be parsed.
From Build Status, select one of the following:
Run Application Only
Run and Build Application
Select Run Application Only to run the application in the target instance and make it inaccessible to developers.
From Install As Application, select one of the following:
Reuse Application ID from Export File
Auto Assign New Application ID
Change Application ID
Use these options to avoid application ID conflicts. Use these options when you need to have two versions of the same application in the same instance. For example, you might be migrating an application to a production instance and still need to maintain development version.
Click Install Application.
In addition to installing files, you can also use this page to delete a file from the Export Repository.
To delete a file from the Export Repository:
Navigate to the Export Repository.
Select the file to be deleted and click Delete Checked.
You can also install export files from SQL Command Line (SQL*Plus). Note there are two restrictions:
The export file must originate from the same user database account as the one into which you are installing.
If the export file is an application, the application ID will be overwritten. Therefore, the target workspace must own the ID of the application being installed.
Topics in this section include:
See Also:
"Using SQL Command Line" in Oracle Database Express Edition 2 Day Developer GuideYou can verify that the source and target database user accounts are identical by running query in SQL Command Processor.
To verify that the source and target database user accounts are identical:
Log in to the source workspace.
Click the SQL icon on the Database Home Page.
Click SQL Commands.
Enter the following in the SQL editor pane and click Run.
SELECT &WORKSPACE_ID. FROM DUAL
Make note of workspace ID.
Log in to the target workspace.
Repeat steps 2 through 5 to verify the workspace IDs match.
To install Oracle Application Express export files from SQL Command Line (SQL*Plus):
Log in to SQL Command Line using your Oracle Application Express database user account.
Run the export file.
For example, if your export file is names f144.sql by default, you would type @f144
at the command prompt.
Once you have deployed your application, loaded data, and created users, you can publish your production URL.
You can determine the URL to your application by positioning the mouse over the Run icon on the Application home page. The URL displays in the status bar at the bottom of the page.
The Run icon gets its value from the Home link attribute on the Edit Security Attributes page. This link is only referenced by this icon and by applications that do not use the Oracle Application Express Login API. Consider the following example:
http://apex.oracle.com/pls/apex/f?p=11563:1:3397731373043366363
Where:
apex.oracle.com
is the URL of the server.
pls
is the indicator to use the mod_plsql
cartridge.
apex
is the database access descriptor (DAD) name. The DAD describes how Oracle HTTP Server connects to the database server so that it can fulfill an HTTP request. The default value is apex
.
f?p=
is a prefix used by Oracle Application Express.
11563
is the application being called.
1
is the page within the application to be displayed.
3397731373043366363
is the session number.
To run this example application, you would use the URL:
http://apex.oracle.com/pls/apex/f?p=11563:1
When each user logs in, he or she will receive an unique session number.
Build options enable you to conditionally display specific functionality within an application.
Build options have two possible values: INCLUDE and EXCLUDE. If you specify an attribute as being included, then the Application Express engine considers it part of the application definition at run time. Conversely, if you specify an attribute as being excluded, then the Application Express engine treats it as if it does not exist.
Topics in this section include:
To create a build option:
On the Database Home Page, click the Application Builder icon.
Select an application.
On the Application Builder home page, click Shared Components.
Under Logic, select Build Options.
To create a new build option, click Create.
Follow the on-screen instructions.
You can choose to enable or disable a build option on the appropriate attributes page. Most attributes pages contain a Configuration section where you can select defined build options.
See Also:
"Configuring Standard Application Attributes" and "Editing Page Attributes" for information about specifying build optionsOnce you create a build option, it appears on the Build Options page. You control how the Build Options page displays by making a selection from the View list. Available options include:
Icons (the default) displays each build option as a large icon. To edit a build option, click the appropriate icon.
Details displays each build option as a line in a report. Each line includes the application ID, build option name, status, and a link to the Build Option Utilization report. To edit a build option, click the appropriate name.
Once you create a build option, a Utilization button appears on the Build Options page. This report details build option utilization in the current application.
Note:
The Utilization button only appears on the Build Options page after you create a build option.To view the Build Option Utilization report:
Navigate to the Build Options page:
Navigate to the Database Home Page.
Click the Application Builder icon.
Select an application.
On the Application Builder home page, click Shared Components.
Under Logic, select Build Options.
Build Options page appears.
On the Build Options page, click Utilization.
The Build Option Utilization report appears.