How to start XE by command

本文介绍了如何在Windows 7环境下为Oracle XE 10g配置监听器,并通过设置环境变量及配置文件实现与Oracle 11g共存的方法。此外,还详细记录了启动过程及数据库连接测试步骤。

 

start xe by command (sqlplus)  in my environment
windows7 xe 10.2.0.1.0

Since there are Oracle 11 on my machine, so i use  set command to set temp variable 

1. Start lsnrctl.exe

set ORACLE_SID=XE
set oracle_home=C:\oraclexe\app\oracle\product\10.2.0\server
SET TNS_ADMIN=C:\oraclexe\app\oracle\product\10.2.0\server\NETWORK\ADMIN


C:\oraclexe\app\oracle\product\10.2.0\server\BIN\TNSLSNR.EXE

file : listener.ora
--------------------------------------------------------------------------
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = C:\oraclexe\app\oracle\product\10.2.0\server)
      (PROGRAM = extproc)
    )
    (SID_DESC =
      (SID_NAME = CLRExtProc)
      (ORACLE_HOME = C:\oraclexe\app\oracle\product\10.2.0\server)
      (PROGRAM = extproc)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
      (ADDRESS = (PROTOCOL = TCP)(HOST = hostname)(PORT = 1521))
    )
  )

DEFAULT_SERVICE_LISTENER = (XE)
--------------------------------------------------------------------------


Test lsnrctl :
C:\Users\username>C:\oraclexe\app\oracle\product\10.2.0\server\BIN\LSNRCTL.EXE

LSNRCTL for 32-bit Windows: Version 10.2.0.1.0 - Production on 05-AUG-2013 09:51:47

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

Welcome to LSNRCTL, type "help" for information.

LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Production
Start Date                05-AUG-2013 09:49:18
Uptime                    1 days 0 hr. 27 min. 52 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Default Service           XE
Listener Parameter File   C:\oraclexe\app\oracle\product\10.2.0\server\NETWORK\ADMIN\listener.ora
Listener Log File         C:\oraclexe\app\oracle\product\10.2.0\server\network\log\listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC_FOR_XEipc)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=machine_name)(PORT=1521)))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
  Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
LSNRCTL>


2. Start  Oracle.exe

set ORACLE_SID=XE
set oracle_home=C:\oraclexe\app\oracle\product\10.2.0\server
SET TNS_ADMIN=C:\oraclexe\app\oracle\product\10.2.0\server\NETWORK\ADMIN

c:\oraclexe\app\oracle\product\10.2.0\server\bin\ORACLE.EXE XE

file: sqlnet.ora
--------------------------------------------------------------------------
# This file is actually generated by netca. But if customers choose to 
# install "Software Only", this file wont exist and without the native 
# authentication, they will not be able to connect to the database on NT.

SQLNET.AUTHENTICATION_SERVICES = (NTS)

#NAMES.DEFAULT_DOMAIN = world
#SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, LDAP, ONAMES, HOSTNAME)
--------------------------------------------------------------------------


3.Start Oracle XE
set oracle_home=C:\oraclexe\app\oracle\product\10.2.0\server
SET TNS_ADMIN=C:\oraclexe\app\oracle\product\10.2.0\server\NETWORK\ADMIN

C:\oraclexe\app\oracle\product\10.2.0\server\BIN>sqlplus /nolog
SQL> connect sys/iris as sysdba
Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area  314572800 bytes
Fixed Size                  1287184 bytes
Variable Size             230689776 bytes
Database Buffers           79691776 bytes
Redo Buffers                2904064 bytes
Database mounted.
Database opened.

4.Test DataBase connect
C:\Users>tnsping xe

TNS Ping Utility for 32-bit Windows: Version 11.2.0.1.0 - Production on 06-AUG-2013 10:49:46

Copyright (c) 1997, 2010, Oracle.  All rights reserved.

Used parameter files:
C:\ORABASE\ORA11g\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=hostname) (PORT=1521)) (CONNECT_DATA= (SERVER=dedicated) (SERVICE_NAME=XE)))
OK (1150 msec)

C:\Users>sqlplus sys/iris@xe as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Tue Aug 6 10:49:58 2013

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

Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production

SQL> exit
Disconnected from Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production

From file tnsnames.ora:
XE.WORLD=
  (DESCRIPTION=
    (ADDRESS=
      (PROTOCOL=TCP)
      (HOST=machine_name)
      (PORT=1521)
    )
    (CONNECT_DATA=
      (SERVER=dedicated)
      (SERVICE_NAME=XE)
    )
  )

  

转载于:https://www.cnblogs.com/cquccy/p/3252733.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值