Oracle® Database Administrator's Reference 10g Release 2 (10.2) for hp OpenVMS Part Number B25416-02 |
|
|
View PDF |
This chapter describes how to build and run the SQL*Loader and PL/SQL demonstrations installed with Oracle Database 10g. It contains the following sections:
Note:
To use the demonstrations described in this chapter, you must install 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.
PL/SQL includes a number of sample programs that you can load. The Oracle Database 10g database must be open and mounted to work with the sample programs.
This section contains the following topics:
The following PL/SQL kernel demonstrations are available:
EXAMP1.SQL EXAMP2.SQL EXAMP3.SQL EXAMP4.SQL EXTPROC.SQL EXAMP5.SQL EXAMP6.SQL EXAMP7.SQL EXAMP8.SQL EXAMP11.SQL EXAMP12.SQL EXAMP13.SQL EXAMP14.SQL SAMPLE1.SQL SAMPLE2.SQL SAMPLE3.SQL SAMPLE4.SQL
To build and run the PL/SQL kernel demonstrations, enter the following commands:
Run SQL*Plus and connect as SCOTT/TIGER:
$ SET DEFAULT ORA_ROOT:[PLSQL.DEMO] $ SQLPLUS SCOTT/TIGER
To load the demonstrations, enter the following command:
SQL> @EXAMPn.SQL
In this command, n
denotes a unique integer value for each demonstration file.
Note:
Build the demonstrations as any Oracle user with sufficient permissions. Run the demonstrations using the same Oracle user account.To run the EXTPROC
demonstration:
Add the following lines to the TNSNAMES.ORA
file:
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=plsff))(CONNECT_DATA=(SID=extproc)))
Add the following line to the LISTENER.ORA
file:
SID_LIST_LISTENER=(SID_LIST=(SID_DESC= - (SID_NAME:extproc)(PROGRAM=disk:[<oraclehome>NETWORK.ADMIN]EXTPROC)))
From SQL*Plus, enter the following commands:
SQL> CONNECT SYSTEM/MANAGER Connected. SQL> GRANT CREATE LIBRARY TO SCOTT; Grant succeeded. SQL> CONNECT SCOTT/TIGER Connected. SQL> CREATE LIBRARY DEMOLIB AS 'ora_root:[bin]extproc.exe'; Library created.
To run the demonstration, enter the following command:
SQL> @extproc
The following precompiler demonstrations are available:
EXAMP9.pc EXAMP10.pc SAMPLE5.pc SAMPLEl6.pc
To build a single demonstration, perform the following steps for the examp9
example.
$ PROC EXAMP9.PC $ DEFINE RT_INCLUDES ORA_PROGINT_INCL,ORA_PROGINT_VMS_HDRS,ORA_PROGINT_DECC_HDRS $ CC/NOWARN/INCLUDE=RT_INCLUDES EXAMP9.C $ LNPROC EXAMP9
To run the EXAMP9
demonstration, enter the following command:
$ RUN EXAMP9
To build and run the RDBMS demonstrations:
Ensure that the supported version of the C programming language compiler for this release is installed.
Set the default directory to ORA_RDBMS_DEMO
.
Set up the ORA_OLB
logical.
DEFINE ORA_OLB ORA_RDBMS_DEMO,ORA_RDBMS,ORA_OLB32,ORA_ROOT:[RDBMS.LIB32]
Set up the ORA_UTIL
logical.
DEFINE ORA_UTIL ORA_OLB
Compile the C programming language file by using the following command:
CC/PREFIX=ALL/INCLUD=(SYS$DISK:[],ORA_ROOT:[RDBMS.PUBLIC])/
FLOAT=IEEE/IEEE_MODE=DENORM/GRAN=BYTE/ARCH=EV56-/
OPT=TUNE=EV6/EXTE=STRI/PREF=ALL/NOSTAN/NOANS/NAME=(SHORT,AS_IS)DEMO_FILE-+
DECC$LIBRARY:[000000]DECC$RTLDEF.TLB/LIB
In this command, replace demo_file
with the name of the C programming language file that you want to build.
Link the demonstration using LNOCIC
:
LNOCIC CDEMO1.EXE CDEMO1.OBJ
In cases where the command for building the demonstration accepts command-line parameters, you can define a new symbol that is treated as the equivalent of the executable name. For example:
$ OCI19 := $ORA_ROOT:[RDBMS.DEMO]OCI19.EXE $ OCI19 4
To run the Extensible Indexing demonstrations:
Use the same command for compiling the C file as described in the earlier procedure.
For extdemo
, extdemo2
, extdemo4
and extdemo5
, you must create an opt file with the specific entry points for the shared image. The opt file contents for each demonstration are as follows:
EXTDEMO.OPT
case_sensitive=YES symbol_vector = (- Initialize=PROCEDURE,INITIALIZE/Initialize=PROCEDURE- ,Iterate=PROCEDURE,ITERATE/Iterate=PROCEDURE- ,Terminate=PROCEDURE,TERMINATE/Terminate=PROCEDURE- ,Merge=PROCEDURE,MERGE/Merge=PROCEDURE- ,Delete=PROCEDURE,DELETE/Delete=PROCEDURE- ,WrapContext=PROCEDURE,WRAPCONTEXT/WrapContext=PROCEDURE-) case_sensitive=NO
EXTDEMO2.OPT
case_sensitive=YES symbol_vector = (- qxiqtbi=PROCEDURE,QXIQTBI/qxiqtbi=PROCEDURE- ,qxiqtbd=PROCEDURE,QXIQTBD/qxiqtbd=PROCEDURE- ,qxiqtbu=PROCEDURE,QXIQTBU/qxiqtbu=PROCEDURE- ,qxiqtbs=PROCEDURE,QXIQTBS/qxiqtbs=PROCEDURE- ,qxiqtbf=PROCEDURE,QXIQTBF/qxiqtbf=PROCEDURE- ,qxiqtbc=PROCEDURE,QXIQTBC/qxiqtbc=PROCEDURE-) case_sensitive=NO
EXTDEMO5.OPT
case_sensitive=YES symbol_vector = (- qxiqtbpi=PROCEDURE,QXIQTBPI/qxiqtbpi=PROCEDURE- ,qxiqtbpd=PROCEDURE,QXIQTBPD/qxiqtbpd=PROCEDURE- ,qxiqtbpu=PROCEDURE,QXIQTBPU/qxiqtbpu=PROCEDURE- ,qxiqtbps=PROCEDURE,QXIQTBPS/qxiqtbps=PROCEDURE- ,qxiqtbpf=PROCEDURE,QXIQTBPF/qxiqtbpf=PROCEDURE- ,qxiqtbpc=PROCEDURE,QXIQTBPC/qxiqtbpc=PROCEDURE-) case_sensitive=NO'
To build and run EXTDEMO3
demonstrations, the CLASSPATH
should be:
$define classpath ".:/jdbc_lib/classes12.jar:/sqlj_lib/runtime12.jar:/ ora_rdbms_ jlib/xdb.jar:/ora_xdk_lib/ xmlparserv2.jar:/jdbc_lib/jndi.jar:/jis_lib/jta.jar:/ ora_rdbms_jlib/ODCI.jar:/ora_rdbms_jlib/CartridgeServices.jar:."
Link the executable with LOUTL
using the shared option along with the option file that corresponds to the demonstration you are building. For example:
LOUTL EXTDEMO2 EXTDEMO2.OPT/OPT,EXTDEMO2.OBJ EXTDEMO2 I
Create the user for the demonstration and grant the necessary privileges to the user as follows:
SQL> connect system/manager SQL> drop user extdemo2 cascade; SQL> create user extdemo2identified by extdemo2 default tablespace system quota unlimited on system ; SQL> grant connect, resource to extdemo2 ; SQL> grant create library to extdemo2 ; SQL> grant create any directory to extdemo2 ; SQL> grant drop any directory to extdemo2 ; SQL> grant create any operator to extdemo2 ; SQL> grant create indextype to extdemo2 ; SQL> grant create table to extdemo2 ;
As mentioned in the step 4 of extdemo2.sql, create the associated library in the user schema as follows:
connect extdemo2/extdemo2 CREATE OR REPLACE LIBRARY extdemo2l IS 'vqat5:[10ghome.rdbms.demo]extdemo2.exe' ;
Run the following SQL script:
SQL>@extdemo2.sql
For extended EXTDEMO4.SQL
, replace the path in the CREATE LIBRARY
command with the path for the generated executable.
To build and run the RDBMS C++ file demonstrations:
Ensure that the supported version of the C++ programming language compiler for this release is installed.
Set the default directory to ORA_RDBMS_DEMO
.
Compile the C++ file by running the following command:
$CXX/STANDARD/DEBUG=TRACE/OPTIMIZE/PREFIX=ALL/GRAN=LONG -
/NAMES=(AS_IS,SHORT)-
/INCLUDE=([], ORA_ROOT:[RDBMS.PUBLIC]) -
/NOANSI/EXTERN=STRICT demo_file.CPP
In this command, replace demo_file
.CPP
with the name of the file that you want to build.
To link the OCCI C++ programming language demonstrations, use the following command:
$ LNOCIC demo_file.EXE demo_file.OBJ,ORA_OLB:XAONDY.OBJ,ORA_OLB:LIBOCCI10.OLB/ LIB CPP NS
In this command, replace demo_file
with the name of the file that you want to build.
This section contains the following topics:
To build and run the AQJMS
demonstrations:
While performing the steps outlined in the AQJMSREADME.TXT
file, make the following changes:
Note:
TheAQJMSREADME.TXT
can be found under ORA_ROOT:[RDBMS.DEMO]
.Replace $ORACLE_HOME
in the CLASSPATH
specification with the corresponding OpenVMS logical name or the abbreviated logical name for the referenced directory. You must set up the JDK version before performing this step. For example:
Replace $ORACLE_HOME/rdbms/jlib/aqapi13.jar
with /ORACLE_HOME/rdbms/jlib/aqapi13.jar
or use /ora_rdbms_jlib/aqapi13.jar
In certain cases, the abbreviated form may have to be used to circumvent command line length limitations. Alternatively, the -V
option may be used on OpenVMS java, and all parameters (including the CLASSPATH
) can be placed in a DAT
file.
Note:
In the current release, the following demonstrations do not support theoci8
driver on OpenVMS:
AQJMSDEMO01.JAVA
AQJMSDEMO02.JAVA
AQJMSDEMO05.JAVA
AQJMSDEMO06.JAVA
AQJMSDEMO08.JAVA
The RMANPIPE.SQL
script uses VMS_RMAN_PIPE.COM
, the OpenVMS-specific COM
file, to emulate the UNIX operator, which creates a separate, detached process to run the specified command. The COM
file dynamically creates a VMSPIPE.COM
file. When it is run, the VMSPIPE.COM
file creates a corresponding log VMSPIPE.LOG
in the ORA_RDBMS_DEMO
directory.
The JavaVM demonstrations are available in the following directory:
ORA_ROOT:[JAVAVM.DEMO.EXAMPLES.JSPROC.BASIC]
For each sample, scripts are provided with a name of the form BUILD_RUN_*.COM
. When you run these scripts, the corresponding demonstrations are built and run. The output of all demonstrations is directed to SYS$OUTPUT
The NCOMP JavaVM demonstrations are not currently supported on OpenVMS.
Java and C programming language demonstrations are available for XDK. This section describes how to build and run these demonstrations. It contains the following topics:
To build and run the Java demonstrations, use the scripts provided in the subdirectories of the ORA_ROOT:[XDK.DEMO.JAVA]
directory. The names of these scripts are in the form of BUILD_RUN_*.COM
. When you run these scripts, the corresponding demonstrations are built and run. You must set the default to the specific demonstration program directory before running any particular script. The result of running the demonstrations are directed to SYS$OUTPUT
and are also saved in files that have names of the form *.OUT
.
To build and run the C programming language demonstrations, use the generic scripts provided in the top-level ORA_ROOT:[XDK.DEMO.C]
directory:
COMPILE_SAMPLE.COM
This script compiles a sample C programming language source file and produces an object file, given the name of the script (without the file name extension) as parameter P1.
LINK_SAMPLE.COM
This script links a sample demonstration, given the name of the object file produced by the COMPILE_SAMPLE.COM
script as parameter P1.
BUILD_SAMPLE.COM
This script combines the actions of the COMPILE_SAMPLE.COM
and LINK_SAMPLE.COM
scripts.
To run the demonstration, you must run the executable produced by linking the sample. No arguments are required. The expected output is provided under each sample subdirectory with a file name extension of STD
.
The JDBC (DBJava) demonstrations are shipped as a Java.JAR
file DEMO.JAR
, which are located in the ORA_ROOT:[JDBC.DEMO]
directory. To install the demonstrations, enter the following commands:
$ SET DEFAULT ORA_ROOT:[JDBC.DEMO] $ JAR XVF DEMO.JAR
After installing DEMO.JAR
, read the ORA_ROOT:[JDBC.DEMO]SAMPLES-README.TXT
file.
For any particular example, set the default to the directory where the example resides.
Run the corresponding OpenVMS DCL command file (VDJDS*.COM
) based on the first letters of the directory path, followed by the parameters requested demonstration name (file name without the .JAVA
file name extension) and connection method (OCI, OCITNS, or Thin). Modify the command file as required.
For example, to run the (V)MS (D)b(J)ava (D)emo (S)ample (G)eneric SelectExample using OCI, use the following command:
$ SET DEFAULT ORA_ROOT:[JDBC.DEMO.SAMPLES.GENERIC] $ @ORA_ROOT:[JDBC.DEMO.SAMPLES.GENERIC]VDJDSG.COM SelectExample oci
The OpenVMS DCL command files VDJDS*.COM
in each JDBC demonstration directory are analogous to their UNIX Makefile and Microsoft Windows RUNDEMO.BAT
counterparts.
The following sections contains information about running the Oracle Text and Oracle Database 10g Spatial demonstrations:
Refer to the ORA_ROOT:[CTX.SAMPLE.APJ]INDEX.HTML
file and Oracle Text Reference for information about the Oracle Text code samples.
Refer to the ORA_ROOT:[MD.DOC]README.TXT
file for information about the Oracle Database 10g Spatial demonstration. Refer to Oracle Spatial User's Guide and Reference for information about Oracle Database 10g Spatial.
For the Spatial Motif
demonstration, refer to ORA_ROOT:[MD.DEMO.UNIX.MOTIF]README
.
The following is a sample Spatial run:
$! On OpenVMS at DCL to build SDO Motif demo, run: $ SQLPLUS/NOLOG SQL> CONNECT MDSYS/MDSYS SQL> @ORA_ROOT:[MD.ADMIN]SDOWIN.SQL SQL> @ORA_ROOT:[MD.ADMIN]PRVTWIN.PLB SQL> @ORA_ROOT:[MD.DEMO.UNIX.MOTIF.SRC.SQL_SCRIPTS]MY_WINDOW.SQL SQL> @ORA_ROOT:[MD.DEMO.UNIX.MOTIF.SRC.SQL_SCRIPTS]MY_WIN.SQL SQL> EXIT $! OpenVMS Logicals and Symbols already setup for MD_VIEWER, XENVIRONMENT, motifdemo in: $ @ORA_ROOT:[MD.PORT.VMS.INSTALL]DEMO_MOTIF.COM ALL
On a workstation, start an X Window emulator.
Find the IP address for the workstation as follows:
W2K/Start/Programs/Accessories/Command Prompt DOS> ipconfig IP Address 130.35.158.58 DOS> exit $! Back on OpenVMS enter IP address from above: $ SET DISPLAY/CREATE/TRANSPORT=TCPIP/NODE=130.35.158.58 $ RUN SYS$SYSTEM:DECW$CLOCK ! VERIFY X WINDOW EMULATOR IS RUNNING $ MOTIFDEMO ! EXECUTE SDO MOTIF DEMO Enter username: MDSYS Enter password: MDSYS Is database remote [N]: N
Before running Spatial Network
demonstrations, read ORA_ROOT:[MD.DEMO.NETWORK...]README.TXT
for each demonstration to be run.
Following are example runs for the PL/SQL, SQL*Loader Logical
, SQL*Loader Spatial
, Java
, and Network Editor
demonstrations.
SDO Network Example PL/SQL Demonstration
To run the SDO Network Example PL/SQL
demonstration, run the following at the DCL command prompt:
$ SET DEFAULT ORA_ROOT:[MD.DEMO.NETWORK.EXAMPLES.PLSQL] $ SQLPLUS SCOTT/TIGER @CREATE_LOGICAL.SQL
SDO Network Example SQL*Loader Logical Demonstration
To run SDO Network Example SQL*Loader Logical
demonstration, run the following commands at the DCL command prompt:
$ SET DEFAULT ORA_ROOT:[MD.DEMO.NETWORK.EXAMPLES.SQLLDR.LOGICAL] $ @ORA_ROOT:[MD.PORT.VMS.INSTALL]LOAD_TEST_NET.COM
SDO Network Example SQL*Loader Spatial Demonstration
To run SDO Network Example SQL*Loader Spatial
demonstration on OpenVMS, run the following commands at the DCL command prompt:
$ SET DEFAULT ORA_ROOT:[MD.DEMO.NETWORK.EXAMPLES.SQLLDR.SPATIAL] $ @ORA_ROOT:[MD.PORT.VMS.INSTALL]LOAD_SPATIAL_NET.COM
SDO Network Example Java Demonstration
To run SDO Network Example Java
demonstration on OpenVMS, run the following commands at the DCL command prompt:
$ @ORA_ROOT:[JDBC]JDBC_SETUP_JDK14.COM SQL> create user MDNETWORK identified by MDNETWORK; $ SET DEFAULT ORA_ROOT:[MD.DEMO.NETWORK.EXAMPLES.JAVA.DATA] $ SQLPLUS/NOLOG SQL> connect / as sysdba
The following is for illustrative purposes only. Contact the Security Manager or DBA for information about the correct security settings.
SQL> grant all privileges to MDNETWORK with admin option; SQL> exit $ SQLPLUS MDNETWORK/MDNETWORK @REMOVE_BI_TEST.SQL SQL> exit $ SQLPLUS MDNETWORK/MDNETWORK @REMOVE_UN_TEST.sql SQL> exit $ IMP MDNETWORK/MDNETWORK FILE=BI_TEST.DMP TABLES="'BI_TEST_NODE$'" $ IMP MDNETWORK/MDNETWORK FILE=BI_TEST.DMP TABLES="'BI_TEST_LINK$'" $ SQLPLUS MDNETWORK/MDNETWORK @BI_TEST_META.SQL SQL> exit $ IMP MDNETWORK/MDNETWORK FILE=UN_TEST.DMP TABLES="'UN_TEST_NODE$'" $ IMP MDNETWORK/MDNETWORK FILE=UN_TEST.DMP TABLES="'UN_TEST_LINK$'" $ SQLPLUS MDNETWORK/MDNETWORK @UN_TEST_META.SQL SQL> exit $ SET DEFAULT ORA_ROOT:[MD.DEMO.NETWORK.EXAMPLES.JAVA] $ EDIT ORA_ROOT:[MD.DEMO.NETWORK.EXAMPLES.JAVA]LOADANDANALYZE.JAVA
Change host
, port
, sid
using values from the tnsnames.ora
file.
$ ! Enter each java command as all one line $ JAVAC -CLASSPATH .:'F$TRNLNM("ORACLE_HOME_UNIX")'/JDBC/LIB/ CLASSES12.JAR:'F$TRNLNM("ORACLE_HOME_UNIX")'/ LIB/XMLPARSERV2.JAR:'F$TRNLNM("ORACLE_HOME_UNIX")'/ MD/LIB/SDOAPI.JAR:'F$TRNLNM("ORACLE_HOME_UNIX")'/MD/LIB/SDONM.JAR LOADANDANALYZE.JAVA $ JAVA -CLASSPATH .:'F$TRNLNM("ORACLE_HOME_UNIX")'/JDBC/LIB/ CLASSES12.JAR:'F$TRNLNM("ORACLE_HOME_UNIX")'/ LIB/XMLPARSERV2.JAR:'F$TRNLNM("ORACLE_HOME_UNIX")'/MD/LIB/ SDOAPI.JAR:'F$TRNLNM("ORACLE_HOME_UNIX")'/MD/LIB/SDONM.JAR "LOADANDANALYZE" $ EDIT ORA_ROOT:[MD.DEMO.NETWORK.EXAMPLES.JAVA]CREATEANDSTORE.JAVA
Change host
, port
, sid
using values from the tnsnames.ora
file.
$ ! Enter each java command as all one line $ JAVAC -CLASSPATH .:'F$TRNLNM("ORACLE_HOME_UNIX")'/ JDBC/LIB/CLASSES12.JAR:'F$TRNLNM("ORACLE_HOME_UNIX")'/LIB/XMLPARSERV2.JAR :'F$TRNLNM("ORACLE_HOME_UNIX")'/MD/LIB/SDOAPI.JAR:'F$TRNLNM("ORACLE_HOME_UNIX")'/ MD/LIB/SDORNM.JAR CREATEANDSTORE.JAVA $ JAVA -CLASSPATH .:'F$TRNLNM("ORACLE_HOME_UNIX")'/JDBC/LIB/ CLASSES12.JAR:'F$TRNLNM("ORACLE_HOME_UNIX")'/ LIB/XMLPARSERV2.JAR:'F$TRNLNM("ORACLE_HOME_UNIX")'/ MD/LIB/SDOAPI.JAR:'F$TRNLNM("ORACLE_HOME_UNIX")'/MD/LIB/SDONM.JAR "CREATEANDSTORE"
SDO Network Editor Demonstration
On OpenVMS at DCL to run SDO Network Editor
demonstration:
Prior to running the SDO Network Editor
demonstration, set up an X Window emulator.
Load the sample data by running commands similar to the following:
ORA_ROOT:[MD.DEMO.NETWORK.EXAMPLES.JAVA.DATA] above. $ SET DEFAULT ORA_ROOT:[MD.DEMO.NETWORK.EDITOR] $ @ORA_ROOT:[MD.PORT.VMS.INSTALL]STARTNETWORKEDITOR.COM
For information about running the Spatial example demonstrations, read the ORA_ROOT:[MD.DEMO.EXAMPLES
]PARALLEL.DOC
file. The following is an example of a Spatial demonstration:
To run SDO Example Scripts
demonstration, run the following at the at DCL command prompt:
$ SET DEFAULT ORA_ROOT:[MD.DEMO.EXAMPLES.SCRIPTS] $ SQLPLUS /NOLOG SQL> connect / as sysdba SQL> create user SDO_USR identified by SDO_USR;
The following is for illustrative purpose only:
Note:
Contact the site Security Manager or DBA for information about the appropriate security settings.SQL> grant all privileges to SDO_USR with admin option; SQL> create Tablespace SDO_DATA DATAFILE 'ORA_DB:SDO_DATA.F' SIZE 50M; SQL> connect sdo_usr/sdo_usr SQL> @ORA_ROOT:[MD.DEMO.EXAMPLES]PARTITION_POINTS.SQL
To compile, link, and run SDO Example
demonstrations, run the following commands at the DCL command prompt:
Note:
Before running theSDO Example
demonstrations, set up an X Window emulator as described in Section 7.7.2.1, "Running the Spatial Demonstration".$ SET DEFAULT ORA_ROOT:[MD.DEMO.EXAMPLES] $ @ORA_ROOT:[MD.PORT.VMS.INSTALL]DEMO_SDO.COM $ READGEOM:= $ORA_ROOT:[MD.DEMO.EXAMPLES]READGEOM.EXE $ READGEOM parameter_list $ WRITEGEOM := $ORA_ROOT:[MD.DEMO.EXAMPLES]WRITEGEOM.EXE $ WRITEGEOM parameter_list $ RUN MIGCTL $ RUN MIGOCI
Before running the Spatial Georaster
demonstrations, read the ORA_ROOT:[MD.DEMO.GEORASTER...]README
file for each demonstration to be run. The following is an example of how to run a Spatial Georaster
demonstration:
Run the following commands on OpenVMS at DCL to run the SDO Georaster PL/SQL
demonstrations:
$ set default ORA_ROOT:[MD.DEMO.GEORASTER.PLSQL] $ sqlplus/nolog @GEORASTER_DEMO.SQL SQL> exit
After all Spatial Georaster
demonstrations have been run, enter the following commands to remove the Georaster PL/SQL
demonstrations:
$ sqlplus herman/password @DROP_GEORASTER_TABLE.SQL
SQL> exit
To run SDO Georaster Java
demonstrations, follow the instructions in the ORA_ROOT:[MD.DEMO.GEORASTER.JAVA]README
file. Before running the SDO Georaster Java
demonstrations, set up an X Window emulator as described in Section 7.7.2.1, "Running the Spatial Demonstration". The GeoRasterExporter portion of the GeoRaster
demo is unsupported.
The following sections describe how to build and run the SQL*Loader demonstrations installed with Oracle Database 10g.
Review the ULCASE.SH
file for an example of how 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.
The following SQL*Loader
demonstration files are included with Oracle Database 10g in the ORA_RDBMS_DEMO
directory. Run the demonstrations in numerical order:
ULCASE1
ULCASE2
ULCASE3
ULCASE4
ULCASE5
ULCASE6
ULCASE7
Run demonstrations while logged in as the user SCOTT/TIGER.
Creating and Running a Demonstration
Note:
The SCOTT/TIGER user has CONNECT and RESOURCE privileges.
The EMP and DEPT tables exist.
In the following steps, n
represents the demonstration number, listed in the preceding section. To create and run a demonstration:
Run the ULCASE
n
.SQL
script corresponding to the demonstration you want to run:
$ SQLPLUS SCOTT/TIGER @ULCASEn.SQL
Load the demonstration data into the database by running the following command:
$ SQLLDR SCOTT/TIGER ULCASEn.CTL
The following list provides additional information about the ULCASE2
, ULCASE6
, and ULCASE7
demonstrations:
For the ULCASE2
demonstration, you do not have to run the ULCASE2.SQL
script.
For the ULCASE6
demonstration, run the ULCASE6.SQL
script, and run the following command:
$ SQLLDR SCOTT/TIGER ULCASE6 DIRECT=TRUE
For the ULCASE7
demonstration, run the ULCASE7S.SQL
script, and run the following command:
$ SQLLDR SCOTT/TIGER ULCASE7.CTL
After running the demonstration, run the ULCASE7E.SQL
script to drop the trigger and package used by this demonstration.
SQL*Loader is used by both database administrators and Oracle Database 10g users. It loads data from standard operating system files into Oracle Database tables.
The SQL*Loader control file includes the following additional file processing option strings, the default being str
, which takes no argument:
[ "str" | "fix n" | "var n" ]
Table 7-1 describes the processing options used in the preceding example.
Table 7-1 SQL*Loader Processing Option String
String | Description |
---|---|
|
Specifies a stream of records, each terminated by a newline character, which are read in one record at a time This string is the default. |
|
Indicates that the file consists of fixed-length records, each of which is n bytes long, where n is an integer. |
|
Indicates that the file consists of variable-length records, with the length of each record specified in the first If you do not specify a value for |
If you do not select the file processing option, then the information is processed by default as a stream of records (str
). You may find that fix
mode gives better performance than the default str
mode because it does not scan for record terminators.
When using the fix
option to read a file containing fixed-length records, where each record is terminated by a newline character, include the length of the newline character (1 character) when specifying the record length to SQL*Loader.
For example, to read the following file, specify fix
4
instead of fix
3
to include the additional newline character:
AAA<cr> BBB<cr> CCC<cr>
If you do not terminate the last record in a file of fixed-length records with a newline character, then do not terminate the other records with a newline character. Similarly, if you terminate the last record with a newline character, then terminate all records with a newline character.
Note:
Certain text editors, such asEDT
, automatically terminate the last record of a file with a newline character. This leads to inconsistencies if the other records in the file are not terminated with newline characters.Use the position(x:y)
function in the control file to remove newline characters from fixed length records, instead of loading them. For example, enter the following in the control file to remove newline characters from the fourth position:
load data infile xyz.dat "fix 4" into table abc ( dept position(01:03) char )
When this is done, newline characters are removed because they are in the fourth position in each fixed-length record.