oracle软件使用主机名用于什么用途?
oracle软件一般使用主机名的目的是让客户端能可以通过 直接输入 服务端 的主机名,而不是其IP地址 网络连接到服务端。故而为了实现这一目的,就需要让主机名与 IP地址 映射成一条 映射条目。 在 window系统下,由于 win 操作系统上的某一进程所调用的 rtlIPv
oracle软件一般使用主机名的目的是让客户端能可以通过直接输入服务端的主机名,而不是其IP地址网络连接到服务端。故而为了实现这一目的,就需要让主机名与IP地址映射成一条映射条目。在window系统下,由于win操作系统上的某一进程所调用的rtlIPv6AddressToStringW函数(来自win操作系统上的ntdll.dll文件)可以自动构造出这一映射条目(即程序写死的),所以hosts文件里的内容可以为空,也能实现上述目的;在Linux系统中,没有上述功能,所以要在/etc/hosts文件中手动添加这一条记录。
在window系统下,构造出了一个映射条目
习惯 将“IP地址 名字1 名字2”[这是一般形式写法]这一格式里的名字1写为
参考0:
windows 通过修改注册表来修改主机名
oracle软件一般使用主机名的目的是让客户端能可以通过直接输入服务端的主机名,而不是其IP地址网络连接到服务端。
例如,listener.ora里host填写为主机名 ,还是可以正常监听,就是因为已经有了主机名与IP地址映射成的一条映射条目。
注释:
1、服务端不一定就是和客户端在不同的主机上,也可以在同一主机上。比如,一主机有ip地址A和B,服务端用A,客户端用B。或者,一主机只有一个ip地址A,服务端用A,客户端也同时可用A。
在 win操作系统上, 一般来说,在安装oracle数据库软件期间,会调用一次win操作系统上的rtlIPv6AddressToStringW函数(来自win操作系统上的ntdll.dll文件)来构造出现有主机名与现有IP地址间的这一映射条目保存在安装好的oracle数据库软件上。待操作系统修改了主机名或是IP地址后,oracle上涉及主机名的一些功能就会不正常。
参看:
不要轻易修改你的主机名
11gR2修改主机名导致CRS-0184以及CRS-4000的错误
参考1:
Linux系统在向DNS服务器发出域名解析请求之前会查询/etc/hosts文件,如果里面有相应的记录,就会使用hosts里面的记录。/etc/hosts文件通常里面包含这一条记录
127.0.0.1 localhost.localdomain localhost
hosts文件格式是一行一条记录,分别是IP地址 hostname aliases,三者用空白字符分隔,aliases可选 IP地址 域名1 域名2 。。。。。域名n。
127.0.0.1到localhost这一条建议不要修改,因为很多应用程序会用到这个,比如sendmail,修改之后这些程序可能就无法正常运行。
修改hostname后,如果想要在本机上用newhostname来访问,就必须在/etc/hosts文件里添加一条newhostname的记录。比如我的eth0的IP是192.168.1.61,我将hosts文件修改如下:
#hostname blog.infernor.net
# cat /etc/hosts
127.0.0.1 localhost.localdomain localhost
192.168.1.61 blog.infernor.net blog
这样,我就可以通过blog或者blog.infernor.net来访问本机。
从上面这些来看,/etc/hosts于设置hostname是没直接关系的,仅仅当你要在本机上用新的hostname来访问自己的时候才会用到/etc/hosts文件。两者没有必然的联系。
参考2:
hosts文件以及映射条目的使用规则
附加:
1、客户端会用到(自己的)hosts文件在建立连接时,而不是服务端用到(自己的)hosts文件
客户端的操作系统在向DNS服务器发出域名解析请求之前会查询自己的hosts文件,所以说hosts文件里的映射条目都是指服务端主机的ip地址和ip地址的域名间的映射:
客户端比如在浏览器中输入一个域名时,就会自动查询事先存在自己hosts文件里的映射条目,之后就能查出服务端的ip地址,从而通过ip地址连接到服务端(两个主机间要建立连接通讯只能靠ip地址的形式,而不是域名之类别的形式,因为通讯协议即ip协议设计时就是只支持ip地址格式的)。
2、hosts文件里的映射条目在格式上不必说
所以说,hosts文件里的映射条目在格式上不必说
hosts文件格式是一行一条记录,分别是IP地址 hostname aliases,三者用空白字符分隔,aliases可选
其实,
而DNS系统(由因特网上的多个DNS服务器主机加上DNS协议组成)是给因特网上所有的主机取了别名,而且这个别名是按照一定规则取的,不是乱取名的,比如,某一批人的别名会出现.com等。当你手里有一个人的别名而不知道别名具体指谁时,就可以向DNS系统(上的DNS服务器主机)查询这个别名具体指谁,DNS服务器主机就会告诉你这个别名对应的真名(即ip地址)是什么,从而连接到自己想要连接的主机(即操作系统)服务端上。如果你乱写了一个别名,在DNS系统的别名库没有的话,那你问DNS系统(上的DNS服务器主机)也问不出结果的,因为它不认识这个别名。
DNS系统和hosts文件给同一主机取了别名,但是因为是两套别名系统,各自不知道对方取的别名的含义,就像两个人,一个讲英语,一个讲中文,双方都听不懂对方的语言,所以两个人都在说苹果,但双方都不知道讲的意思。
在DNS系统下,映射条目的写法为
在host文件下,映射条目的写法为“IP地址 名字1 名字2”。
3、FQDN (fully qualified domain name,完全限定域名)=主机名+域名(包括顶级域)
那么 主机名 这个位置 可否用其他随便取的名字替代?不可以,因为FQDN是DNS协议设计时规定好的一种域名取名的格式,即就是要求DNS服务端给DNS客户端取一个FQDN 时该FQDN有客户端的主机名。
Hostname指定系统的 DNS 主机名,该主机名可由“hostname”命令返回。也就是FQDN (fully qualified domain name,完全限定域名)=主机名+域名(包括顶级域)中的那个主机名。因为hostname是dns主机名,所以hostname会出现在dns系统用的fqdn格式的域名里。
注释:
1、服务端不一定就是和客户端在不同的主机上,也可以在同一主机上。比如,一主机有ip地址A和B,服务端用A,客户端用B。或者,一主机只有一个ip地址A,服务端用A,客户端也同时可用A。
2、fully qualified host name就是fully qualified domain name
3、域名,确切地说,是和主机(即操作系统)上的一个IP地址对应。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Oracle View Encryption allows you to encrypt data in the view, thereby enhancing the security of sensitive information. The steps include: 1) creating the master encryption key (MEk); 2) creating an encrypted view, specifying the view and MEk to be encrypted; 3) authorizing users to access the encrypted view. How encrypted views work: When a user querys for an encrypted view, Oracle uses MEk to decrypt data, ensuring that only authorized users can access readable data.

Uninstall method for Oracle installation failure: Close Oracle service, delete Oracle program files and registry keys, uninstall Oracle environment variables, and restart the computer. If the uninstall fails, you can uninstall manually using the Oracle Universal Uninstall Tool.

Deleting all data in Oracle requires the following steps: 1. Establish a connection; 2. Disable foreign key constraints; 3. Delete table data; 4. Submit transactions; 5. Enable foreign key constraints (optional). Be sure to back up the database before execution to prevent data loss.

Oracle Invalid numeric errors may be caused by data type mismatch, numeric overflow, data conversion errors, or data corruption. Troubleshooting steps include checking data types, detecting digital overflows, checking data conversions, checking data corruption, and exploring other possible solutions such as configuring the NLS_NUMERIC_CHARACTERS parameter and enabling data verification logging.

Solutions to Oracle cannot be opened include: 1. Start the database service; 2. Start the listener; 3. Check port conflicts; 4. Set environment variables correctly; 5. Make sure the firewall or antivirus software does not block the connection; 6. Check whether the server is closed; 7. Use RMAN to recover corrupt files; 8. Check whether the TNS service name is correct; 9. Check network connection; 10. Reinstall Oracle software.

Oracle database paging uses ROWNUM pseudo-columns or FETCH statements to implement: ROWNUM pseudo-columns are used to filter results by row numbers and are suitable for complex queries. The FETCH statement is used to get the specified number of first rows and is suitable for simple queries.

The method to solve the Oracle cursor closure problem includes: explicitly closing the cursor using the CLOSE statement. Declare the cursor in the FOR UPDATE clause so that it automatically closes after the scope is ended. Declare the cursor in the USING clause so that it automatically closes when the associated PL/SQL variable is closed. Use exception handling to ensure that the cursor is closed in any exception situation. Use the connection pool to automatically close the cursor. Disable automatic submission and delay cursor closing.

In Oracle, the FOR LOOP loop can create cursors dynamically. The steps are: 1. Define the cursor type; 2. Create the loop; 3. Create the cursor dynamically; 4. Execute the cursor; 5. Close the cursor. Example: A cursor can be created cycle-by-circuit to display the names and salaries of the top 10 employees.
