切换到root用户查看oracle相关进程
[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 0:00 su oracle
oracle 3184 0.0 0.1 110420 1488 pts/0 S+ Nov07 0:00 bash
oracle 22043 0.0 1.6 421284 17340 ? Ss 09:56 0:00 ora_pmon_ora10g
oracle 22045 0.0 1.5 420108 15644 ? Ss 09:56 0:00 ora_psp0_ora10g
oracle 22047 0.0 3.4 420108 35304 ? Ss 09:56 0:00 ora_mman_ora10g
oracle 22049 0.0 3.8 422960 39224 ? Ss 09:56 0:00 ora_dbw0_ora10g
oracle 22051 0.0 1.9 435660 19712 ? Ss 09:56 0:00 ora_lgwr_ora10g
oracle 22053 0.0 2.2 421656 23372 ? Ss 09:56 0:00 ora_ckpt_ora10g
oracle 22055 0.0 7.3 422720 74568 ? Ss 09:56 0:00 ora_smon_ora10g
oracle 22057 0.0 2.2 420112 22768 ? Ss 09:56 0:00 ora_reco_ora10g
oracle 22059 0.0 3.1 421740 32144 ? Ss 09:56 0:00 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, 2005, Oracle. All rights reserved.
SQL> connect sys / as sysdba
Enter password:
ERROR:
ORA-12162: TNS:net servicename is incorrectly specified
报错:ORA-12162: TNS:net service name is incorrectly specified:
ORA-12154: TNS:could not resolve the connect identifier specified
解决方案:因未设置系统环境变量ORACLE_SID导致ORA-12162错误的
导出SID
[root@oracle10g bin]# grep SID/home/oracle/.bash_profile
export ORACLE_SID=ora10g
[oracle@oracle10g bin]$ exportORACLE_SID=ora10g
重新登录
[oracle@oracle10g bin]$ ./sqlplus / assysdba
SQL*Plus: Release 10.2.0.1.0 - Productionon Tue Nov 8 10:28:24 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
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.
第一步:修改配置文件/etc/oratab
[root@oracle10g bin]# vi /etc/oratab
ora10g:/home/oracle/oracle/product/10.2.0/db_1:N
将N改为Y
[root@oracle10g bin]# grep "Y"/etc/oratab |grep -v "^#"
ora10g:/home/oracle/oracle/product/10.2.0/db_1:Y
第二步:修改dbstart
/home/oracle/oracle/product/10.2.0/db_1/bin
[oracle@oracle10g bin]$ vi dbstart
原:
ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle [70—80行之间]
改后:
ORACLE_HOME_LISTNER=$ORACLE_HOME
或者写成
ORACLE_HOME_LISTNER=/u01/app/oracle/product/10.2.0/db_1
测试dbstart是否执行
[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/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/oracle/product/10.2.0/db_1/bin/tnslsnr LISTENER -inherit
创建启动脚本
[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