Oracle for Unix FAQ

How do I get Oracle to start automatically when my server boots up?

Make sure the entry for your database SID in the /etc/oratab file ends in a capital Y. Eg: 
               #  ORAC:/u01/app/oracle/product/7.3.2:Y
The scripts for starting and stopping databases are:

$ORACLE_HOME/bin/dbstart and dbshut. SQL*Net is started with the 
lsnrctl command. Add the              following two entries to your 
/etc/rc.local (or equivalent) file: 
su - oracle -c /path/to/$ORACLE_HOME/bin/dbstart
               su - oracle -c /path/to/$ORACLE_HOME/bin/lsnrctl

Can I export directly to a tape drive?
Yes, just use the tape device instead of the file name.

Eg:  exp userid/password file=/dev/rmt0 table=emp

I don't have enough space to export my database! Any suggestions?
Well, if you can't afford to buy extra disk space you can run export and compress simultaneously. This will prevent the need to get enough space for both the export file AND the compressed export file. 

Eg: # Make a pipe
mknod expdat.dmp p
               # Start compress sucking on the pipe in background
               compress < expdat.dmp  expdat.dmp.Z &
               # Wait a second or so before kicking off the export
               sleep 5
               # Start the export
               export scott/tiger filename=expdat.dmp
How can I make export/import faster?
The IMP/EXP programs run in two task mode to protect the SGA from potential corruption by user programs. If you relink these programs in single task mode you can gain much improvement in speed (up to 30%). Although Oracle won't support this they supposedly use this method themselves. 
cd $ORACLE_HOME/rdbms/lib
               make -f expsingle
               make -f impsingle
               mv expsingle bin
               mv impsingle bin
Now use expsingle and impsingle instead of imp or exp. 
How can I SELECT a value from a table into a Unix variable?
You can select a value from a database column directly into a Unix 
shell variable. Look at the following shell script example: 
                    VALUE=`sqlplus -s "user/password@instance" << any
                             (SELECT   sal  FROM emp WHERE deptno = 30)
                                 ORDER BY  sal;
Lines which don't start with a listed keyword should  be  lined 
up with the second word  on  the                          previous line, e.g. :
SELECT    ename, dept
                                 FROM      emp

Have a Oracle Question
Do you have an Oracle Question?

Oracle Books
Oracle Certification, Database Administration, SQL, Application, Programming Reference Books

Oracle Application
Oracle Application Hints and Tips

Oracle Home
Oracle Database, SQL, Application, Programming Tips

All the site contents are Copyright © and the content authors. All rights reserved.
All product names are trademarks of their respective companies.
The site is not affiliated with or endorsed by any company listed at this site.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
 The content on this site may not be reproduced or redistributed without the express written permission of or the content authors.