Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2323162
  • 博文数量: 535
  • 博客积分: 8689
  • 博客等级: 中将
  • 技术积分: 7066
  • 用 户 组: 普通用户
  • 注册时间: 2010-11-26 10:00
文章分类

全部博文(535)

文章存档

2024年(4)

2023年(4)

2022年(16)

2014年(90)

2013年(76)

2012年(125)

2011年(184)

2010年(37)

分类: Oracle

2013-01-18 10:07:04



 

Oracle 多实例启动实验


 

目录

 TOC \o "1-3" \h \z \u

 


一、目的

在同一系统下启动多个oracle实例。

 

二、环境

vmware虚拟出一台linux

1 .linux VerRed Hat Enterprise Linux AS release 4 (Nahant Update 8)( 2.6.9-89.ELsmp) 32BIT

2. Oracle VerRelease 10.2.0.1.0

3. Instance one: oral

     Instance two: orcl

三、过程

1.系统

a./etc/hosts

# Do not remove the following line, or various programs

# that require network functionality will fail.

127.0.0.1               localhost.localdomain localhost

 

192.168.0.42            dbserver

2.手动启动多实例

a. 启动监听

 [oracle@dbserver ~]$ /u01/app/oracle/product/10.2.0/db_1/bin/lsnrctl start

 

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 18-SEP-2010 10:44:24

 

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/listener.ora

Log messages written to /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbserver)(PORT=1521)))

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))

 

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dbserver)(PORT=1521)))

STATUS of the LISTENER

------------------------

Alias                     LISTENER

Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - Production

Start Date                18-SEP-2010 10:44:24

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/listener.ora

Listener Log File         /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbserver)(PORT=1521)))

  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))

Services Summary...

Service "PLSExtProc" has 1 instance(s).

  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...

The command completed successfully

b. 启动oral

[oracle@dbserver ~]$ export ORACLE_SID=oral

[oracle@dbserver ~]$ env | grep SID   

ORACLE_SID=oral

[oracle@dbserver ~]$ /u01/app/oracle/product/10.2.0/db_1/bin/sqlplus /nolog  

 

SQL*Plus: Release 10.2.0.1.0 - Production on Sat Sep 18 10:46:02 2010

 

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

 

SQL> conn /as sysdba

Connected to an idle instance.

SQL> startup

ORACLE instance started.

 

Total System Global Area  167772160 bytes

Fixed Size                  1218316 bytes

Variable Size              75499764 bytes

Database Buffers           88080384 bytes

Redo Buffers                2973696 bytes

Database mounted.

Database opened.

SQL>

c. 启动orcl

[oracle@dbserver ~]$ export ORACLE_SID=orcl   

[oracle@dbserver ~]$ env | grep SID   

ORACLE_SID=orcl

[oracle@dbserver ~]$ /u01/app/oracle/product/10.2.0/db_1/bin/sqlplus /nolog

 

SQL*Plus: Release 10.2.0.1.0 - Production on Sat Sep 18 10:47:51 2010

 

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

 

SQL> conn /as sysdba

Connected to an idle instance.

SQL> startup

ORACLE instance started.

 

Total System Global Area  167772160 bytes

Fixed Size                  1218316 bytes

Variable Size              92276980 bytes

Database Buffers           71303168 bytes

Redo Buffers                2973696 bytes

Database mounted.

Database opened.

SQL>

d. 查看运行实例

 [oracle@dbserver ~]$ /u01/app/oracle/product/10.2.0/db_1/bin/lsnrctl status

 

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 18-SEP-2010 10:48:35

 

Copyright (c) 1991, 2005, Oracle.  All rights reserved.

 

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dbserver)(PORT=1521)))

STATUS of the LISTENER

------------------------

Alias                     LISTENER

Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - Production

Start Date                18-SEP-2010 10:44:24

Uptime                    0 days 0 hr. 4 min. 10 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/listener.ora

Listener Log File         /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbserver)(PORT=1521)))

  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))

Services Summary...

Service "LHYAOO" has 1 instance(s).

  Instance "oral", status READY, has 1 handler(s) for this service...

Service "LHYAOO_XPT" has 1 instance(s).

  Instance "oral", status READY, has 1 handler(s) for this service...

Service "PLSExtProc" has 1 instance(s).

  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...

Service "PSCSH" has 1 instance(s).

  Instance "orcl", status READY, has 1 handler(s) for this service...

Service "PSCSH_XPT" has 1 instance(s).

  Instance "orcl", status READY, has 1 handler(s) for this service...

Service "oralXDB" has 1 instance(s).

  Instance "oral", status READY, has 1 handler(s) for this service...

Service "orclXDB" has 1 instance(s).

  Instance "orcl", status READY, has 1 handler(s) for this service...

The command completed successfully

[oracle@dbserver ~]$

3.自动启动多实例

a. 配备oratab

 [oracle@dbserver ~]$ cat /etc/oratab

#

 

 

 

# This file is used by ORACLE utilities.  It is created by root.sh

# and updated by the Database Configuration Assistant when creating

# a database.

 

# A colon, ':', is used as the field terminator.  A new line terminates

# the entry.  Lines beginning with a pound sign, '#', are comments.

#

# Entries are of the form:

#   $ORACLE_SID:$ORACLE_HOME::

#

# The first and second fields are the system identifier and home

# directory of the database respectively.  The third filed indicates

# to the dbstart utility that the database should , "Y", or should not,

# "N", be brought up at system boot time.

#

# Multiple entries with the same $ORACLE_SID are not allowed.

#

#

oral:/u01/app/oracle/product/10.2.0/db_1:Y

orcl:/u01/app/oracle/product/10.2.0/db_1:Y

b. 配置自启动服务

[root@dbserver init.d]# cat /etc/init.d/oracle

#!/bin/sh

. /etc/rc.d/init.d/functions

 

ORACLE_BASE=/u01/app/oracle

ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1

LSNR_PORT=1521

ORACLE_USER=oracle

 

start()

{

    su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl start"

    su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbstart"

}

 

stop()

{

    su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbshut"

    su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl stop"

}

 

status()

{

    su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl status"

}

 

case "$1" in

  start)

        start

        ;;

  stop)

        stop

        ;;

  restart)

        stop

        start

        ;;

  status)

        status oracle

        ;;

  *)

        echo $"Usage: $0 {start|stop|restart|status}"

        exit 1

esac

 

exit 0

 

c. 运行服务

 [root@dbserver init.d]# /etc/init.d/oracle start

 

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 18-SEP-2010 10:58:14

 

Copyright (c) 1991, 2005, Oracle.  All rights reserved.

 

TNS-01106: Listener using listener name LISTENER has already been started

Failed to auto-start Oracle Net Listene using /ade/vikrkuma_new/oracle/bin/tnslsnr

Processing Database instance "oral": log file /u01/app/oracle/product/10.2.0/db_1/startup.log

Processing Database instance "orcl": log file /u01/app/oracle/product/10.2.0/db_1/startup.log

d. 查看运行实例

[root@dbserver init.d]# /etc/init.d/oracle status

 

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 18-SEP-2010 10:58:39

 

Copyright (c) 1991, 2005, Oracle.  All rights reserved.

 

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dbserver)(PORT=1521)))

STATUS of the LISTENER

------------------------

Alias                     LISTENER

Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - Production

Start Date                18-SEP-2010 10:44:24

Uptime                    0 days 0 hr. 14 min. 15 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/listener.ora

Listener Log File         /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbserver)(PORT=1521)))

  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))

Services Summary...

Service "LHYAOO" has 1 instance(s).

  Instance "oral", status READY, has 1 handler(s) for this service...

Service "LHYAOO_XPT" has 1 instance(s).

  Instance "oral", status READY, has 1 handler(s) for this service...

Service "PLSExtProc" has 1 instance(s).

  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...

Service "PSCSH" has 1 instance(s).

  Instance "orcl", status READY, has 1 handler(s) for this service...

Service "PSCSH_XPT" has 1 instance(s).

  Instance "orcl", status READY, has 1 handler(s) for this service...

Service "oralXDB" has 1 instance(s).

  Instance "oral", status READY, has 1 handler(s) for this service...

Service "orclXDB" has 1 instance(s).

  Instance "orcl", status READY, has 1 handler(s) for this service...

The command completed successfully


阅读(1618) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~