Oracle9i Administrator's Reference
Release 2 (9.2.0.1.0) for UNIX Systems: AIX-Based Systems, Compaq Tru64 UNIX, HP 9000 Series HP-UX, Linux Intel, and Sun Solaris Part No. A97297-01 |
|
This chapter provides information on administering Oracle9i on AIX, HP, Linux, Solaris, and Tru64. It contains the following sections:
You must set Oracle9i environment variables, parameters, and user settings for Oracle9i to work. This chapter describes the various settings for Oracle9i on AIX, HP, Linux, Solaris, and Tru64.
In Oracle9i files and programs, a question mark (?) represents the value of the ORACLE_HOME environment variable. For example, Oracle9i expands the question mark in the following SQL statement to the full pathname of the Oracle home directory:
SQL> ALTER TABLESPACE TEMP ADD DATAFILE '?/dbs/temp02.dbf' SIZE 2M
Similarly, the @ sign represents the ORACLE_SID environment variable. For example, to indicate a file belonging to the current instance, enter:
SQL> ALTER TABLESPACE tablespace_name ADD DATAFILE tempfile@.dbf
This section describes the most commonly-used Oracle9i and UNIX environment variables. You must define some environment variables before installing Oracle9i. These environment variables are listed in the Oracle9i Installation Guide Release 2 (9.2.0.1.0) for UNIX Systems.
To display the current value of an environment variable, use the env
command. For example, to display the value of the ORACLE_SID environment variable, enter:
$ env | grep ORACLE_SID
Table 1-1 provides the syntax for, and examples of, environment variables used by Oracle9i.
Table 1-1 Oracle9i Environment Variables on UNIX
Note: To prevent conflicts, do not define environment variables with names that are identical to the names of Oracle Server processes, for example: ARCH, PMON, and DBWR. |
Table 1-2 provides the syntax for, and examples of, UNIX environment variables used with Oracle9i.
Table 1-2 UNIX Environment Variables Used with Oracle9i
This section describes how to use the oraenv
command to set a common UNIX environment. You can use the coraenv
command for the C shell in the same way.
The oraenv
script is created during installation. This script sets environment variables based on the contents of the oratab
file and provides:
A central means of updating all user accounts with database changes
A mechanism for switching between Oracle9i databases specified in the oratab
file
You may find yourself frequently adding and removing databases from your development system or your users may be switching between several different Oracle databases installed on the same system. You can use the oraenv
script to ensure that user accounts are updated and to switch between databases.
The oraenv
script is usually called from the user's .profile
file . It is used to set the ORACLE_SID, ORACLE_HOME, and PATH environment variables to include the $ORACLE_HOME/bin
directory. When switching between databases, users can run the oraenv
script to set these environment variables.
See Also: Oracle9i Installation Guide Release 2 (9.2.0.1.0) for UNIX Systems for more information on setting a common environment. |
The directory that contains the oraenv
and dbhome
scripts is called the local bin
directory. All database users should have read access to this directory. Include the path of the local bin directory in the users' PATH environment variables. If you run the root.sh
script after installation, the script prompts you for the path of the local bin
directory and automatically copies the oraenv
and dbhome
scripts to the directory. The default local bin
directory is /usr/local/bin
. If you do not run the root.sh
script, you can manually copy the oraenv
and dbhome
script from the $ORACLE_HOME/bin
directory to your local bin
directory.
To switch from one database or database instance to another, call the oraenv
script. Reply to the prompt with the value of the ORACLE_SID environment variable of the database to which you are switching. If the local bin
directory is not included in the PATH environment, provide the full path of the oraenv
command file. For example:
$ . /usr/local/bin/oraenv ORACLE_SID= [default]? sid
Use the env
command to show the environment variable values that have been exported to the environment. The Bourne shell and Korn shell can set values without exporting them.
For the Bourne or Korn shell, enter:
$ ORACLE_SID=test $ export ORACLE_SID
For the C shell, enter:
% setenv ORACLE_SID test
In the preceding examples, test
is the value of the ORACLE_SID environment variable.
The TZ environment variable sets the time zone. It enables you to adjust the clock for daylight saving time changes or different time zones. The adjusted time is used to time-stamp files, produce the output of the date
command, and obtain the current SYSDATE.
Oracle Corporation recommends that you do not change your personal TZ value. Using different values of TZ such as GMT+24 might change the date a transaction is recorded. This changed date affects Oracle applications that use SYSDATE, such as Oracle Financials. To avoid this problem, use sequence numbers to order a table instead of date columns.
If you are developing Oracle9i applications on HP that use shared libraries and function calls, users of your application must set the LD_PRELOAD environment variable.
Because they require less memory, many programs use shared libraries. In most cases, the dld.sl
64-bit HP-UX dynamic loader is invoked automatically when applications using shared libraries start. At run time, the dynamic loader implicitly attaches all shared libraries linked with the program to the process. This includes the HP-UX thread-local storage (TLS) libraries. Programs can also use the shl_load()
HP-UX function call to:
Explicitly access the 64-bit HP-UX dynamic loader
Attach a shared library to a process at run time
Calculate the addresses of symbols defined within shared libraries
Detach the library when finished
In laboratory tests, errors occur when an application uses the shl_load()
function call to attach a shared library that directly or indirectly contains HP-UX TLS libraries. These errors include Oracle shared libraries which are currently linked with the libpthread.sl
and libcl.sl
HP-UX TLS libraries, for example libclntsh.sl
.
In the following example, the prog.c
program calls the shl_load()
function to load the libclntsh.sl
library:
shl_load("Oracle_home_directory/rdbms/lib/libclntsh.sl", BIND_IMMMEDIATE | BIND_VERBOSE | DYNAMIC_PATH | 0L);
When the program is executed, it generates the following errors:
/usr/lib/pa20_64/dld.sl: Cannot dlopen load module '/usr/lib/pa20_64/libpthread.1' because it contains thread specific data. /usr/lib/pa20_64/dld.sl: Cannot dlopen load module '/usr/lib/pa20_64/libcl.2' because it contains thread specific data.
The new LD_PRELOAD environment variable resolves these errors.
To prevent errors occurring when an application uses the shl_load()
function call to attach a shared library that directly or indirectly contains HP-UX TLS libraries, perform the following steps:
Set the value of the LD_PRELOAD environment variable to include a colon-separated or whitespace-separated list of the TLS libraries that your program uses, for example:
$ export LD_PRELOAD=/usr/lib/pa20_64/libpthread.1:/usr/lib/pa20_64/libcl.2
The dynamic loader treats the libraries specified by the LD_PRELOAD variable as the first libraries in the link line and pre-loads these libraries implicitly at application startup.
Enter the following command to execute your program, where prog
is the name of your program:
$ prog
The errors shown on the previous page should not appear.
Unset the LD_PRELOAD variable to prevent memory overheads:
$ unset LD_PRELOAD
See Also: Your HP-UX system documentation for more information on the LD_PRELOAD environment variable. |
You can manually relink your product executables using a relink shell script located in the $ORACLE_HOME/bin
directory. Relinking is necessary after applying any operating system patches or after an operating system upgrade.
Note: Shut down all executables that are running in the ORACLE_HOME that you are relinking, including the listener and Oracle Intelligent Agent. In addition, shut down any applications that are linked with any Oracle shared libraries. |
The relink script manually relinks Oracle product executables, depending on the products that have been installed in the Oracle home directory.
To relink product executables, enter the following command, where argument
is one of the values listed in Table 1-3:
$ relink
argument
Table 1-3 Relink Script Parameters
Value | Description |
---|---|
all
|
Every product executable that has been installed |
oracle
|
Oracle server executable only |
network
|
net_client , net_server , cman , names
|
client
|
net_client , otrace , plsql
|
ctx
|
Oracle Text utilities |
precomp
|
All precompilers that have been installed |
utilities
|
All utilities that have been installed |
oemagent
|
oemagent
Note: To give the correct permissions to the |
ldap | ldap , oid
|
The System Global Area (SGA) is the Oracle structure that is located in shared memory. It contains static data structures, locks, and data buffers. Sufficient shared memory must be available to each Oracle process to address the entire SGA.
The maximum size of a single shared memory segment is specified by the SHMMAX kernel parameter (SHM_MAX on Tru64). The following table shows the recommended value for this parameter, depending on your platform:
Platform | Recommended Value |
---|---|
AIX | Not applicable. |
HP | The size of the physical memory installed on the system.
See Also: "HP-UX Shared Memory Segments for a 64-Bit Oracle Instance " for information on the SHMMAX parameter on HP. |
Solaris | 4 GB minus 16 MB. Can be greater than 4 GB on 64-bit systems. |
Tru64 | 4 GB minus 16 MB.
Note: The value of the SHM_MAX parameter must be at least 16 MB for the Oracle instance to start. If your system runs both Oracle8i and Oracle9i instances, you must set the value of this parameter to 2 GB minus 16 MB. |
Linux | Half the size of the physical memory installed on the system. |
If the size of the SGA exceeds the maximum size of a shared memory segment (SHMMAX or SHM_MAX), Oracle9i attempts to attach more contiguous segments to fulfill the requested SGA size. The SHMSEG kernel parameter (SHM_SEG on Tru64) specifies the maximum number of segments that can be attached by any process.
Set the following initialization file parameters to control the size of the SGA:
Use caution when setting values for these parameters. When values are set too high, too much of the computer's physical memory is devoted to shared memory, resulting in poor performance.
You can determine the SGA size in one of the following ways:
Enter the following SQL*Plus command to display the size of the SGA for a running database:
SQL> SHOW SGA
The result is shown in bytes.
Determine the size of the SGA when you start your database instance. The SGA size is displayed next to the heading Total System Global Area.
On Solaris systems, Oracle9i uses Intimate Shared Memory (ISM) for shared memory segments because it shares virtual memory resources among Oracle processes. On Solaris 2.6 and Solaris 7, Oracle9i uses ISM by default. ISM causes the physical memory for the entire shared memory segment to be locked automatically.
On Solaris 8, dynamic/pageable ISM (DISM) is available. This enables Oracle9i to share virtual memory resources among processes sharing the segment, and at the same time, enables memory paging. The operating system does not have to lock down physical memory for the entire shared memory segment.
Oracle9i automatically decides at startup whether to use ISM or DISM, based on the following criteria:
Oracle9i uses DISM if it is available on the system, and if the value of the SGA_MAX_SIZE initialization parameter is larger than the size required for all SGA components combined. This allows Oracle9i to lock only the amount of physical memory that is used.
Oracle9i uses ISM if the entire shared memory segment is in use at startup or if the value of the SGA_MAX_SIZE parameter is equal to or smaller than the size required for all SGA components combined.
Regardless of whether Oracle9i uses ISM or DISM, it can always exchange the memory between dynamically sizable components such as the buffer cache, the shared pool, and the large pool after it starts an instance. Oracle9i can relinquish memory from one dynamic SGA component and allocate it to another component.
Because shared memory segments are not implicitly locked in memory, when using DISM, Oracle9i explicitly locks shared memory that is currently in use at startup. When a dynamic SGA operation uses more shared memory, Oracle9i explicitly performs a lock operation on the memory that comes in use. When a dynamic SGA operation releases shared memory, Oracle9i explicitly performs an unlock operation on the memory that is freed, so that it becomes available to other applications.
Oracle9i uses a new utility, oradism
, to lock and unlock shared memory. If the LOCK_SGA parameter is set to TRUE, Oracle9i attempts to lock the entire SGA at startup. In this case, no locks or unlocks are performed when the SGA resizes.
With Oracle9i release 2 (9.2.0.1.0), the oradism
utility is automatically set up during installation. You do not need to perform any configuration tasks to use dynamic SGA.
Note: The process name for theoradism utility is ora_dism_ sid , where sid is the system identifier. When using DISM, this process is started during instance startup, and automatically quits when the instance is shut down.If a message appears in the alert log saying that the oradism utility is not set up correctly, verify that the oradism utility is located in the $ORACLE_HOME/bin/ directory and that it has superuser privileges.
|
On AIX, shared memory uses common virtual memory resources across processes. Processes share virtual memory segments through a common set of virtual memory translation resources, for example tables and cached entries, for improved performance. With Oracle9i on AIX, shared memory can be pinned to prevent paging and to reduce I/O overhead. To do this, set the LOCK_SGA parameter to TRUE. Additionally, starting with Oracle9i release 2 (9.2.0.1.0) on AIX 5.1, the same parameter activates the large page feature whenever the underlying hardware supports it.Enter the following command to make pinned memory available to Oracle9i on AIX systems:
$ vmtune
-s 1
Enter the following command to set the maximum percentage of real memory available for pinned memory where percent_of_real_memory
is the maximum percent of real memory that you want to set:
$ vmtune
-M percent_of_real_memory
When using the -M
flag, it is important that the amount of pinned memory exceeds the Oracle SGA size by at least 3 percent of the real memory on the system, allowing free pinnable memory for use by the kernel.
Use the AIX svmon
command to monitor the use of pinned memory during the operation of the system. Oracle9i attempts to pin memory only if the LOCK_SGA parameter is set to TRUE.
On AIX Power4-based systems, you can enable large pages by:
Using the -g
and -L
flags of the vmtune
command. The -g
flag specifies the size of the large pages, and should be set to 256 MB (-g 268435456
) for Power4 processors. The -L
flag specifies the number of large pages as specified by the -g
flag to reserve for Oracle9i.
Running the bosboot
command and then rebooting the system.
Oracle Corporation recommends specifying enough large pages to contain the entire SGA. Starting with Oracle9i release 2 (9.2.0.1.0), the Oracle instance attempts to allocate large pages when the LOCK_SGA parameter is set to TRUE. If the SGA size exceeds the size of memory available for pinning, or large pages, the portion of the SGA exceeding these sizes is allocated to ordinary shared memory.
See Also: The AIX documentation for information on the command for enabling and tuning pinned memory and large pages. |
The total memory used by an Oracle9i instance is approximately the size of the SGA plus the size of the Program Global Area (PGA). To specify the size of the PGA, set the PGA_AGGREGATE_TARGET parameter.
Table 1-4 lists the default and maximum values for parameters in a CREATE DATABASE or CREATE CONTROLFILE statement.
Note: Interdependencies among these parameters may affect allowable values. |
Table 1-4 CREATE CONTROLFILE and CREATE DATABASE Parameters
Parameter | Default | Maximum Value |
---|---|---|
MAXLOGFILES | 16 | 255 |
MAXLOGMEMBERS | 2 | 5 |
MAXLOGHISTORY | 100 | 65534 |
MAXDATAFILES | 30 | 65534 |
MAXINSTANCES | 1 | 63 |
Table 1-5 lists the Oracle9i file size limits in bytes specific to UNIX.
Table 1-5 File Size Limits
File Type | Operating System | Maximum SIze |
---|---|---|
Datafiles | Any | 4,194,303 multiplied by the value of the DB_BLOCK_SIZE parameter |
Import/Export files and SQL*Loader files | Tru64
AIX, HP, Linux, Solaris: 32-bit with 32-bit files AIX, HP, Linux, Solaris: 32-bit with 64-bit files AIX, HP, Linux, Solaris: 64-bit |
< 16TB
2,147,483,647 bytes Unlimited Unlimited |
Control files | Solaris, HP, Linux | 20000 database blocks |
AIX | 10000 database blocks | |
|
Tru64 | 19200 database blocks |
Special operating system accounts and groups are required by Oracle9i, as follows:
Oracle software owner account
OSDBA, OSOPER, and ORAINVENTORY groups
The Oracle software owner account, usually named oracle
, is the account that you use to install the Oracle software. You can use different Oracle software owner accounts for separate installations of the software. However, you must use the same account that installed the software for all subsequent maintenance tasks on that installation.
Oracle Corporation recommends that the Oracle software owner has the ORAINVENTORY group as its primary group and the OSDBA group as its secondary group.
Table 1-6 describes the special UNIX groups required by Oracle9i.
Table 1-6 UNIX Groups
Oracle9i uses several features of the UNIX operating system to provide a secure environment for users. These features include file ownership, group accounts, and the ability of a program to change its user ID upon execution.
The two-task architecture of Oracle9i improves security by dividing work (and address space) between the user program and the oracle
program. All database access is achieved through the shadow process and special authorizations in the oracle
program.
See Also: Oracle9i Database Administrator's Guide for more information on security issues. |
Oracle programs are divided into two sets for security purposes: those executable by all (other
, in UNIX terms), and those executable by DBAs only. Oracle Corporation recommends the following approach to security:
The primary group for the oracle
account should be the oinstall
group.
The oracle
account must have the dba
group as a secondary group.
Although any user account which requires dba
privileges can belong to the dba
group, the only user account which should belong to the oinstall
group is the oracle
account.
See the Oracle9i Installation Guide Release 2 (9.2.0.1.0) for UNIX Systems for information on the appropriate permissions for database files.
If you choose to use external authentication, you must use the value of the OS_AUTHENT_PREFIX initialization parameter as a prefix for Oracle usernames. If you do not explicitly set this parameter, the default value on UNIX is ops$
, which is case sensitive.
To use the same usernames for both operating system and Oracle authentication, set this initialization parameter to a null string, as follows:
OS_AUTHENT_PREFIX=""
See Also: Oracle9i Database Administrator's Guide for more information on external authentication. |
You can use a password file to identify users that can use the SYSDBA and SYSOPER privileges when connecting to the database. To create the password file:
Log in as the Oracle software owner.
Use the $ORACLE_HOME/bin/orapwd
utility, which has the following syntax:
$ orapwd file=filename
password=password entries=max_users
The following table describes the values that you must specify in this command:
Variable | Description |
---|---|
filename
|
Name of the file where password information is written. The name of the file must be orapw sid and you must supply the full pathname. Its contents are encrypted and not user-readable. This parameter is mandatory. The password file is typically created in the $ORACLE_HOME/dbs directory.
|
password
|
This parameter sets the password for the SYS user. If you use an ALTER USER statement to change the password for the SYS user after you connect to the database, both the password stored in the data dictionary and the password stored in the password file are updated. This parameter is mandatory. |
max_users
|
Maximum number of entries that you require the password file to accept. |
See Also: Oracle9i Database Administrator's Guide for more information on using theorapwd utility.
|
When the Database Configuration Assistant Summary window appears, users must change the SYS and SYSTEM account passwords. You cannot use the default CHANGE_ON_INSTALL and MANAGER passwords.
For security reasons, the Database Configuration Assistant locks most Oracle user accounts after it creates the database. It does not lock the SYS, SYSTEM, or SCOTT accounts. You must unlock any locked accounts and change their passwords before logging into them.
To change the passwords, click the Password Management button in the Database Configuration Assistant Summary window.
Alternatively, use SQL*Plus to connect to the database as SYSDBA and enter the following command:
SQL> ALTER USER username IDENTIFIED BY passwd ACCOUNT UNLOCK;
The default initialization file (init
sid
.ora
) is provided with the Oracle9i software. The Database Creation Assistant creates it in the $ORACLE_BASE/admin/
sid
/pfile
directory. A sample initialization file is located in the $ORACLE_HOME/dbs
directory.
Table 1-7 lists default initialization parameter values on UNIX. All Oracle9i instances assume these values if you do not specify different values for them in the init
sid
.ora
file. Oracle Corporation recommends that you include in the init
sid
.ora
file only those parameters that differ from the default initialization parameter values.
Use the SHOW PARAMETERS command in SQL*Plus to display the current values of these parameters on the system.
See Also: For Tru64, "CLUSTER_INTERCONNECTS Initialization Parameter (Formerly TRU64_IPC_NET)", and the Oracle9i Database Reference, Oracle9i Database Administrator's Guide, and the Oracle9i Performance Guide and Reference for more information on initialization parameters. |
Table 1-7 Initialization Parameters
To administer the Oracle HTTP Server, you must have access to the local system on which the server is running, and in some cases you must have root
access.
The Oracle HTTP Server starts automatically on the default port 7777 after installation. To verify that the server is running, enter the following command:
$ ps -elf | grep httpd
Note: This product includes software developed by the Apache Software Foundation. |
If you modify the configuration, you must restart the server. You must be logged in as the root
user to start the server with SSL enabled.
To stop the server, enter the following commands:
$ cd $ORACLE_HOME/Apache/Apache/bin $ su root # ./apachectl stop
To restart the server, enter the following commands:
$ cd $ORACLE_HOME/Apache/Apache/bin $ su root # ./apachectl {start|startssl}
Use the start
flag to start a non-SSL enabled server or use the startssl
flag to start an SSL enabled server. The default port for a non-SSL enabled server is 80. The default port for an SSL enabled server is 443.
Note: If you start a non-SSL enabled server and port 80 is not available, the Oracle HTTP server uses the next available port between 7777 and 7877 as its default port.If you start an SSL enabled server and port 443 is not available, the Oracle HTTP server uses the next available port between 4443 and 4543 as its default port. |
The default initial static page contains links to online documentation as well as demonstrations for each of the components. To access the initial static page, use an internet browser to view one of the following URLs:
For servers without SSL enabled:
http://ServerName
:7777/
For servers with SSL enabled:
http://ServerName
:80/
For servers with SSL enabled (secure, using HTTPS):
https://ServerName
:4443/
In the preceding example, ServerName
is configured in the HTTP Server httpd.conf
configuration file. To locate the appropriate value in the configuration file, enter:
$ grep ServerName $ORACLE_HOME/Apache/Apache/conf/httpd.conf
A number of log files are generated by the server. Check them periodically to make sure that the server is working correctly. By default, the error log level is set to warn
in the configuration files. You can change the default error level by editing the appropriate configuration file and restarting the server.
The following log files are generated by the server:
$ORACLE_HOME/Apache/Apache/logs/access_log $ORACLE_HOME/Apache/Apache/logs/error_log $ORACLE_HOME/Apache/Apache/logs/ssl_engine_log $ORACLE_HOME/Apache/Jserv/logs/jserv.log $ORACLE_HOME/Apache/Jserv/logs/mod_jserv.log
This section describes how to build and run the SQL*Loader and PL/SQL demonstration programs installed with Oracle9i.
The following SQL*Loader demonstration files are included with Oracle9i in the $ORACLE_HOME/rdbms/demo
directory. Run the demonstrations in numerical order:
ulcase1
|
ulcase3
|
ulcase5
|
ulcase7
|
ulcase2
|
ulcase4
|
ulcase6
|
|
Run demonstrations while logged in as the user SCOTT/TIGER. If the SCOTT/TIGER schema does not exist on your system, run the $ORACLE_HOME/rdbms/admin/utlsampl.sql
script to create it.
Ensure that:
The user SCOTT/TIGER has CONNECT and RESOURCE privileges
The EMP and DEPT tables exist
In the following steps, n represents the demonstration number, listed in the previous 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 objects:
$ sqlplus SCOTT/TIGER @ulcasen
.sql
The following list provides additional information on 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, then enter the following command:
$ sqlldr SCOTT/TIGER ulcase6 DIRECT=true
For the ulcase7
demonstration, run the ulcase7s.sql
script, then enter the following command:
$ sqlldr SCOTT/TIGER ulcase7
After running the demonstration, run the ulcase7e.sql
script to drop the trigger and package used by this demonstration.
PL/SQL includes a number of demonstration programs that you can load. The Oracle9i database 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:
Change directory to the PL/SQL demonstrations directory:
$ cd $ORACLE_HOME/plsql/demo
Start SQL*Plus and connect as SCOTT/TIGER:
$ sqlplus SCOTT/TIGER
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. |
The following PL/SQL kernel demonstrations are available:
examp1.sql
|
examp5.sql
|
examp11.sql
|
sample1.sql
|
examp2.sql
|
examp6.sql
|
examp12.sql
|
sample2.sql
|
examp3.sql
|
examp7.sql
|
examp13.sql
|
sample3.sql
|
examp4.sql
|
examp8.sql
|
examp14.sql
|
sample4.sql
|
extproc.sql
|
|
|
|
To compile and run the examp
n
.sql
or sample
n
.sql
PL/SQL kernel demonstrations:
Start SQL*Plus and connect as SCOTT/TIGER:
$ cd $ORACLE_HOME/plsql/demo $ sqlplus SCOTT/TIGER
Enter a command similar to the following to run a demonstration, where demoname
.sql
is the name of the demonstration:
SQL> @demoname
To run the extproc.sql
demonstration:
If necessary, add an entry for external procedures to the tnsnames.ora
file, similar to the following:
EXTPROC_CONNECTION_DATA.
domain=
(DESCRIPTION =
(ADDRESS_LIST =(ADDRESS=(PROTOCOL = IPC)( KEY = EXTPROC))
)
(CONNECT_DATA =
(SID = PLSExtProc)
)
)
If necessary, add an entry for external procedures to the listener.ora
file, similar to the following:
SID_LIST_LISTENER = (SID_LIST = (SID_DESC= (SID_NAME=PLSExtProc) (ORACLE_HOME=/u01/app/oracle/product/9.2.0.1.0) (ENVS=EXTPROC_DLLS=/u01/app/oracle/product/9.2.0.1.0/plsql/demo/extproc.so,
LD_LIBRARY_PATH=/u01/app/oracle/product/9.2.0.1.0/plsql/demo) (PROGRAM=extproc) ) )
Note: The value that you specify for SID_NAME in thelistener.ora file must match the value that you specify for SID in the tnsnames.ora file.
|
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
From SQL*Plus, enter the following commands:
SQL> CONNECT SYSTEM/MANAGER SQL> GRANT CREATE LIBRARY TO SCOTT; SQL> CONNECT SCOTT/TIGER SQL> CREATE OR REPLACE LIBRARY demolib IS 2 '$ORACLE_HOME/plsql/demo/extproc.so'; 3 /
To run the demonstration, enter the following command:
SQL> @extproc
Note: Themake 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:
examp9.pc
|
examp10.pc
|
sample5.pc
|
sample6.pc
|
To build all of the PL/SQL precompiler demonstrations, 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
SQL*Loader is used by both database administrators and Oracle9i users. It loads data from standard operating system files into Oracle database tables.
See Also: Oracle 9i Database Utilities for more information on using SQL*Loader. |
The SQL*Loader control file includes the following additional file processing option, the default being str
, which takes no argument:
[ "str" | "fix n" | "var n" ]
The following table describes these processing options:
String | Description |
---|---|
"str"
|
Specifies a stream of records, each terminated by a newline character, which are read in one record at a time. This option is the default. |
"fix n "
|
Indicates that the file consists of fixed-length records, each of which is n bytes long, where n is an integer value. |
"var n "
|
Indicates that the file consists of variable-length records, with the length of each record specified in the first n characters. If you do not specify a value of n, SQL*Loader assumes a value of 5. |
If you do not select the file processing option, the information is processed by default as a stream of records ("str"
). You might find that the "fix"
option yields faster performance than the default "str"
option 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 (one 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, do not terminate the other records with a newline character either. Similarly, if you terminate the last record with a newline character, terminate all records with a newline character.
Caution: Certain text editors, such asvi , 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 discard the newline characters from fixed length records rather than loading them.
For example, enter the following lines in your control file to discard newline characters from the fourth position:
load data infile xyz.dat "fix 4" into table abc ( dept position(01:03) char )
Using these lines, SQL*Loader discards newline characters because they are in the fourth position in each fixed-length record.
|
![]() Copyright © 1996, 2002 Oracle Corporation All rights reserved |
|