oracle 如何找到主机字符串?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17170125/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 01:44:09  来源:igfitidea点击:

How to find host string?

oracleoracle10goracleforms

提问by ankitaP

I have just installed Oracle - DevSuitehome2, Oracle Database 10g Express Edition and Oracle Developer Suit - DevSuiteHome2. I am new to this Oracle forms, Oracle Reports, etc. During installation, it asked for the password. I entered it. It was written that use your password in SYS and SYSTEM Database accounts. After installation was completed I started SQL *Plus. I entered SYSTEM as username and my password.

我刚刚安装了 Oracle - DevSuitehome2、Oracle Database 10g Express Edition 和 Oracle Developer Suit - DevSuiteHome2。我是这个 Oracle 表单、Oracle Reports 等的新手。在安装过程中,它要求输入密码。我输入了它。写在 SYS 和 SYSTEM 数据库帐户中使用您的密码。安装完成后,我启动了 SQL *Plus。我输入 SYSTEM 作为用户名和密码。

                 ERROR:
                 ORA-12154 :TNS:could not resolve the connect identifier specified

I also tried SYS as my username but still same error. I opened cmd and typed:

我也试过 SYS 作为我的用户名,但仍然是同样的错误。我打开cmd并输入:

                 C:\>sqlplus /nolog
                 SQL> conn / as sysdba
                 connected.
                 SQL> desc dba_users
                 NAME           NULL?           TYPE
                 ------         ------          --------
                 USERNAME                       VARCHAR2(30)
                 USERID                         NUMBER
                 PASSWORD                       VARCHAR2(30)
                 . 
                 .

                 SQL>select username,password from user_dba;
                 USERNAME                    PASSWORD
                 -----------                 -------------
                 SYS                         XXXXXXXXXX
                 SYSTEM                      XXXXXXXXXX
                 SCOTT                       XXXXXXXXXX
                 HR                          XXXXXXXXXX
                 . 
                 .  

All passwords were written in complex form so to simplify it I thought to change any one of the password. So, I wrote :

所有密码都以复杂的形式编写,为了简化它,我想更改任何一个密码。所以,我写道:

                SQL> alter user HR identified by password;
                user altered.

Then I tried to use these while opening SQL *Plus. It did not work. I don't know what's the host string now. Can I get the complete information about users, passwords and host string ? I tried to search for tnsnames.ora file too but could not find out. All files, folders are all mess.

然后我尝试在打开 SQL *Plus 时使用这些。这没用。我现在不知道主机字符串是什么。我可以获得有关用户、密码和主机字符串的完整信息吗?我也尝试搜索 tnsnames.ora 文件,但找不到。所有的文件,文件夹都是乱七八糟的。

回答by the_slk

Usernames and passwords:

用户名和密码:

SELECT  USERNAME, PASSWORD
FROM    DBA_USERS;

Passwords are always encrypted so you will not get much out of it

密码总是加密的,所以你不会从中得到太多

host name:

主机名:

SELECT sys_context('USERENV', 'HOST') FROM DUAL;

sys_context works great for many, many things:

sys_context 适用于很多很多事情:

http://psoug.org/reference/sys_context.html

http://psoug.org/reference/sys_context.html

If you have access to the command line you can use listener status to get some more information.

如果您有权访问命令行,则可以使用侦听器状态来获取更多信息。

LSNRCTL> STATUS
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=net)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.0.0 -
Beta
Start Date                15-JAN-2008 12:02:00
Uptime                    0 days 0 hr. 5 min. 29 sec
Trace Level               support
Security                  OFF
SNMP                      OFF
Listener Parameter File   /oracle/network/admin/listener.ora
Listener Log File         /oracle/network/log/listener.log
Listener Trace File       /oracle/network/trace/listener.trc

Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=net)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=sales-server)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=sales-server)(PORT=2484)))

Services Summary...
Service "sales1.us.example.com" has 1 instance(s).
  Instance "sales", status READY, has 1 handler(s) for this service...
Service "sales2.us.example.com" has 1 instance(s).
  Instance "sales", status READY, has 2 handler(s) for this service...
The command completed successfully

Source: http://docs.oracle.com/cd/E11882_01/network.112/e10835/lsnrctl.htm#CIHGHCGJ(Oracle Database Net Services Reference)

来源:http: //docs.oracle.com/cd/E11882_01/network.112/e10835/lsnrctl.htm#CIHGHCGJ(Oracle 数据库网络服务参考)