我尝试通过 Oracle 12c 进行备份和恢复,每次关闭数据库时,侦听器和 tnsnames.ora 文件都会重新配置,我不知道为什么。现在,每次发生这种情况,我都必须去找我们的 DBA,他会修复它。今天他休假,所以我花了一整天的时间尝试在notepad++中配置这两个文件。到目前为止,我确信我在 tnsnames.ora 文件中编写的内容没有问题。但问题出在listener.ora文件上。
以下是两者的内容:
tnsnames.ora 文件:
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
MISL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = misl)
)
)
JAHIN =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = jahin)
)
)
listener.ora 文件:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:\app\Jahin\product\12.1.0\dbhome_1)
(PROGRAM = extproc)
)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = DESKTOP-TG0P7GL)(PORT = 1521))
)
)
每当我尝试通过 lsnrctl status 命令检查侦听器的状态时(每次更改后我都会停止并启动该进程),它都会给我一条消息,表明它找到了该服务,它有多少个实例,但它的状态始终返回未知.
C:\Windows\system32>lsnrctl status
LSNRCTL for 64-bit Windows: Version 12.1.0.2.0 - Production on 27-OCT-2022 16:37:31
Copyright (c) 1991, 2014, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 64-bit Windows: Version 12.1.0.2.0 - Production
Start Date 27-OCT-2022 16:15:54
Uptime 0 days 0 hr. 21 min. 38 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File C:\app\Jahin\product\12.1.0\dbhome_1\network\admin\listener.ora
Listener Log File C:\app\Jahin\diag\tnslsnr\DESKTOP-TG0P7GL\listener\alert\log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=DESKTOP-TG0P7GL)(PORT=1521)))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
还有一件事:每当我尝试登录 sqlplus 时,我都会收到一条消息,提示已连接到空闲实例。然后它不会让启动甚至关闭数据库。
C:\Users\Jahin Catalan Mahbub>sqlplus / as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Thu Oct 27 15:59:52 2022
Copyright (c) 1982, 2014, Oracle. All rights reserved.
ERROR:
ORA-01017: invalid username/password; logon denied
Enter user-name: sys as sysdba
Enter password:
Connected to an idle instance.
SQL> show parameter
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0
SQL> show parameter uniq
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0
SQL> startup
ORA-00119: invalid specification for system parameter LOCAL_LISTENER
ORA-00132: syntax error or unresolved network name 'LISTENER_MISL'
SQL> exit
Disconnected
知道问题出在哪里吗?甚至在这些地方吗?
现在,AFAIR,当我的 DBA 执行此操作并确认其正常工作时,lsnrctl 状态将返回 3 个服务,每个服务都有一个实例,并且每个实例状态均已就绪。所有命令都运行良好。阳光和彩虹。
问题是,在他上次编辑并修复该listener.ora 文件时,我没有保留该文件的副本。因为这个我无法完成任何工作。
我今天与我的 DBA 进行了交谈,我们找到了解决我的问题的方法。事实证明,listener.ora 基本上没问题。我只需要在 tnsnames.ora 文件中添加一行即可。
LISTENER_MISL = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
MISL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = misl)
)
)
JAHIN =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = jahin)
)
)
以下是对 lister.ora 文件进行的细微更改:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:\app\Jahin\product\12.1.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:C:\app\Jahin\product\12.1.0\dbhome_1\bin\oraclr12.dll")
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = DESKTOP-TG0P7GL)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
到目前为止,我没有收到任何重大错误,我的数据库启动和关闭没有太大问题。