My Oracle Notes

Here are some quick memos about Oracle. They are mostly here to be a place where I can refresh my memory.

== Start a Oracle databse instance ==

* Setup paths and SID
export ORACLE_HOME=/usr/oracle/Ora901
export PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_SID=mysid

* Start TNS Listner
lsnrctl start

* Startup the instance

$ sqlplus "/ as sysdba"

SQL*Plus: Release 9.2.0.8.0 - Production on Mon Dec 3 11:51:25 2007

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 1398769232 bytes
Fixed Size                   730704 bytes
Variable Size             738197504 bytes
Database Buffers          654311424 bytes
Redo Buffers                5529600 bytes
Database mounted.
Database opened.

== Start a Oracle databse instance ==

* Shutdown paths and SID
export ORACLE_HOME=/usr/oracle/Ora901
export PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_SID=mysid

* Stop the instance

$ sqlplus "/ as sysdba"

SQL*Plus: Release 9.2.0.8.0 - Production on Mon Dec 3 11:51:25 2007

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

Connected to an idle instance.

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

* Stop TNS Listner
lsnrctl stop

== Clean-up old trace and log files ==
To free up some disk space you can remove old archive logs and other files which normally isn't needed after a period of time.

Donald K. Burleson have published some [http://www.oracle-training.cc/oracle_tips_clean_up.htm clean up scripts] in his Oracle Tips article. From these I have created my own small commands (which lacks alot of path checks). They have worked for me so far but there is no guarantee that these will not destroy your database (or at least the data).

find $ORACLE_HOME -name '*.arc' -ctime +7 -exec rm {} \;
find $ORACLE_HOME -name '*.trc' -mtime +14 -exec rm {} \;
find $ORACLE_HOME -name '*.aud' -mtime +14 -exec rm {} \;