Nethence Newdoc Olddoc Lab Your IP BBDock  


Warning: those guides are mostly obsolete, please have a look at the new documentation.

UnixWindowsOracleObsoleteHardwareDIYMechanicsScriptsConfigs

Oracle Basics
 
 
Connect
UNIX
Look for a configured instance and connect to it,
cat /etc/oratab
. oraenv
sqlplus / as sysdba
#sqlplus USERNAME/PASSWORD
#sqlplus USERNAME/PASSWORD@dbname
Note. the latter will use the listener
 
Windows
Look for a configured instance,
services.msc > OracleServiceXXXX
note. if you got Sys Internals, you may simply do,
psservice config oracle
and connect to it,
cmd
set ORACLE_SID=dbname
sqlplus / as sysdba
#sqlplus USERNAME/PASSWORD
#sqlplus USERNAME/PASSWORD@dbname
 
Misc
Note. for Oracle <10g,
sqlplus /nolog
connect / as sysdba
--connect USERNAME/PASSWORD
--connect USERNAME/PASSWORD@dbname
Ref. http://www.orafaq.com/wiki/SQL*Plus_FAQ
 
 
Start
Start a database,
startup
Note. Oracle first looks for an spfile, then if there isn't any, for a pfile.
Note. to start with an pfile in some alternate location,
startup mount pfile=/path/to/altinit.ora
 
Start the listener,
lsnrctl start
 
 
Stop
Shutdown a database,
shutdown immediate
Note. or "alter database close" and "shutdown"
Note. in the worst case there's "shutdown abord"
 
To shutdown the listener,
lsnrctl stop
 
 
Checks
See what's installed,
cat /etc/oraInst.loc
 
Check what databases are started at boot,
cat /etc/oratab
#cat /var/opt/oracle/oratab
 
Check which oracle processes are running,
ps aux | grep ora_
ps aux | grep tns
#ps -ef | grep ora_
#ps -ef | grep tns
 
Check listener's status,
lsnrctl status
netstat -an --inet --inet6 | grep 1521
 
Check for listener and tnsnames configuration,
vi $ORACLE_HOME/network/admin/listener.ora
vi $ORACLE_HOME/network/admin/tnsnames.ora
 
Check for Enterprise manager,
emctl status dbconsole
netstat -an --inet --inet6 | grep LISTEN
 
Look for databases' datafiles,
ls -l /oracle/oradata/
 
Check for databases' spfile and pfile (the latter doesn't necessarily exist),
. oraenv
ls -l $ORACLE_HOME/dbs/spfile$ORACLE_SID.ora
ls -l $ORACLE_HOME/dbs/init$ORACLE_SID.ora
 

(obsolete, see the new doc)