How to start XE by command

 

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)
    )
  )

  

posted on 2013-08-12 13:14  子虚乌有  阅读(325)  评论(0)    收藏  举报