SID、ORACLE_SID、INSTANCE_NAME、DB_NAME、SERVER_NAMES、GLOBAL_DBNAME等区别

监听中态注册时的服务名(即lsnrctl status显示的的service对应的名称):
优先级别service_names.db_domain=db_unique_name.db_domain>db_name.db_domain
如果有参数值service_names\db_unique_name,
则拼接service_names、db_unique_name参数值和db_domain参数值注册到监听,即两个值
如果只有参数值service_names,且值和db_name值不一样
则拼接service_names、db_name参数值和db_domain参数值注册到监听,即两个值
如果只有参数值db_unique_name,且值和db_name值不一样
则拼接db_unique_name参数值和db_domain参数值注册到监听,即一个值

datagard环境:所以编辑tnsname.ora时,tns中standby的service_name=db_unique_name.db_domain即可(primary库一般不设置db_unique_name,这样primary库的db_unique_name就默认为db_name)


监听中态注册时的服务名(即lsnrctl status显示的的service对应的名称):
使用listener.ora中的GLOBAL_DBNAME,如果listener.ora中没有GLOBAL_DBNAME,则使用listener.ora中的SID_NAME


 

SID:非参数,字面意思就是System Identifier,存放在tnsname.ora中匹配服务器listener.ora中的sid_name

 

SID_NAME:非参数,存在在listener.ora中的静态监听配置中区分大小写,来自Instance_name而非ORACLE_SID,因为lsntctl时显示的SID_NAME就是Instance(如果没service_name、db_unique_name参数则lsnrctl 显示的Service也是SID_NAME)
listener.ora File Parameter(SID_NAME)
The Oracle system identifier (SID) of the instance. You can obtain the SID value from the INSTANCE_NAME parameter in the initialization parameter file.
listener.ora文件参数(SID_NAME)
实例的Oracle系统标识符(SID)。 您可以从初始化参数文件中的INSTANCE_NAME参数获取SID值。
如果没有区分大小写Service、Instance都是orcl,但是实际
INSTANCE_NAME是ORCL,rman使用tns配置SERVICE_NAME为orcl或ORCL登录时,不会报tns或lsn的错误(因为SERVICE_NAME不区分大小写),但是会报错ORA-01017: invalid username/password; logon denied
例子1:
listener.ora配置SID_NAME=prod2_std,但是参数instance_name是PROD2_STD,启动实例到nomount状态,则重启监听,信息为
Service "prod2_std" has 2 instance(s).
  Instance "PROD2_STD", status BLOCKED, has 1 handler(s) for this service...
  Instance "prod2_std", status UNKNOWN, has 1 handler(s) for this service...
这时rman使用tns中SERVICE_NAME = prod2_std或SERVICE_NAME =PROD2_STD的别名登录都会报错ORA-01017: invalid username/password; logon denied(直接sqlplus而不使用as sysdba时是无法使用tns登录nomount的数据库的,但是rman是可以的,在duplicate时极其容易有这个错误,一旦出现这个错误还以为密码有问题,绕来绕去搞密码永远都解决不了)
子2:
listener.ora配置SID_NAME = DW
(SID_DESC =(ORACLE_HOME= /iso/db/11.2.0)(SID_NAME = DW))
service_names参数为PROD1,instance_name参数值为PROD1
lsnectl start显示信息如下
Service "DW" has 1 instance(s).
  Instance "DW", status UNKNOWN, has 1 handler(s) for this service...
Service "PROD1" has 2 instance(s).
  Instance "PROD1", status READY, has 1 handler(s) for this service...
例子3:
listener.ora配置SID_NAME=PRODSTD88,GLOBAL_DBNAME=PRODSTD77
(SID_DESC=(GLOBAL_DBNAME=PRODSTD77)(ORACLE_HOME=/u01/app/oracle)(SID_NAME=PRODSTD88))
service_names为PRODSTD,instance_name参数为PRODSTD
lsnrctl start显示信息如下
Service "PRODSTD" has 1 instance(s).
  Instance "PRODSTD", status READY, has 1 handler(s) for this service...
Service "PRODSTD77" has 1 instance(s).
  Instance "PRODSTD88", status UNKNOWN, has 1 handler(s) for this service...

 

GLOBAL_DBNAME:非参数,存在在listener.ora中的静态监听配置中,可以随便定义
listener.ora File Parameter(GLOBAL_DBNAME)
While processing a client connection request, the listener tries to match the value of this parameter with the value of the SERVICE_NAME parameter in the client connect descriptor. If the client connect descriptor uses the SID parameter, then the listener does not attempt to map the values. This parameter is primarily intended for configurations with Oracle8 databases (where dynamic service registration is not supported for dedicated servers). This parameter may also be required for use with Oracle8i and later database services by some configurations.
The value for this parameter is typically obtained from the combination of the DB_NAME and DB_DOMAIN parameters (DB_NAME.DB_DOMAIN) in the initialization parameter file, but the value can also contain any valid name used by clients to identify the service.
listener.ora文件参数(GLOBAL_DBNAME)
在处理客户端连接请求时,监听器尝试将此参数的值与客户端连接描述符中的SERVICE_NAME参数值相匹配。 如果客户端连接描述符使用SID参数,那么侦听器不会尝试映射这些值。 此参数主要用于Oracle8数据库的配置(专用服务器不支持动态服务注册)。 通过某些配置,此参数对于Oracle8i及更高版本的数据库服务也可能是必需的。
此参数的值通常是从初始化参数文件中DB_NAME和DB_DOMAIN参数(DB_NAME.DB_DOMAIN)的组合中获得的,但该值也可以包含客户端用来标识服务的任何有效名称。
比如静态监听LISTENER中(GLOBAL_DBNAME=PRODSTD222),而参数service_names值是PRODSTD,则lsnrctl status结果如下
Service "PRODSTD" has 1 instance(s).
  Instance "PRODSTD", status READY, has 1 handler(s) for this service...
Service "PRODSTD222" has 1 instance(s).
  Instance "PRODSTD", status UNKNOWN, has 1 handler(s) for this service...

GLOBAL_NAMES:参数,和dblink相关,specifies whether a database link is required to have the same name as the database to which it connects

SERVICE_NAME:非参数,存在tnsname.ora中,标明监听器的服务名称,匹配参数service_names或listener.oraglobal_name的值(如listener中没有global_name则匹配listener中的SID_NAME),数据库直连就是IP:port/Service_name对应lsnrctl status显示的service对应的名称
比如静态监听LISTENER中(GLOBAL_DBNAME=PRODSTD222),而参数service_names值是PRODSTD,则lsnrctl status结果如下

Service "PRODSTD" has 1 instance(s).
  Instance "PRODSTD", status READY, has 1 handler(s) for this service...
Service "PRODSTD222" has 1 instance(s).
  Instance "PRODSTD", status UNKNOWN, has 1 handler(s) for this service...

 

SERVICE_NAMES:参数,specifies one or more names by which clients can connect to the instance,

 

DB_NAME:参数,数据库名,安装数据库时创建的,安装好后尽量不要去修改,可以单独更改,也可以和Db_id一起更改

 

Db_id:非参数,数据库id,在dataguarddb_name一致则db_id也一致,安装好后尽量不要去修改,可以单独更改,也可以和Db_name一起更改

 

INSTANCE_NAME:参数,数据库实例名

 

Db_unique_name:参数,只在dataguard中有效,区别具有相同db_nameinstance_name的数据库,可以随便命名

 

ORACLE_SID: 非参数,ORACLE_SID就是ORACLE System Identifier,用于oracleos进行联系的,以环境变量形式出现,当ORACLE启动时OSfork的进程必须通过ORACLE_SID将实例与其他实例区分开来,oracle的后台进程的名称就是通过ORACLE_SID决定的,ORACLE启动需要参数文件,而这默认参数文件的名称就是由ORACLE_SID决定的,如init.oraspfile.ora

一台服务器上有多个实例时,登陆选择某个实例的方法如下:

Linuxexport ORACLE_SID=XX或直接ORACLE_SID=XX

Windowsset ORACLE_SID=XX

 

ORACLE_SIDInstance_name区别:不同的ORACLE_SID(实例)可以有相同的Instance_name(实例名),通过简单的参数文件复制即可实现(如复制一个文件init.orainitnew.ora,再ORACLE_SID=ORACLE_SIDnewsqlplus / as sysdba 进行startup,可以在服务器上发现两个实例,一个为ORACLE_SID,一个为ORACLE_SIDnew,但是两者的instance_name都是一样的)

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/30126024/viewspace-1846929/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/30126024/viewspace-1846929/

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值