DB Control 手动启动多个数据库
ORACLE数据库的手动启动及多个数据库手动全启动方法
其中的一些是我从网上及其他资料学习得来,先致以敬意!!呵呵!!大家相互学习,多指点!
1)在 $ORACLE_HOME/bin 下有一个shell脚本dbstart 。实际上它是调用了当时您在建数据库时,最后你用root脚本执行并生成的一个脚本:etc/oratab.这个oratab里面放了您所有的数据库,其形式为多行的:实例名:HOME地址:Y。默认最后一个是N。在dbstart脚本中,会循环查找oratab中的多个行,当遇到Y时,就启动这个库,如果是N,则不启动。
在10g中,这个脚本还自带了监听的自启动,所以您只要执行了这个脚本,就不用在执行监听的启动了。但您需要修改这个dbstart脚本的第78行,系统默认把监听的位置指向了:
( ----------没有修改脚本文件时执行此命令,说明命令用到/ade/vikrkuma_new/oracle/的内容
[oracle@localhost ~]$ dbstart
Failed to auto-start Oracle Net Listene using /ade/vikrkuma_new/oracle/bin/tnslsn)
ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle #我也不知ORACLE为何执行此无用目录!?你需要改为一下:
ORACLE_HOME_LISTNER=$ORACLE_HOME #如果您前面没有配$ORACLE_HOME,还可以接指向您的数据库程序存放地址。
===($ORACLE_HOME的设置在.bash_profile里,这个文件在我在安装时设置过,路径是/home/oracle/.bash_profile,这个文件是隐藏文件)
因此,在上面的修改中我直接用的$ORACLE_HOME
我想,既然这个dbstart中可以存放除启动以外的程序,如监听,那也应该可以存放其他程序,如企业管理器。一开始,我把EM的命令放在了监听命令上面,如果是您配置了SID,那么是可以启动成功的;但后来,我经过了几乎一天的测试,才发现这是个愚蠢的做法。应该把命令写进启动数据库的旁边,而不是监听旁边,因为监听是不分那个数据库的,只要执行一次。于是,我把命令放在了第135行,就是代码:echo "$0:Starting up database \"$ORACLE_SID\""的上上行。我添加了:
ORACLE_HOME/bin/emctl start dbconsole #启动企业管理器,加了此行后,在启动时,您会发现启动非常慢!就是因为EM启动慢的原因。当然,您还可以在此行后添加 iSQL的启动:
isqlplusctl start
当然,还建议您把相同位置的相反代码(stop)放进:dbshut 脚本中!
2)一般是执行:(在oracle用户下)
$ lsnrctl start
$ dbstart
$ emctl start dbconsole
$ isqlplusctl start
如果你有多个数据库,当执行完以上后,还需要设置ORACLE_SID参数,以启动另外一个数据库:
$export ORACLE_SID=Test001
$ lsnrctl start
$ dbstart
$ emctl start dbconsole
$ isqlplusctl start
如果想执行一个命令,就启动多个数据库,同时您的数据库是10g,那么您很幸运,您可以只需在oracle库所有者用户下执行一个命令:dbstart。
也可用第二种方法:单独启动相应的数据库入,如下面的第二个我的实例
利用 $export ORACLE_SID=Test001 命令切换到想的数据库,然后启动dbconsole、监听器、isqlplus(如果启动前一个数据库时启动过isqlplus,此时可以不执行)
3) 执行完上述命令后,进入浏览器,输入 如果只有一个数据库时,此时可登陆相应的 em console;如果有多个数据库时,则需要将端口号改为相应的数据库的端口号。数据库的端口号可以在$ORACLE_HOME/install/portlist.ini中可以查看到。(我安装的数据库是/u01/app/oracle/product/10.2.0/db_1/install/portlist.ini)
我实际运行命令:
1)方法一利用dbstart命令启动数据库
[oracle@localhost ~]$ lsnrctl
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 19-OCT-2008 12:45:10
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Welcome to LSNRCTL, type "help" for information.
LSNRCTL> start
Starting /u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 10.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/10.2.0/db_1/network/admin/liste ner.ora
Log messages written to /u01/app/oracle/product/10.2.0/db_1/network/log/listener .log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(P ORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 19-OCT-2008 12:45:13
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/10.2.0/db_1/network/admin/list ener.ora
Listener Log File /u01/app/oracle/product/10.2.0/db_1/network/log/listen er.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
LSNRCTL>
[oracle@localhost ~]$ dbstart
Processing Database instance "orc1": log file /u01/app/oracle/product/10.2.0/db_ 1/startup.log
Processing Database instance "Test001": log file /u01/app/oracle/product/10.2.0/ db_1/startup.log
[oracle@localhost ~]$
[oracle@localhost ~]$ emctl start emconsole
TZ set to ROC
Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0
Copyright (c) 1996, 2005 Oracle Corporation. All rights reserved.
Invalid arguments
Unknown command option start
Usage::
Oracle Enterprise Manager 10g Database Control commands:
emctl start| stop| status| setpasswd dbconsole
emctl secure
emctl set ssl test|off|on em
emctl blackout options can be listed by typing "emctl blackout"
emctl config options can be listed by typing "emctl config"
emctl secure options can be listed by typing "emctl secure"
emctl ilint options can be listed by typing "emctl ilint"
emctl deploy options can be listed by typing "emctl deploy"
[oracle@localhost ~]$ emctl start dbconsole
TZ set to ROC
Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0
Copyright (c) 1996, 2005 Oracle Corporation. All rights reserved.
Starting Oracle Enterprise Manager 10g Database Control ...................... s tarted.
------------------------------------------------------------------
Logs are generated in directory /u01/app/oracle/product/10.2.0/db_1/localhost.lo caldomain_orc1/sysman/log
[oracle@localhost ~]$ isqlplusctl start
iSQL*Plus 10.2.0.1.0
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Starting iSQL*Plus ...
iSQL*Plus started.
[oracle@localhost ~]$ export ORACLE_SID=Test001
[oracle@localhost ~]$ dbstart
Processing Database instance "orc1": log file /u01/app/oracle/product/10.2.0/db_ 1/startup.log
Processing Database instance "Test001": log file /u01/app/oracle/product/10.2.0/ db_1/startup.log
[oracle@localhost ~]$ lsnrctl start
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 19-OCT-2008 13:07:12
Copyright (c) 1991, 2005, Oracle. All rights reserved.
TNS-01106: Listener using listener name LISTENER has already been started
[oracle@localhost ~]$ emctl start dbconsole
TZ set to ROC
Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0
Copyright (c) 1996, 2005 Oracle Corporation. All rights reserved.
Starting Oracle Enterprise Manager 10g Database Control .................... sta rted.
------------------------------------------------------------------
Logs are generated in directory /u01/app/oracle/product/10.2.0/db_1/localhost.lo caldomain_Test001/sysman/log
[oracle@localhost ~]$
2)方法二单独启动数据库
[oracle@localhost ~]$ lsnrctl start
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 19-OCT-2008 14:15:42
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Starting /u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 10.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/10.2.0/db_1/network/admin/liste ner.ora
Log messages written to /u01/app/oracle/product/10.2.0/db_1/network/log/listener .log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(P ORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 19-OCT-2008 14:15:44
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/10.2.0/db_1/network/admin/list ener.ora
Listener Log File /u01/app/oracle/product/10.2.0/db_1/network/log/listen er.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[oracle@localhost ~]$ emctl start dbconsole
TZ set to ROC
Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0
Copyright (c) 1996, 2005 Oracle Corporation. All rights reserved.
Starting Oracle Enterprise Manager 10g Database Control ........................ started.
------------------------------------------------------------------
Logs are generated in directory /u01/app/oracle/product/10.2.0/db_1/localhost.lo caldomain_orc1/sysman/log
[oracle@localhost ~]$ sqlplus "/ as sysdba"
SQL*Plus: Release 10.2.0.1.0 - Production on Sun Oct 19 14:18:22 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 285212672 bytes
Fixed Size 1218968 bytes
Variable Size 83887720 bytes
Database Buffers 192937984 bytes
Redo Buffers 7168000 bytes
Database mounted.
Database opened.
SQL> quit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Pr oduction
With the Partitioning, OLAP and Data Mining options
[oracle@localhost ~]$ isqlplusctl start
iSQL*Plus 10.2.0.1.0
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Starting iSQL*Plus ...
iSQL*Plus started.
[oracle@localhost ~]$ export ORACLE_SID=Test001
[oracle@localhost ~]$ lsnrctl start
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 19-OCT-2008 14:22:04
Copyright (c) 1991, 2005, Oracle. All rights reserved.
TNS-01106: Listener using listener name LISTENER has already been started
[oracle@localhost ~]$ sqlplus "/ as sysdba"
SQL*Plus: Release 10.2.0.1.0 - Production on Sun Oct 19 14:22:36 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 285212672 bytes
Fixed Size 1218968 bytes
Variable Size 88082024 bytes
Database Buffers 188743680 bytes
Redo Buffers 7168000 bytes
Database mounted.
Database opened.
SQL> quit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Pr oduction
With the Partitioning, OLAP and Data Mining options
[oracle@localhost ~]$ emctl start dbconsole
TZ set to ROC
Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0
Copyright (c) 1996, 2005 Oracle Corporation. All rights reserved.
Starting Oracle Enterprise Manager 10g Database Control ..................... started.
------------------------------------------------------------------
Logs are generated in directory /u01/app/oracle/product/10.2.0/db_1/localhost.localdomain_Test001/sysman/log
[oracle@localhost ~]$ isqlplusctl start
iSQL*Plus 10.2.0.1.0
Copyright (c) 2003, 2005, Oracle. All rights reserved.
iSQL*Plus instance on port 5560 is already running ...