Skip Headers

Oracle® Database Administrator’s Reference
10g Release 1 (10.1) for UNIX Systems: AIX-Based Systems, hp HP-UX PA-RISC (64-bit), hp Tru64 UNIX, Linux x86, and Solaris Operating System (SPARC)
Part No. B10812-01
  Go To Table Of Contents
Contents
Go To Index
Index

Previous Next  

7 Building and Running Demonstrations

This chapter describes how to build and run the SQL*Loader and PL/SQL demonstration programs installed with Oracle Database 10g. It contains the following sections:


Note:

To use the demonstrations described in this chapter, you must install the Oracle Database Examples included on the Oracle Database 10g Companion CD.

You must also unlock the SCOTT account and set the password before creating the demonstrations.


SQL*Loader Demonstrations

Run the ulcase.sh file to run all of the SQL*Loader demonstrations. To run an individual demonstration, read the information contained in the file to determine how to run it.

PL/SQL Demonstrations

PL/SQL includes a number of demonstration programs that you can load. Oracle Database 10g must be open and mounted to work with the demonstration programs.

You must build database objects and load sample data before using these programs. To build the objects and load the sample data:

  1. Change directory to the PL/SQL demonstrations directory:

    $ cd $ORACLE_HOME/plsql/demo
    
    
  2. Start SQL*Plus and connect as SCOTT/TIGER:

    $ sqlplus SCOTT/TIGER
    
    
  3. Enter the following commands to build the objects and load the sample data:

    SQL> @exampbld.sql
    SQL> @examplod.sql
    
    

    Note:

    Build the demonstrations as any Oracle user with sufficient privileges. Run the demonstrations as the same Oracle user.


PL/SQL Kernel Demonstrations

The following PL/SQL kernel demonstrations are available:

To compile and run the exampn.sql or samplen.sql PL/SQL kernel demonstrations:

  1. Start SQL*Plus and connect as SCOTT/TIGER:

    $ cd $ORACLE_HOME/plsql/demo
    $ sqlplus SCOTT/TIGER
    
    
  2. Enter a command similar to the following to run a demonstration, where demo_name is the name of the demonstration:

    SQL> @demo_name
    
    

To run the extproc.sql demonstration, follow these steps:

  1. If necessary, add an entry for external procedures to the tnsnames.ora file, similar to the following:

    EXTPROC_CONNECTION_DATA =
    (DESCRIPTION =
           (ADDRESS_LIST = 
           (ADDRESS=(PROTOCOL = IPC)( KEY = EXTPROC))
        )
        (CONNECT_DATA = 
           (SID = PLSExtProc)
        )
     )
    
    
  2. If necessary, add an entry for external procedures to the listener.ora file, similar to the following, depending on your operating system:


    Note:

    The value that you specify for SID_NAME in the listener.ora file must match the value that you specify for SID in the tnsnames.ora file.

    • HP-UX 64-bit, Linux, Solaris, and Tru64 UNIX:

      SID_LIST_LISTENER = 
        (SID_LIST = 
           (SID_DESC=
              (SID_NAME=PLSExtProc)
              (ORACLE_HOME=oracle_home_path)
              (ENVS=EXTPROC_DLLS=oracle_home_path/plsql/demo/extproc.so,
                 LD_LIBRARY_PATH=oracle_home_path/plsql/demo)
              (PROGRAM=extproc)
            )
          )
      
      
    • AIX:

      SID_LIST_LISTENER = 
        (SID_LIST = 
           (SID_DESC=
              (SID_NAME=PLSExtProc)
              (ORACLE_HOME=oracle_home_path)
              (ENVS=EXTPROC_DLLS=oracle_home_path/plsql/demo/extproc.so,
                 LIBPATH=oracle_home_path/plsql/demo)
              (PROGRAM=extproc)
            )
          )
      
      
  3. Change directory to $ORACLE_HOME/plsql/demo.

  4. Enter the following command to create the extproc.so shared object, build the required database objects, and load the sample data:

    $ make -f demo_plsql.mk extproc.so exampbld examplod
    
    

    Alternatively, if you have already built the database objects and loaded the sample data, enter the following command:

    $ make -f demo_plsql.mk extproc.so
    
    
  5. From SQL*Plus, enter the following commands:

    SQL> CONNECT SYSTEM/SYSTEM_password
    SQL> GRANT CREATE LIBRARY TO SCOTT;
    SQL> CONNECT SCOTT/TIGER
    SQL> CREATE OR REPLACE LIBRARY demolib IS
      2  'oracle_home_path/plsql/demo/extproc.so';
      3  /
    
    
  6. To run the demonstration, enter the following command:

    SQL> @extproc
    
    

PL/SQL Precompiler Demonstrations

Note:

The make commands shown in this section build the required database objects and load the sample data in the SCOTT schema.

The following precompiler demonstrations are available:

To build all of the PL/SQL precompiler demonstrations, set the library path environment variable to include the $ORACLE_HOME/lib directory, and enter the following commands:

$ cd $ORACLE_HOME/plsql/demo
$ make -f demo_plsql.mk demos

To build a single demonstration, enter its name as the argument in the make command. For example, to build the examp9 demonstration, enter:

$ make -f demo_plsql.mk examp9

To run the examp9 demonstration, enter the following command:

$ ./examp9