当前位置: 首页 > article >正文

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

个人学习记录

1. 修改实例服务名称

[oracle@3fe959481973 ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Thu Nov 14 15:37:02 2024

Copyright (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 status

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 14-NOV-2024 15:58:57

Copyright (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 sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Thu Nov 14 16:51:31 2024

Copyright (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 /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Fri Nov 15 14:05:16 2024

Copyright (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 mounted


ORACLE 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 status

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 18-NOV-2024 10:52:21

Copyright (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.kler.cn/a/458662.html

相关文章:

  • table 表格转成 excell 导出
  • windows C#-拆分类和方法
  • leetcode hot 100 全排列
  • 《HelloGitHub》第 105 期
  • Dockerfile基础指令
  • SonarQube相关的maven配置及使用
  • 【k8s】Calico网络
  • Linux中sh脚本发邮件配置
  • arcgis server ip修改后服务异常解决方案
  • 阿里云clb是什么
  • 路由器单臂路由配置
  • Java - 日志体系_Apache Commons Logging(JCL)日志接口库_适配Log4j2 及 源码分析
  • uniapp实现为微信小程序扫一扫的功能
  • python|利用ffmpeg按顺序合并指定目录内的ts文件
  • 5G CPE接口扩展之轻量型多口千兆路由器小板选型
  • 【Jetson Nano】40Pin学习 GPIO
  • 青少年编程与数学 02-005 移动Web编程基础 05课题、rem布局与媒体查询
  • akamai3.0 wizzair 网站 分析
  • IEA国际能源署数据库
  • windows C#-显式实现两个接口的成员