首先介绍几个关于Oracle的基本概念:instance、SID和ORACLE_SID。

instance(Oracle官方给出的定义)

Every running Oracle database is associated with

an Oracle instance. When a database is started on a database server

(regardless of the type of computer), Oracle allocates a memory

area called the System Global Area

(SGA) and starts an Oracle process. This

combination of the SGA and an Oracle process is called an instance.

The memory and the process of an instance manage the associated

database's data efficiently and serve the one or more users of the

database.

system identifier (SID)(同样是Oracle官方给出的定义)

A unique name for an

Oracleinstance.(前面的一句是重点,后面的以我们现在讨论的话题没有直接的关系)

To switch between Oracle

databases, users must specify the desired SID. The SID is included

in theCONNECT DATA

ORACLE_SID (同样是Oracle官方给出的定义)

Specifies name of

Oracle9i database instance on

host computer. The value of this parameter is the SID for the

instance. Default value is specified by entry in the Database

Identification window of Oracle Universal

Installer.(最后一句说:ORACLE_SID)。

ORACLE_SID的值会保存在(注册表)中,当你把注册表中ORACLE_SID的值清空的时候,系统的默认值是你安装Oracle时在“数据库标识”窗口所输入的SID的值。

从上面的定义,我们可以很清楚地知道:SID是Oracle数据库实例的唯一名称标识(A unique name for an

Oracleinstance.)。

了解了上面的概念之后,我们可以来讨论一下SID和ORACLE_SID的区别了。首先,我们是通过Oracle实例来完成对Oracle数据库的管理的。而我们又知道SID是Oracle实例的唯一名字标识。换言而言之,我们是通过SID来指定我们将要进行管理的数据库是数据库系统中的哪个数据库的。这也是为什么需要SID的一个重要的原因。那么,ORACLE_SID呢?别急,让我们再来看一段Oracle的官方提供文字:

Updating ORACLE_SID in the Registry

If this is the first database on the system or if you

intend to make the new database the default database, then you must

make a change in theregistry.

1.

Start Registry Editor at the command prompt:

2.C:\> regedt32

The Registry Editor window appears.

2.

Choose

subkey\HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\HOME0for the first Oracle home on your computer. For subsequent

installations to different Oracle homes on the same computer, the

path

is\HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\HOMEIDwhere ID is the unique number identifying the Oracle

home.

See

Also:

"Configuration Parameters

and the Registry" inOracle9i

Database Getting Started for

Windowsfor

more information on subkey locations

formultiple

Oracle homes

3.

Locate

parameterORACLE_SIDon the right side of the Registry Editor

window.

4.

Double-click the parameter name and change the data to the

new SID, which

isprodin this example.

If you do not yet have

parameterORACLE_SID, because this is the first database on your

system, then you must create it.

To create

parameterORACLE_SID:

1.

Choose Add Value from the Edit menu.

The Add Value dialog box appears:

2.

EnterORACLE_SIDin the Value Name text box.

3.

SelectREG_EXPAND_SZ(for an expandable string) in the Data Type list

box.

4.

Click OK.

A string editor dialog box appropriate for the data type

appears:

5.

Enterprodin the String Editor dialog box.

6.

Click OK.

Registry Editor adds

parameterORACLE_SID.

7.

Choose Exit from the Registry menu.

Registry Editor exits.

看完这段说明,我们可以看到:如果你想让你新建的数据库成为Oracle服务器默认的数据库(即是当你不指定要连接的数据库(实例)时,Oracle服务器默认帮你连接的数据库(实例)),你必须修改注册表中ORACLE_SID的值——把ORACLE_SID的值设置为你新建的数据库的实例名。(if you intend to make the new database the default

database, then you must make a change in

theregistry.)。从上面的表述,我们不难发现:ORACLE_SID是用来指定Oracle服务器默认的数据库(实例)的。

现在,我们可以很清楚地看到SID和ORACLE_SID的区别了。

ps:我是Oracle数据库初学者,如果上文有什么错误,欢迎各位指出。谢谢!!!

最后,附上Oracle9iDatabase Online

Documentation(Release 2

(9.2))的链接:

Logo

DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。

更多推荐