Step 7: Starting The Database
If you chose to create a database using DBCA during the installation process, your database will be started and running when the process has completed. If not, you will need to either use DBCA to create a new database, or use a set of your own database creation scripts.
To see if ORACLE will cooperate with you, try running SQL*Plus.
oracle-bsd> sqlplus '/ as sysdba'
SQL*Plus: Release 9.2.0.1.0 - Production on Wed
Aug 20 12:02:07 2003
Copyright (c) 1982, 2002, Oracle Corporation.
All rights reserved.
Connected to an idle instance.
SQL>
|
Listing 14. Running SQL*Plus.
If this command fails, here are the most common reasons:
- ORA-01031: insufficient privileges
Your user account is not a member of the OSDBA group. If you are logged in as "oracle," but still get this error, check to make sure that you are a member of the appropriate groups using the "id" command.
- Message file sp1.msb not found
Be sure that $ORACLE_HOME is set.
- Library "libclntsh.so.9.0" not found
In rare cases like this, you may need to define LD_LIBRARY_PATH=$ORACLE_HOME/lib in your .profile to link the shared libraries properly.
(Obviously, please refer to Oracle Technology Network, Tom, and the "Other" manual if you encounter problems not listed here.)
Notice the message Connected to an idle instance. As anyone who has seen Oracle before will know, this indicates that my Oracle instance (which I configured to be called "ORACLE") is not running. In my case, it indicates further that my instance does not exist. I will fix this by running a database creation script, created by DBCA, on my system. Rather than list out the whole (rather long) thing, I have provided a tarball (download here) of these scripts which you can run on your own system, and will only list the bare essentials of the output here.
oracle-bsd> cd /u01/app/oracle/admin
oracle-bsd> tar xzf dbca-ORACLE.tgz
oracle-bsd> cd ORACLE/scripts
oracle-bsd> ORACLE_SID=ORACLE; export ORACLE_SID
oracle-bsd> sh ORACLE.sh
|
Listing 15. Using my database scripts to create your database.
If the above process fails (you'll see it scroll by quickly without any pauses - look more closely, and you'll probably see the message "ORACLE not available"), you can try a more manual process like the one below:
oracle-bsd> sqlplus '/ as sysdba'
SQL*Plus: Release 9.2.0.1.0 - Production on Wed
Aug 20 13:19:02 2003
Copyright (c) 1982, 2002, Oracle Corporation.
All rights reserved.
Connected to an idle instance.
SQL> STARTUP NOMOUNT PFILE =
'/u01/app/oracle/admin/ORACLE/scripts/init.ora';
ORACLE instance started.
Total System Global Area 114364796 bytes
Fixed Size 450940 bytes
Variable Size 88080384 bytes
Database Buffers 25165824 bytes
Redo Buffers 667648 bytes
SQL> CREATE DATABASE ORACLE
MAXINSTANCES 1
MAXLOGHISTORY 1
MAXLOGFILES 5
MAXLOGMEMBERS 3
MAXDATAFILES 100
DATAFILE '/u02/oradata/ORACLE/system01.dbf'
SIZE 250M
REUSE
AUTOEXTEND ON
NEXT 10240K
MAXSIZE UNLIMITED
EXTENT MANAGEMENT LOCAL
DEFAULT TEMPORARY TABLESPACE TEMP
TEMPFILE '/u02/oradata/ORACLE/temp01.dbf'
SIZE 40M
REUSE
AUTOEXTEND ON
NEXT 640K
MAXSIZE UNLIMITED
UNDO TABLESPACE "UNDOTBS1"
DATAFILE '/u02/oradata/ORACLE/undotbs01.dbf'
SIZE 200M
REUSE
AUTOEXTEND ON
NEXT 5120K
MAXSIZE UNLIMITED
CHARACTER SET WE8ISO8859P1
NATIONAL CHARACTER SET AL16UTF16
LOGFILE
GROUP 1
('/u02/oradata/ORACLE/redo01.log')
SIZE 102400K,
GROUP 2
('/u02/oradata/ORACLE/redo02.log')
SIZE 102400K,
GROUP 3
('/u02/oradata/ORACLE/redo03.log')
SIZE 102400K;
|
Listing 16. Doing things the hard way.
Common Errors
Here are some errors I have encountered:
- ORA-27102: out of memory
If your SYSVSHM kernel settings are configured correctly, this error will be due to excessive sizes in your init.ora file. Try reducing the number of processes, and some of the buffer sizes that make up the SGA.
- LRM-00109: could not open parameter file '...'
Your init.ora file could not be found. Make sure it exists in the location you specified.
- ORA-07446: sdnfy: bad value '...' for parameter user_dump_dest.
Make sure the directory specified in this error message exists.
Testing Things Out
You may want to test starting up and shutting down your database to ensure that things are working correctly. Do something like this:
oracle-bsd> sqlplus '/ as sysdba'
SQL*Plus: Release 9.2.0.1.0 - Production on Wed
Aug 20 13:19:02 2003
Copyright (c) 1982, 2002, Oracle Corporation.
All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.1.0
- Production
JServer Release 9.2.0.1.0 - Production
SQL> SHUTDOWN IMMEDIATE;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> STARTUP;
ORACLE instance started.
Total System Global Area 114364796 bytes
Fixed Size 450940 bytes
Variable Size 88080384 bytes
Database Buffers 25165824 bytes
Redo Buffers 667648 bytes
Database mounted.
Database opened.
|
Listing 17. Doing things the hard way.
Is that the smell of success? Naw, it smells more like my processor burning itself up running this Oracle instance! If these commands ran correctly, your database should be up and running normally. At this point, you can load your database applications of choice into the system!
Assuming my next experiment goes well, I hope to have an installation guide similar to this for Oracle 9i Application Server soon. If you don't hear from me for a while, just drop me an e-mail, and I will let you know how it is going. In any event, I hope this document was useful for you! I would love to hear your feedback on the items contained here - if something didn't work for you, let me know, and I will see if I can help you work through it. Of course, if you did find the document helpful, and everything worked, I would still love to hear what you think! Feel free to e-mail me, either way.
Until later,
Brian C. Ledbetter
Appendix A: Credits
Many heartfelt and gracious thanks to the following people for their assistance with getting my Oracle 9i instance to work - without their help, I would never have gotten this figured out:
- Berend de Boer <berend@pobox.com>
- Valery V.Chikalov <valera@novakom.dp.ua>
- Roberto Nunnari <nunnari@die.supsi.ch>
- Georg-W. Koltermann <g.w.k@web.de>
Appendix B: References
I found the following information useful during this experiment. I trust that you will find it equally excellent.
- HOWTO: Oracle for Linux on FreeBSD
This document covers Oracle8i. I used this successfully back in 1999, and hope to create a similar experience with this document.
- Oracle Installation Guide for UNIX
Look here for good tuning tips and other information. An OTN account is required, and freely available.
- FreeBSD Handbook: Installing Oracle
Contains much of the information from the above, but in a more concise format.
- The freebsd-database list
This is where I go for help.
- Running Oracle on Freebsd
In Russian, but helpful nonetheless.
Appendix C: System As Tested
This has been tested successfully on a 5.1-RELEASE system.
Appendix D: De-Installing Oracle
Once you have finished playing with Oracle, and want to remove it from your system, there is an easy way to do this. While the obvious is to simply remove the /u0* directories and everything in them, Oracle has actually placed some files in non-intuitive locations which will need to be deleted also. Assuming you followed these procedures exactly, this is what you will do:
bsdbox# rm /compat/linux/etc/oratab
bsdbox# rm /compat/linux/etc/oraInst.loc
bsdbox# rm /usr/local/bin/*ora*
bsdbox# rm /usr/local/bin/dbhome
|
Listing 18. Cleaning up.
Side Note: Oracle 10g
I have performed an installation of Oracle 10g on a FreeBSD 5.1 system, and from what I have seen so far, the process is much smoother. Using the Blackdown JDK 1.3.1, instead of the Sun JDK, I was able to install and run all of the basic 10g tools without any errors or fiddling with the configuration. Pretty exciting stuff! I hope to post documentation on this before too long, although from the looks of things, it will be a much simpler process than the 9i process.
원본출처 : http://www.shadowcom.net/freebsd-oracle9i/