docker oracle一些报错处理--失败记录

server/2024/12/27 10:09:28/

个人学习记录

1. 修改实例服务名称

[oracle@3fe959481973 ~]$ sqlplus /nologSQL*Plus: Release 11.2.0.1.0 Production on Thu Nov 14 15:37:02 2024Copyright (c) 1982, 2009, Oracle.  All rights reserved.SQL> connect /as sysdba;
Connected.
#查看当前服务名称
SQL> show parameter service_name;NAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
service_names			     string	 helowin
#修改服务名称为orcl
SQL> alter system set service_names='orcl' scope=both;System altered.
#修改完成
SQL> show parameter service_name;NAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
service_names			     string	 orcl

查看并没有修改,反而多出一个服务

[oracle@3fe959481973 ~]$ lsnrctl statusLSNRCTL for Linux: Version 11.2.0.1.0 - Production on 14-NOV-2024 15:58:57Copyright (c) 1991, 2009, Oracle.  All rights reserved.Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                14-NOV-2024 10:37:08
Uptime                    0 days 5 hr. 21 min. 49 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /home/oracle/app/oracle/product/11.2.0/dbhome_2/network/admin/listener.ora
Listener Log File         /home/oracle/app/oracle/diag/tnslsnr/3fe959481973/listener/alert/log.xml
Listening Endpoints Summary...(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=3fe959481973)(PORT=1521)))
Services Summary...
Service "helowin" has 1 instance(s).Instance "helowin", status READY, has 1 handler(s) for this service...
Service "helowinXDB" has 1 instance(s).Instance "helowin", status READY, has 1 handler(s) for this service...
Service "orcl" has 1 instance(s).Instance "helowin", status READY, has 1 handler(s) for this service...
The command completed successfully

2. 尝试修改ortab文件和环境变量sid

#查看实例
SQL> select instance from v$thread;INSTANCE
--------------------------------------------------------------------------------
helowin#关闭数据库
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options#修改ortab文件中的旧名称
[oracle@3fe959481973 ~]$ cat /etc/oratab
helowin:/home/oracle/app/oracle/product/11.2.0/dbhome_2:Y
[oracle@3fe959481973 ~]$ vi /etc/oratab
[oracle@3fe959481973 ~]$ cat /etc/oratab
orcl:/home/oracle/app/oracle/product/11.2.0/dbhome_2:Y
#修改环境变量中的sid
[oracle@3fe959481973 ~]$ vi ~/.bash_profile
[oracle@3fe959481973 ~]$ source ~/.bash_profile

 修改后重启数据库报错

[oracle@3fe959481973 ~]$ sqlplus / as sysdbaSQL*Plus: Release 11.2.0.1.0 Production on Thu Nov 14 16:51:31 2024Copyright (c) 1982, 2009, Oracle.  All rights reserved.Connected to an idle instance.SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/home/oracle/app/oracle/product/11.2.0/dbhome_2/dbs/initorcl.ora'

查询说将/home/oracle/app/oracle/admin/helowin/pfile/init.ora.72320146402文件复制到报错路径/home/oracle/app/oracle/product/11.2.0/dbhome_2/dbs/,并重命名为initorcl.ora

重启还是同样的错误

找原因发现是权限的问题

[oracle@3fe959481973 dbs]$ ll
total 36
-rw-r-----. 1 oracle oinstall 3584 Jan  4  2016 123.sp
-rw-rw----. 1 oracle oinstall 1544 Nov 14 16:50 hc_helowin.dat
-rw-r--r--. 1 oracle oinstall 2851 May 16  2009 init.ora
-rw-r--r--. 1 oracle oinstall 1067 Jan  4  2016 inithelowin.ora
-rw-r-----  1 root   root     2223 Aug 23  2014 initorcl.ora
-rw-r-----. 1 oracle oinstall   24 Aug 23  2014 lkHELOWIN
-rw-r-----. 1 oracle oinstall   24 Dec 29  2015 lkORCL
-rw-r-----. 1 oracle oinstall 2048 Nov 14 13:59 orapwhelowin
-rw-r-----. 1 oracle oinstall 3584 Nov 14 16:47 spfilehelowin.ora

切换到root修改权限

[oracle@3fe959481973 dbs]$ su root
Password: 
[root@3fe959481973 dbs]# chmod 644 initorcl.ora
root@3fe959481973 dbs]# chown oracle:oinstall initorcl.ora
[root@3fe959481973 dbs]# ll
total 36
-rw-r-----. 1 oracle oinstall 3584 Jan  4  2016 123.sp
-rw-rw----. 1 oracle oinstall 1544 Nov 14 16:50 hc_helowin.dat
-rw-r--r--. 1 oracle oinstall 2851 May 16  2009 init.ora
-rw-r--r--. 1 oracle oinstall 1067 Jan  4  2016 inithelowin.ora
-rw-r--r--  1 oracle oinstall 2223 Aug 23  2014 initorcl.ora
-rw-r-----. 1 oracle oinstall   24 Aug 23  2014 lkHELOWIN
-rw-r-----. 1 oracle oinstall   24 Dec 29  2015 lkORCL
-rw-r-----. 1 oracle oinstall 2048 Nov 14 13:59 orapwhelowin
-rw-r-----. 1 oracle oinstall 3584 Nov 14 16:47 spfilehelowin.ora

再重新启动,报错

[root@3fe959481973 dbs]# su - oracle
[oracle@3fe959481973 ~]$ sqlplus /nologSQL*Plus: Release 11.2.0.1.0 Production on Fri Nov 15 14:05:16 2024Copyright (c) 1982, 2009, Oracle.  All rights reserved.SQL> connect / as sysdba
Connected to an idle instance.
SQL> startup
ORA-00119: invalid specification for system parameter LOCAL_LISTENER
ORA-00132: syntax error or unresolved network name 'LISTENER_ORCL'

3.修改监听配置文件

监听文件配置:

Oracle数据库中监听器listenr负责监听并响应来自客户端的连接请求。主要文件有三个:

listener.ora:监听器核心配置文件,定义了监听的协议、主机地址和端口等信息,告诉监听器应该听什么

tnsnames.ora:相当于客户端的通讯录,用于解析客户端连接数据库时使用的服务名,将其映射到具体的网络地址和实例名。

sqlnet.ora:可选的配置文件,主要设置网络连接的默认参数,如连接超时、加密等

[oracle@3fe959481973 admin]$ vi listener.ora 
[oracle@3fe959481973 admin]$ vi tnsnames.ora 修改两个文件中的HOST=localhost,helowin改成orcl

修改后重启一下容器

[root@plmomn-gw ~]# docker restart oracle11g
oracle11g

 还是报错

SQL> startup
ORA-09925: Unable to create audit trail file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 9925

查询后,查看日志文件

Fri Nov 15 16:50:04 2024
Could not open audit file: /home/oracle/app/oracle/admin/orcl/adump/orcl_ora_97_2.aud
Retry Iteration No: 1   OS Error: 0
Retry Iteration No: 2   OS Error: 2
Retry Iteration No: 3   OS Error: 2
Retry Iteration No: 4   OS Error: 2
Retry Iteration No: 5   OS Error: 2
OS Audit file could not be created; failing after 5 retries

 日志中的audit file路径:

audit_file_dest          = "/home/oracle/app/oracle/admin/orcl/adump"

查看该路径,发现没有该目录:

[oracle@3fe959481973 trace]$ cd /home/oracle/app/oracle/admin/orcl/
bash: cd: /home/oracle/app/oracle/admin/orcl/: No such file or directory
[oracle@3fe959481973 trace]$ cd /home/oracle/app/oracle/admin      
[oracle@3fe959481973 admin]$ ls
helowin

 创建该目录

[oracle@3fe959481973 admin]$ mkdir -p /home/oracle/app/oracle/admin/orcl/adump

 再启动,

SQL> conn / as sysdba
Connected.
SQL> startup
ORA-01081: cannot start already-running ORACLE - shut it down first

关闭重来:

SQL> shutdown immediate
ORA-01507: database not mountedORACLE instance shut down.
SQL> startup nomount
ORACLE instance started.Total System Global Area 1603411968 bytes
Fixed Size		    2213776 bytes
Variable Size		  402655344 bytes
Database Buffers	 1191182336 bytes
Redo Buffers		    7360512 bytes

查询一下实例状态

SQL> select status from v$instance;STATUS
------------
STARTED

 使用navicat连接:

查看一下listenner状态:

[oracle@3fe959481973 /]$ lsnrctl statusLSNRCTL for Linux: Version 11.2.0.1.0 - Production on 18-NOV-2024 10:52:21Copyright (c) 1991, 2009, Oracle.  All rights reserved.Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                18-NOV-2024 10:35:08
Uptime                    0 days 0 hr. 17 min. 12 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /home/oracle/app/oracle/product/11.2.0/dbhome_2/network/admin/listener.ora
Listener Log File         /home/oracle/app/oracle/diag/tnslsnr/3fe959481973/listener/alert/log.xml
Listening Endpoints Summary...(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
Services Summary...
Service "orcl" has 1 instance(s).Instance "orcl", status BLOCKED, has 1 handler(s) for this service...
The command completed successfully
[oracle@3fe959481973 /]$ 

状态blocked,还是有问题

挂载数据库报错:

SQL> alter database mount;
alter database mount
*
ERROR at line 1:
ORA-00205: error in identifying control file, check alert log for more info

查看日志: 

Mon Nov 18 11:37:50 2024
alter database mount
Mon Nov 18 11:37:50 2024
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/home/oracle/app/oracle/flash_recovery_area/orcl/control02.ctl'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/home/oracle/app/oracle/oradata/orcl/control01.ctl'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-205 signalled during: alter database mount...

实际并没有这两个目录


http://www.ppmy.cn/server/153597.html

相关文章

OpenEMMA: 打破Waymo闭源,首个开源端到端多模态模型

导读: OpenEMMA,它是首个基于多模态大型语言模型的开源端到端框架。通过结合思维链推理过程,它在利用多种多模态大型语言模型时,相较于基线取得了显著改进。此外,它在各种具有挑战性的驾驶场景中展示了有效性、泛化能力…

Cesium材质——Material

简介: Cesium.Material对象的目的,就是生成一段名称为czm_getMaterial的函数(示例代码如下), 这个czm_getMaterial函数,是shader代码,会被放到片元着色器中使用。 czm_material czm_getMater…

【seatunnel】数据同步软件安装

【seatunnel】数据同步软件安装 下载 wget https://dlcdn.apache.org/seatunnel/2.3.8/apache-seatunnel-2.3.8-bin.tar.gz wget https://dlcdn.apache.org/seatunnel/seatunnel-web/1.0.2/apache-seatunnel-web-1.0.2-bin.tar.gz1、安装seatunnel Server 解压 tar zxvf ap…

前后端分离(前端删除数据库数据)

1.实现思路前端把用户Id用axios请求发送给后端,后端获取id,把用户数据删除并返回给前端一个删除成功响应 2.编写axios请求代码 const deleteEmployee async (empNo) > {try {const response await axios.delete(http://localhost:8080/api/delEmp,…

爬虫代理服务要怎么挑选?

在数据采集的世界里,爬虫代理服务不仅帮助我们高效地收集信息,还能在保护数据安全方面发挥重要作用。但面对市场上琳琅满目的代理服务,我们该如何挑选呢?本文将为你提供一些实用的建议,帮助你找到最适合你的爬虫代理服…

条款14 如果函数不抛出异常请使用noexcept

C11中 内存释放函数 和 析构函数 都是隐式noexcept,除非手动声明noexcept(flase),但如果是一个对象的析构函数可能被标准库使用,且析构函数有可能抛出异常,那么程序的行为是未定义的std::vector添加新元素如果容量不够,那么vector…

音视频入门知识(四):封装篇

⭐四、封装篇 H264封装成mp4、flv等格式,那为什么需要封装? ​ h264也能播放,但是按照帧率进行播放,可能不准 ★FLV **FLV(Flash Video)**是一种用于传输和播放视频的容器文件格式。FLV 格式广泛应用于流媒…

Virtualbox安装ubuntu20虚拟机无法打开终端

用Virtualbox安装ubuntu20系统,安装好之后,无法打开终端; 原因:语言设置导致的问题; 修改方法:将/etc/default/locale里LANG这行的值修改为:en_US.UTF-8即可; 步骤:先在…