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 database instance

Setup paths and SID

1
2
3
export ORACLE_HOME=/usr/oracle/Ora901
export PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_SID=mysid

Start TNS Listner

1
lsnrctl start</bash>

Startup the instance

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
$ 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

1
2
3
export ORACLE_HOME=/usr/oracle/Ora901
export PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_SID=mysid

Stop the instance

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
$ 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

1
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 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).

1
2
3
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 {} \;