Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to understand the global database name in Oracle distributed system

2025-01-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

Today, I will talk to you about how to understand the global database name in the Oracle distributed system, which may not be well understood by many people. In order to make you understand better, the editor has summarized the following contents for you. I hope you can get something from this article.

In a distributed system, each database has a unique global database name. The global database name uniquely identifies a database in the system. One of the main tasks in distributed systems is to create and manage global database names.

1. Composition of global database names

A global database name consists of two parts: a database name and a domain name. The database name and domain name are determined by the following parameters when the database is created.

Database name: db_name is less than or equal to 30 characters, such as sales

Domain name: db_domain must abide by standard Internet rules. The levels in the domain name must be separated by a period and the order of the domain name is from leaf to root, from left to right.

The db_domain parameter is just a very important parameter that is used when the database is created, and it works with the db_name parameter to determine the global database name. The global database name is stored in the data dictionary. The global database name must be changed through the alter database statement, not by modifying the db_domain parameter in the parameter file.

Decide whether to enforce the global database name

When you create a data link specified name in the local database, the link name is generated based on whether the global database name is enforced. If the local database enforces the global database name, then you must use the remote database global database name as the data link name. For example, if you connect to the local database hq and want to create a data link to the mfg that connects to the remote database, and the local database enforces the global database name, you must use the mfg global database name as the link name.

You can also use the service name as part of the database link name when creating the data link. For example, if you connect to the database hq.example.com using the service names sn1 and sn2, and the global database name is enforced, you can create the following link name for the database hq:

Hq.example.com@sn1

Hq.example.com@sn2

To determine whether the database has a global database name enabled, check the database initialization parameter file or query the v$parameter view. For example, to see if the global database name is enforced on the database mfg, you can execute the following statement to query:

SQL > col name format a12SQL > col value format a6SQL > select name, value from v$parameter where name = 'global_names' 2 / NAME VALUE--global_names FALSE

View global database name

You can query the view global_name to see the global database name

SQL > select * from global_name;GLOBAL_NAME----JYPDB

Modify the domain name in the global database name

You can use the alter database statement to change the domain name in the global database name. After the database is created, modifying the db_domain parameter does not affect the global database name or database link name. The following example shows the statement to rename the global database name, where database is the database name and domain is the network domain name:

Alter database rename global_name to database.domain

The operation to modify the global database name is as follows:

1. Determine the current global database name:

SQL > select * from global_name;GLOBAL_NAME----JY

two。 Execute the alter database statement to modify the global database name

SQL > alter database rename global_name to jy.jydba.net;Database altered.

3. Query the view global_name to check the new global database

SQL > select * from global_name;GLOBAL_NAME----JY.JYDBA.NET

4. Modify the domain name in the global database name

Use the alter database statement to modify the domain name in the avoid database name. After the database is created, modifying the initialization parameter db_domain does not affect the global database name or the resolution of the database link name. The following example shows the syntax for changing the global database name, where database is the database name and domain is the network domain name:

Alter database rename global_name to database.domain

Use the following procedure to modify the domain name in the global database name:

1. Determines the current global database name.

SQL > select * from global_name;GLOBAL_NAME----JY.JYDBA.NET

two。 Use the alter database statement to modify the global database name

SQL > alter database rename global_name to jy.changde.net;Database altered

3. Query the global_name table to check the new global database name

SQL > select * from global_name;GLOBAL_NAME----JY.CHANGDE.NET

The following is a scenario where the global database name is modified

In this case, you can modify the domain name section of the global database name of the local database. You can also use the global name to create a data link to test how the database resolves the link name.

1. Connect to jy.jydba.net and query the global_name data dictionary view to determine that the current data is a global name:

SQL > select * from global_name;GLOBAL_NAME----JY.JYDBA.NET

two。 Query the v$parameter view to determine the current value of the db_domain parameter

SQL > select name, value from v$parameter where name = 'db_domain';NAME VALUE---db_domain

3. Create a data link to the database sjjh that secures part of the specified global name:

SQL > create database link dblink_test using 'sjjh';Database link created

The database adds the domain name in the global database name of the local database to the global name of the data link

4. Query user_db_links to determine the domain name of the data link

SQL > select db_link from user_db_links;DB_LINK----DBLINK_TEST.JYDBA.NET

The query results show that the domain name jydba.net in the global name of the local database is used as the domain name of the data link

5. Because you want to move the database jy to the domain changde.net, do the following

SQL > alter database rename global_name to jy.changde.net;Database alteredSQL > select * from global_name;GLOBAL_NAME----JY.CHANGDE.NET

6. Query v$parameter and found that the db_domain parameter has not been modified

SQL > select name, value from v$parameter where name = 'db_domain';NAME VALUE---db_domain

This shows that the db_domain parameter is independent of the alter database rename global_name statement. The alter database statement determines the domain name in the global database name.

7. You can create another data link to connect to the database sjjh and query user_db_links to view the domain name in the data link

SQL > create database link dblink_cs using 'sjjh';Database link createdSQL > select db_link from user_db_links;DB_LINK----DBLINK_CS.CHANGDE.NETDBLINK_TEST.JYDBA.NET

You can see that the domain name of the newly created data link is using the domain name in the current local database global database name.

After reading the above, do you have any further understanding of how to understand global database names in Oracle distributed systems? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report