ORACLE NAMES

(一)DB_NAME、DBID与SID

DB_NAME是CREATE DATABASE时指定,最多8个字符,通过初始参数DB_NAME查看

DB_NAME/DBID记录在数据文件,REDO LOG及控制文件中

DB_NAME specifies a database identifier of up to 8 characters. This parameter must be specified and must correspond to the name specified in the CREATE DATABASE statement.

During database creation, the name provided for DB_NAME is recorded in the datafiles, redo log files, and control file of the database. If during database instance startup the value of the DB_NAME parameter (in the parameter file) and the database name in the control file are not the same, the database does not start.

DBID (Database Identifier)是DB_NAME内部表示,DBID是唯一的,可以理解为DB_NAME 表示姓名,DBID表示身份证,对于不同的数据库DB_NAME可以相同,但它们的DBID 是不同的(对于同一数据库DB_NAME不能相同,否则同时启动会报错:ORA-01102: cannot mount database in EXCLUSIVE mode)

An internal, uniquely generated number that differentiates databases. Oracle creates this number automatically when you create the database.

更改DB_NAME及DBID可以通过nid命令在mount下更改,查看:

select dbid,name from v$database;

System Identifier(SID)用于标识本机上的数据库,一般值同DB_UNIQUE_NAME. 另注意INSTANCE_NAME的默认值为SID.

The system identifier (SID) identifies a specific database instance. The SID uniquely distinguishes the instance from any other instance on the same computer. Each database instance requires a unique SID and database name. In most cases, the SID equals the database name portion of the global database name.

SID相关共享内存及密码、参数文件名字

On UNIX and Linux, Oracle Database uses the SID and Oracle home values to create a key to shared memory. Also, Oracle Database uses the SID by default to locate the initialization parameter file. On most platforms, the ORACLE_SID environment variable sets the SID, whereas the ORACLE_HOME variable sets the Oracle home.

ORACLE监听会把监听服务转为对应的ORACE_HOME与ORACLE_SID

When connecting to an instance, clients can specify the SID in an Oracle Net connection or use a net service name. Oracle Database converts a service name into an ORACLE_HOME and ORACLE_SID.

(二)DB_UNIQUE_NAME、DB_DOMAIN与SERVICE_NAMES、INSTANCE_NAME

ORACLE通过GLOBAL DATABASE NAME来标识数据库(在安装数据库时指定),它默认由database name(DB_UNIQUE_NAME)与database domain(DB_DOMAIN)组成。这两个参数更改要重启数据库

The Oracle Database software identifies a database by its global database name. A global database name consists of the database name and database domain.

The DB_UNIQUE_NAME parameter and the DB_DOMAIN name parameter combine to create the global database name value assigned to the SERVICE_NAMES parameter in the initialization parameter file.

通常DB_DOMAIN与数据库所在network domain一致(非必须),表示所在网络。而DB_UNIQUE_NAME用于在此网络中唯一标识的数据库。DB_UNIQUE_NAME最多30字符而DB_NAME最多只有8字符。DB_UNIQUE_NAME与DB_NAME值无关

Usually, the database domain is the same as the network domain, but it need not be.

The global database name uniquely distinguishes a database from any other database in the same network.

For example: sales.us.example.com

sales.us is the name of the database. The database name, DB_UNIQUE_NAME, portion is a string of no more than 30 characters

sales.us is also the DB_NAME. The DB_NAME initialization parameter specifies a database identifier of up to eight characters. However, the DB_NAME parameter need not necessarily be the first eight characters of DB_UNIQUE_NAME.

example.com is the database domain in which the database is located. In this example, the database domain equals the network domain. Together, the database name and the database domain make the global database name unique.

值得注意的是默认的SERVICE_NAMES是由DB_UNIQUE_NAME+DB_DOMAIN组成的,但参数是可更改的,所以查看GLOBAL DATABASE NAME还是通过DB_UNIQUE_NAME与DB_DOMAIN的值来判断(不是初始参数GLOBAL_NAMES),或查看视图:select * from GLOBAL_NAME;

也可以更改默认GLOBAL DATABASE NAME值(建议还是通过上面两个参数更改):

ALTER DATABASE RENAME GLOBAL_NAME TO orcl.example.com;

SERVICE_NAMES会被自动动态注册到监听作为监听服务

GLOAL DATABASE NAME永远自动动态注册到监听服务(不论SERVICE_NAMES是否包含)

SERVICE_NAMES specifies one or more names by which clients can connect to the instance. The instance registers its service names with the listener. When a client requests a service, the listener determines which instances offer the requested service and routes the client to the appropriate instance.

这里注意如果SERVICE_NAMES不包含DB_DOMAIN会被加上后注册到监听,如果包含不加

If you do not qualify the names in this parameter with a domain, Oracle qualifies them with the value of the DB_DOMAIN parameter. If DB_DOMAIN is not specified, then no domain will be applied to the non-qualified SERVICE_NAMES values.

INSTANCE_NAME又把SERVICE_NAMES进行负载均衡。RAC下节点实例名不能相同

INSTANCE_NAME默认值为SID

In a Real Application Clusters environment, multiple instances can be associated with a single database service. Clients can override Oracle's connection load balancing by specifying a particular instance by which to connect to the database. INSTANCE_NAME specifies the unique name of this instance.

(三)SID_NAME、GLOBAL_DBNAME

SID_NAME与GLOBAL_DBANME均用于静态监听,前者指定SID,后者指定监听服务名

SID_LIST_LISTENER =

  (SID_LIST =

    (SID_DESC =

      (SID_NAME = PLSExtProc)

      (ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)

      (PROGRAM = extproc)

    )

    (SID_DESC =

      (SID_NAME = orcl)

      (ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)

      (GLOBAL_DBNAME = orcl)

    ) 

)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值