通過SQL*Plus遠端啟動Oracle資料庫例項

LuiseDalian發表於2014-04-27
有很多搞技術的朋友最近問我,通過客戶端的SQL*Plus能否遠端啟動Oracle例項呢?
有些人認為可以,而另一此則認為不可以.
檢視了官方文件中關於Oracle Net Service的部分內容後,從理論上確定是沒有問題的,而且給出了實現的方法.
實踐出真知,下面讓我們一起來完成這個實驗。

--1. 在伺服器端配置一個靜態監聽程式

LISTENER0 =

  (DESCRIPTION_LIST =

    (DESCRIPTION =

      (ADDRESS_LIST =

        (ADDRESS = (PROTOCOL = TCP)(HOST = S1011.cuug.net)(PORT = 1522))

      )

    )

  )

 

SID_LIST_LISTENER0 =

  (SID_LIST =

    (SID_DESC =

      (GLOBAL_DBNAME = TestDB11.cuug.net)

      (SID_NAME = TestDB11)

      (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)

    )

  ) 

 

--2. 啟動靜態監聽程式LISTENER0

[oracle@S1011:/u01/app/oracle/product/11.2.0/dbhome_1/network/admin]$ lsnrctl start LISTENER0

 

LSNRCTL for Solaris: Version 11.2.0.3.0 - Production on 01-MAR-2014 16:53:41

 

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

 

Starting /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...

 

TNSLSNR for Solaris: Version 11.2.0.3.0 - Production

System parameter file is /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=S1011.cuug.net)(PORT=1522)))

 

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=S1011.cuug.net)(PORT=1522)))

STATUS of the LISTENER

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

Alias                     LISTENER0

Version                   TNSLSNR for Solaris: Version 11.2.0.3.0 - Production

Start Date                01-MAR-2014 16:53:42

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/11.2.0/dbhome_1/network/admin/listener.ora

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=S1011.cuug.net)(PORT=1522)))

Services Summary...

Service "TestDB11.cuug.net" has 1 instance(s).

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

The command completed successfully 

 

--3. 配置客戶端的tnsnames.ora,新增如下內容

 

TESTDB11_STA_LSN =

  (DESCRIPTION =

    (ADDRESS_LIST =

      (ADDRESS = (PROTOCOL = TCP)(HOST = S1011.cuug.net)(PORT = 1522))

    )

    (CONNECT_DATA =

      (SERVICE_NAME = TestDB11.cuug.net)

    )

  )

 

-- 從客戶端遠端啟動Oracle例項

C:\Users\Administrator>sqlplus sys/sys@testdb11_sta_lsn as sysdba

 

SQL*Plus: Release 11.2.0.1.0 Production on 星期六 3 1 18:02:29 2014

 

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

 

已連線到空閒例程。

 

SQL> startup

ORACLE 例程已經動。

 

Total System Global Area  855982080 bytes

Fixed Size                  2230792 bytes

Variable Size             641730040 bytes

Database Buffers          209715200 bytes

Redo Buffers                2306048 bytes

資料庫裝完畢。

資料庫已經開啟。


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/17013648/viewspace-1150218/,如需轉載,請註明出處,否則將追究法律責任。

相關文章