Database name, global database name, SID difference and feeling

Database name, global database name, SID difference and feeling

The first thing to say is that it is not out of the body. Maybe we can do better for some needs in normal development, rather than follow normal logic.

Deal with it, otherwise you will be a hard-working code farmer all your life.

The company now has a project that is implemented in three different places at the same time, considering that the needs of each place are slightly different, so different databases are required

When building a local environment, a certain gentleman intends to create different users in a database to distinguish each city.

For example, cities a, b, and c correspond to user names a_user, b_user, and c_user.

The problem now is that the users backed up from the on-site backup are all called users, so what views, functions and authorizations have to be changed one by one.

I don't know if there is a solution at the dba level.

Therefore, I suggest that a gentleman create multiple databases on the test server to distinguish different local databases

Create a brand new database through configuration and migration tools --> database configuration assistant

First, the database name 
   is the database created during the installation of the Oracle software, or the data name created by yourself after the installation is complete.
It is mainly used to distinguish between multiple libraries installed in an oracle . A library will generate an oracle_service in the Windows service. The database name is used when installing the database, creating a new database, creating a database
control file, modifying the data structure, backing up and restoring the database.
 
Query the current data name
Method 1: select name from v$database;
Method 2: show parameter db
2. Database instance name [SID]
 The database instance name is an identifier used to communicate with the operating system, that is, between the database and the operating system The interaction uses the database instance name. The instance name is also written into the parameter file
, the parameter is instance_name, and in the winnt platform, the instance name is also written into the registry. The database name and instance name can be the same or different. In general, there
is a one-to-one relationship between the database name and the instance name, but if in the Oracle parallel server architecture (ie, the Oracle real-time application cluster), the database name and the instance name have a one-to-many relationship.
(That is, when multiple libraries are created in an oracle, the identity of the communication between each library and the operating system has nothing to do with our users!)

 Query the current database instance name
Method 1: select instance_name from v$instance;
Method 2: show parameter instance

三、数据库域名
   在分布工数据库系统中,不同版本的数据库服务器之间,不论运行的操作系统是unix或是windows,各服务器之间都可以通过数据库
链路进行远程复制,数据库域名主要用于oracle分布式环境中的复制。
举例说明如:
全国交通运政系统的分布式数据库,其中:
福建节点: fj.jtyz
福建厦门节点: xm.fj.jtyz
江西: jx.jtyz
江西上饶:sr.jx.jtyz
这就是数据库域名。
数据库域名在存在于参数文件中,他的参数是db_domain

  查询数据库域名
方法一:select value from v$parameter where name = 'db_domain';
方法二:show parameter domain

四、全局数据库名
  全局数据库名=数据库名+数据库域名,如前述福建节点的全局数据库名是:oradb.fj.jtyz
五、数据库服务名
  从oracle9i版本开始,引入了一个新的参数,即数据库服务名。参数名是SERVICE_NAME。该名称主要是oracle客户端和oracle建立服务的
时候使用,好像没有多么有用的价值!

  查询数据库服务名
方法一:select value from v$parameter where name = 'service_name';
方法二:show parameter service_name

(注释:一般情况下我们开发中用到的数据库是单数据库实例,就是oracle中只有一个库。这个时候大部分都有:
 数据库服务名 = 全局数据库名 = 数据库名[+ 数据库域名] = SID)



转自:https://www.cnblogs.com/draem0507/archive/2012/11/14/2769831.html

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326080278&siteId=291194637