我刚刚安装了Oracle - DevSuitehome2,Oracle数据库10g快捷版和Oracle Developer Suit - DevSuiteHome2。 我是这个Oracle表单,Oracle Reports等的新手。在安装过程中,它要求输入密码。我进去了。编写的是在SYS和SYSTEM数据库帐户中使用您的密码。安装完成后,我启动了SQL * Plus。我输入SYSTEM作为用户名和密码。
ERROR:
ORA-12154 :TNS:could not resolve the connect identifier specified
我也尝试过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
.
.
所有密码都是以复杂的形式编写的,为了简化它我想改变任何一个密码。所以,我写道:
SQL> alter user HR identified by password;
user altered.
然后我尝试在打开SQL * Plus时使用它们。那没起效。我现在不知道主机字符串是什么。我可以获得有关用户,密码和主机字符串的完整信息吗?我试图搜索tnsnames.ora文件,但无法找到。所有文件,文件夹都很乱。
答案 0 :(得分:1)
用户名和密码:
SELECT USERNAME, PASSWORD
FROM DBA_USERS;
密码始终是加密的,因此您不会从中获取太多信息
主机名:
SELECT sys_context('USERENV', 'HOST') FROM DUAL;
sys_context适用于许多很多事情:
http://psoug.org/reference/sys_context.html
如果您有权访问命令行,则可以使用侦听器状态来获取更多信息。
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
来源:http://docs.oracle.com/cd/E11882_01/network.112/e10835/lsnrctl.htm#CIHGHCGJ (Oracle数据库网络服务参考)