Test Database
Switch to the root user to view Oracle-related processes
[Root @ Oracle10g bin] # ps aux | grep-ioracle | grep-V grep
Avahi 1453 0.0 0.1 27648 1036? S nov07 0: 00 avahi-daemon: Running [Oracle10g. Local]
Root 3183 0.0 0.0 161240 924 pts/0 s nov07 su Oracle
Oracle 3184 0.0 0.1 110420 1488 pts/0 S + nov07 bash
Oracle 22043 0.0 1.6 421284 17340? SS ora_pmon_ora10g
Oracle 22045 0.0 1.5 420108 15644? SS ora_psp0_ora10g
Oracle 22047 0.0 3.4 420108 35304? SS ora_mman_ora10g
Oracle 22049 0.0 3.8 422960 39224? SS ora_dbw0_ora10g
Oracle 22051 0.0 1.9 435660 19712? SS ora_lgwr_ora10g
Oracle 22053 0.0 2.2 421656 23372? SS ora_ckpt_ora10g
Oracle 22055 0.0 7.3 422720 74568? SS ora_smon_ora10g
Oracle 22057 0.0 2.2 420112 22768? SS ora_reco_ora10g
Oracle 22059 0.0 3.1 421740 32144? SS ora_cjq0_ora10g
[Oracle @ Oracle10g bin] $./sqlplus/nolog
SQL * Plus: Release 10.2.0.1.0-productionon Tue Nov 8 10:14:22 2011
Copyright (c) 1982,200 5, Oracle. All rights reserved.
SQL> connect sys/As sysdba
Enter password:
Error:
ORA-12162: TNS: Net servicename is incorrectly specified
Error: ORA-12162: TNS: net service name is incorrectly specified:
ORA-12154: TNS: cocould not resolve the connect identifier specified
Solution: ORA-12162 error caused by system environment variable oracle_sid not set
Export Sid
[Root @ Oracle10g bin] # grep SID/home/Oracle/. bash_profile
Export oracle_sid = ora10g
[Oracle @ Oracle10g bin] $ exportoracle_sid = ora10g
Log on again
[Oracle @ Oracle10g bin] $./sqlplus/assysdba
SQL * Plus: Release 10.2.0.1.0-productionon Tue Nov 8 10:28:24 2011
Copyright (c) 1982,200 5, Oracle. All rights reserved.
Connected:
Oracle Database 10g enterprise editionrelease 10.2.0.1.0-64bit Production
With the partitioning, OLAP and data miningoptions
SQL> connect sys/As sysdba
Enter password:
Connected.
SQL> Create Table EMP (myid INT );
Table created.
SQL> insert into EMP values (24 );
1 row created.
SQL> select * from EMP;
Myid
----------
24
SQL> drop table EMP;
Table dropped.
Configure Automatic startup
Step 1: modify the configuration file/etc/oratab
[Root @ Oracle10g bin] # vi/etc/oratab
Ora10g:/home/Oracle/product/10.2.0/db_1: N
Change n to Y
[Root @ Oracle10g bin] # grep "Y"/etc/oratab | grep-V "^ #"
Ora10g:/home/Oracle/product/10.2.0/db_1: Y
Step 2: Modify dbstart
/Home/Oracle/product/10.2.0/db_1/bin
[Oracle @ Oracle10g bin] $ VI dbstart
Original:
Oracle_home_listner =/Ade/vikrkuma_new/Oracle [between 70 and 80 rows]
After modification:
Oracle_home_listner = $ ORACLE_HOME
Or write it
Oracle_home_listner =/u01/APP/Oracle/product/10.2.0/db_1
Test whether dbstart is executed
[Oracle @ Oracle10g bin] $./dbstart
Failed to auto-start Oracle Net listeneusing/product/10.2.0/db_1/bin/tnslsnr
Processing database instance "ora10g": Log File/home/Oracle/product/10.2.0/db_1/startup. Log
[Oracle @ Oracle10g bin] $./LSNRCTL status
[Oracle @ Oracle10g bin] $ PS-EFW | grep listen | grep-V grep
Oracle 23398 1 0 nov07? 00:00:00/home/Oracle/product/10.2.0/db_1/bin/tnslsnr listener-inherit
Create Startup Script
[Root @ Oracle10g rc0.d] # vi/etc/init. d/dbora
#! /Bin/bash
#/Etc/init. d/dbora
# STARTUP script for Oracle databases
Export oracle_base =/oracle11g
Export ORACLE_HOME = $ oracle_base/Oracle
Export oracle_sid = 11g
Export Path = $ path: $ ORACLE_HOME/bin
Case "$1" in
Start)
Suoracle-c "$ ORACLE_HOME/bin/LSNRCTL start"
Echo-n "Starting ORACLE :"
Suoracle-C $ ORACLE_HOME/bin/dbstart
Touch/var/lock/Oracle
Echo "OK"
;;
Stop)
Echo-n "shutdown ORACLE :"
Suoracle-C $ ORACLE_HOME/bin/dbshut
Rm-F/var/lock/Oracle
Echo "OK"
;;
*)
Echo "Usage: 'basename $ 0' START | stop"
Exit 1
Esac
Exit 0
[Root @ Oracle10g rc0.d] # chmod-r 775/etc/init. d/dbora
[Root @ Oracle10g rc0.d] # ln-S/etc/init. d/dbora/etc/rc. d/rc0.d/k10dbora
[Root @ Oracle10g rc0.d] # ln-S/etc/init. d/dbora/etc/rc. d/rc1.d/k10dbora
[Root @ Oracle10g rc0.d] # ln-S/etc/init. d/dbora/etc/rc. d/rc2.d/k10dbora
[Root @ Oracle10g rc0.d] # ln-S/etc/init. d/dbora/etc/rc. d/rc3.d/s90dbora
[Root @ Oracle10g rc0.d] # ln-S/etc/init. d/dbora/etc/rc. d/rc4.d/s90dbora
[Root @ Oracle10g rc0.d] # ln-S/etc/init. d/dbora/etc/rc. d/rc5.d/s90dbora
[Root @ Oracle10g rc0.d] # ln-S/etc/init. d/dbora/etc/rc. d/rc6.d/k10dbora