ORA-00322,ORA-00312 排错

本文记录了一次Oracle 9i数据库启动失败的问题处理过程。主要错误为ORA-00322和ORA-00312,涉及在线重做日志文件问题。通过关闭数据库并清除指定的日志文件后,成功恢复了数据库的正常运行。

 
**财政局数据库问题
问题描述
接到**的电话,说他们的数据库起不来了,
从远程连到他的机器,上面报了这个错误
 

从远程登陆到数据库服务器,查看alert.log
里面有这一段错误信息
Fri Oct 24 12:34:20 2008
Restarting dead background process QMN0
QMN0 started with pid=9
Shutting down instance: further logons disabled
Shutting down instance (immediate)
License high water mark = 3
All dispatchers and shared servers shutdown
Fri Oct 24 12:37:16 2008
ALTER DATABASE CLOSE NORMAL
ORA-1109 signalled during: ALTER DATABASE CLOSE NORMAL...
Fri Oct 24 12:37:16 2008
ALTER DATABASE DISMOUNT
Completed: ALTER DATABASE DISMOUNT
ARCH: Archiving is disabled
Shutting down archive processes
Archiving is disabled
Archive process shutdown avoided: 0 active
ARCH: Archiving is disabled
Shutting down archive processes
Archiving is disabled
Archive process shutdown avoided: 0 active
Fri Oct 24 12:41:07 2008
Starting ORACLE instance (normal)
LICENSE_MAX_SESSION = 0
LICENSE_SESSIONS_WARNING = 0
SCN scheme 2
Using log_archive_dest parameter default value
LICENSE_MAX_USERS = 0
SYS auditing is disabled
Starting up ORACLE RDBMS Version: 9.2.0.4.0.
System parameters with non-default values:
  processes                = 150
  timed_statistics         = TRUE
  shared_pool_size         = 83886080
  large_pool_size          = 16777216
  java_pool_size           = 83886080
  control_files            = /oracle/oradata/yscz/control01.ctl, /oracle/oradata/yscz/control02.ctl, /oracle/oradata/yscz/control03.ctl
  db_block_size            = 8192
  db_cache_size            = 33554432
  compatible               = 9.2.0.0.0
  db_file_multiblock_read_count= 16
  fast_start_mttr_target   = 300
  undo_management          = AUTO
  undo_tablespace          = UNDOTBS1
  undo_retention           = 10800
  remote_login_passwordfile= EXCLUSIVE
  db_domain                =
  instance_name            = yscz
  dispatchers              = (PROTOCOL=TCP) (SERVICE=ysczXDB)
  job_queue_processes      = 10
  hash_join_enabled        = TRUE
  background_dump_dest     = /oracle/admin/yscz/bdump
  user_dump_dest           = /oracle/admin/yscz/udump
  core_dump_dest           = /oracle/admin/yscz/cdump
  sort_area_size           = 524288
  db_name                  = yscz
  open_cursors             = 300
  star_transformation_enabled= FALSE
  query_rewrite_enabled    = FALSE
  pga_aggregate_target     = 25165824
  aq_tm_processes          = 1
PMON started with pid=2
DBW0 started with pid=3
LGWR started with pid=4
CKPT started with pid=5
SMON started with pid=6
RECO started with pid=7
CJQ0 started with pid=8
QMN0 started with pid=9
Fri Oct 24 12:41:09 2008
starting up 1 shared server(s) ...
starting up 1 dispatcher(s) for network address '(ADDRESS=(PARTIAL=YES)(PROTOCOL=TCP))'...
Fri Oct 24 12:41:09 2008
ALTER DATABASE   MOUNT
Fri Oct 24 12:41:14 2008
Successful mount of redo thread 1, with mount id 677969253.
Fri Oct 24 12:41:14 2008
Database mounted in Exclusive Mode.
Completed: ALTER DATABASE   MOUNT
Fri Oct 24 12:41:14 2008
ALTER DATABASE OPEN
Fri Oct 24 12:41:14 2008
Errors in file /oracle/admin/yscz/bdump/yscz_lgwr_5281.trc:
ORA-00322: log 2 of thread 1 is not current copy
ORA-00312: online log 2 thread 1: '/oracle/oradata/yscz/redo02.log'
Fri Oct 24 12:41:14 2008
Errors in file /oracle/admin/yscz/bdump/yscz_lgwr_5281.trc:
ORA-00322: log 2 of thread 1 is not current copy
ORA-00312: online log 2 thread 1: '/oracle/oradata/yscz/redo02.log'

ORA-322 signalled during: ALTER DATABASE OPEN...
Fri Oct 24 12:42:09 2008
Restarting dead background process QMN0
QMN0 started with pid=9
Fri Oct 24 12:44:57 2008
Starting ORACLE instance (normal)
Fri Oct 24 12:45:04 2008
Shutting down instance: further logons disabled
Shutting down instance (immediate)
License high water mark = 3
All dispatchers and shared servers shutdown
Fri Oct 24 12:45:07 2008
ALTER DATABASE CLOSE NORMAL
ORA-1109 signalled during: ALTER DATABASE CLOSE NORMAL...
Fri Oct 24 12:45:07 2008
ALTER DATABASE DISMOUNT
Completed: ALTER DATABASE DISMOUNT
ARCH: Archiving is disabled
Shutting down archive processes
Archiving is disabled
Archive process shutdown avoided: 0 active
ARCH: Archiving is disabled
Shutting down archive processes
Archiving is disabled
Archive process shutdown avoided: 0 active
Fri Oct 24 12:46:36 2008
Starting ORACLE instance (normal)
LICENSE_MAX_SESSION = 0
LICENSE_SESSIONS_WARNING = 0
SCN scheme 2
Using log_archive_dest parameter default value
LICENSE_MAX_USERS = 0
SYS auditing is disabled
Starting up ORACLE RDBMS Version: 9.2.0.4.0.
System parameters with non-default values:
  processes                = 150
  timed_statistics         = TRUE
  shared_pool_size         = 83886080
  large_pool_size          = 16777216
  java_pool_size           = 83886080
  control_files            = /oracle/oradata/yscz/control01.ctl, /oracle/oradata/yscz/control02.ctl, /oracle/oradata/yscz/control03.ctl
  db_block_size            = 8192
  db_cache_size            = 33554432
  compatible               = 9.2.0.0.0
  db_file_multiblock_read_count= 16
  fast_start_mttr_target   = 300
  undo_management          = AUTO
  undo_tablespace          = UNDOTBS1
  undo_retention           = 10800
  remote_login_passwordfile= EXCLUSIVE
  db_domain                =
  instance_name            = yscz
  dispatchers              = (PROTOCOL=TCP) (SERVICE=ysczXDB)
  job_queue_processes      = 10
  hash_join_enabled        = TRUE
  background_dump_dest     = /oracle/admin/yscz/bdump
  user_dump_dest           = /oracle/admin/yscz/udump
  core_dump_dest           = /oracle/admin/yscz/cdump
  sort_area_size           = 524288
  db_name                  = yscz
  open_cursors             = 300
  star_transformation_enabled= FALSE
  query_rewrite_enabled    = FALSE
  pga_aggregate_target     = 25165824
  aq_tm_processes          = 1
PMON started with pid=2
DBW0 started with pid=3
LGWR started with pid=4
CKPT started with pid=5
SMON started with pid=6
RECO started with pid=7
CJQ0 started with pid=8
QMN0 started with pid=9
Fri Oct 24 12:46:38 2008
starting up 1 shared server(s) ...
starting up 1 dispatcher(s) for network address '(ADDRESS=(PARTIAL=YES)(PROTOCOL=TCP))'...
Fri Oct 24 12:46:39 2008
ALTER DATABASE   MOUNT
Fri Oct 24 12:46:43 2008
Successful mount of redo thread 1, with mount id 677927087.
Fri Oct 24 12:46:43 2008
Database mounted in Exclusive Mode.
Completed: ALTER DATABASE   MOUNT
Fri Oct 24 12:46:43 2008
ALTER DATABASE OPEN
Fri Oct 24 12:46:43 2008
Errors in file /oracle/admin/yscz/bdump/yscz_lgwr_5323.trc:
ORA-00322: log 2 of thread 1 is not current copy
ORA-00312: online log 2 thread 1: '/oracle/oradata/yscz/redo02.log'
Fri Oct 24 12:46:43 2008
Errors in file /oracle/admin/yscz/bdump/yscz_lgwr_5323.trc:
ORA-00322: log 2 of thread 1 is not current copy
ORA-00312: online log 2 thread 1: '/oracle/oradata/yscz/redo02.log'
ORA-322 signalled during: ALTER DATABASE OPEN...

Shutting down instance: further logons disabled
Shutting down instance (immediate)
License high water mark = 3
All dispatchers and shared servers shutdown
Fri Oct 24 12:46:54 2008
ALTER DATABASE CLOSE NORMAL
ORA-1109 signalled during: ALTER DATABASE CLOSE NORMAL...
Fri Oct 24 12:46:54 2008
ALTER DATABASE DISMOUNT
Completed: ALTER DATABASE DISMOUNT
ARCH: Archiving is disabled
Shutting down archive processes
Archiving is disabled
Archive process shutdown avoided: 0 active
ARCH: Archiving is disabled
Shutting down archive processes
Archiving is disabled
Archive process shutdown avoided: 0 active
Fri Oct 24 13:43:17 2008
Starting ORACLE instance (normal)
LICENSE_MAX_SESSION = 0
LICENSE_SESSIONS_WARNING = 0
SCN scheme 2
Using log_archive_dest parameter default value
LICENSE_MAX_USERS = 0
SYS auditing is disabled

从上面的代码中,发现红字部分正式出错根源,错误号码是ORA-00322和ORA-00312;

从网上查看相关的文档,里面说了一个解决办法:

 

|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

今天有台Oracle9i无法启动,出现如下错误:
ora-00322:log 1of thread 1 is not current copy
ora-00312:online log 1thread 1:'opt/oracle/oradata/oradb/REDO02.LOG'

解决办法如下:
1. shutdown  immediate;
2. startup mount;
3. alter database clear logfile 'opt/oracle/oradata/oradb/REDO02.LOG';
4. alter database open;
5. select status from v$instance;
看到Oracle可以正常启动了;

||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

登上去,做了类似的操做后,问题解决了。

  metalink的解释

Problem Description:
====================

You have a media failure, which causes the database to crash.

 
Problem Explanation:
====================

At startup, the database will mount, but gives the following errors at open:

  ORA-00312: "online log %s thread %s: '%s'"
      Cause: This message reports the filename for details of another message.
     Action: Other messages will accompany this message. See the
             associated messages for the appropriate action to take.

  ORA-00322: "log %s of thread %s is not current copy"
      Cause: Check of log file header at database open found that an online log
             appears to be an incorrectly restored backup.
     Action: Restore correct file or reset logs.


Search Words:
=============

Hardware, recover

Solution Description:
=====================

First check that ORACLE_HOME and ORACLE_SID are set correctly, and if not, do
so and re-start. Else, continue as follows.

Recover the loss of an inactive, online redo log group.

ALTER DATABASE CLEAR LOGFILE 'filename';

If there is more than one LOGFILE in the redo log group then you must
specify all the log files.

For example, the following fails:

SVRMGR> alter database clear logfile '/vobs/oracle/dbs/log3.log';
alter database clear logfile '/vobs/oracle/dbs/log3.log'
*
ORA-1514: error in log specification: no such log
ORA-1517: log member: '/vobs/oracle/dbs/log3.log

But, specifying all the log files in the group works:
SVRMGR> ALTER DATABASE CLEAR LOGFILE ('/vobs/oracle/dbs/t4.log','/vobs/oracle/;
Statement processed.

For more information Ref: Bug 763186

 
Solution Explanation:
=====================
 
The database, at open, does a check of log file headers and
found an online log that appears to be an incorrected restored file.
In this case it was not incorrect, but inactive. By issuing
the clear logfile, you can avoid going through an uneccessary
open resetlogs when applicable.

<think>嗯,用户现在遇到了ORA-02045错误,需要我提供原因和解决方案。根据我的知识库,这个错误通常与分布式事务相关,特别是在分布式数据库环境中配置不当或权限问题时容易出现。 用户之前引用了三个来源,但这些引用其实和当前问题关联不大。引用[1]讨论的是ORA-39006内部错误,引用[2]是关于账户锁定的ORA-28000,引用[3]则涉及数据库启动故障。虽然都不是直接相关,但注意到用户特别强调要参考历史记录,说明ta可能正在排查复杂的数据库故障链。 考虑到用户查询的具体性,我需要聚焦在ORA-02045的核心特征上。这个错误的关键词是"distributed transaction"和"configuration",通常发生在以下场景:当远程数据库的INIT.ORA参数设置与本地不兼容时;或者用户缺乏必要的角色权限。解决方案应该分层次:先检查基本参数兼容性,再验证权限配置。 值得注意的风险点是:修改global_names参数需要重启实例,这点必须明确告知用户。权限修复部分的SQL示例要确保准确性,特别是ADM权限的授予语法容易出错。另外补充的检查项也很重要,特别是监听器和tnsnames配置,用户容易忽略网络层的影响。 用户看起来具备一定Oracle基础(能提供具体错误号),但可能对分布式事务不熟悉。所以解释时要区分概念:比如"全局数据库名"需要明确说明是"db_name.db_domain"的拼接格式。解决方案步骤必须可操作,避免模糊表述如"检查参数",而要具体到参数文件和视图名称。 最后主动提供延伸方向是必要的:分布式事务排错确实复杂,用户后续可能会遇到ORA-02068等关联错误。补充的"相关问题"特意加入了RAC环境下的特殊情况,这是实际运维中常见但文档较少提及的场景。 </think>ORA-02045错误的根本原因在于**分布式事务配置问题**或**权限缺失**,尤其在使用Oracle分布式数据库(dblink)时。以下是详细分析及解决方案: --- ### **错误原因** 1. **分布式事务配置不一致** 当本地数据库尝试启动远程数据库的分布式事务时,两端的`INIT.ORA`(或`SPFILE`)关键参数必须兼容: - `global_names` 参数值不同(本地为 `TRUE`,远程为 `FALSE`)。 - `distributed_transactions` 参数未启用或值过小(需 >0)。 2. **权限不足** 执行分布式事务的用户缺乏以下权限: - `FORCE ANY TRANSACTION` 系统权限。 - `SELECT` 权限访问远程表的权限(若涉及DML)。 3. **网络或服务名问题** - 远程数据库的服务名未在本地`tnsnames.ora`正确配置。 - 监听器无法连通远程数据库。 --- ### **解决方案(逐步操作)** #### **步骤1:检查参数一致性** ```sql -- 在本地和远程数据库分别执行: SHOW PARAMETER global_names; -- 必须均为 TRUE 或 均为 FALSE SHOW PARAMETER distributed_transactions; -- 需 >0(建议10以上) ``` - **修复不一致**: ```sql ALTER SYSTEM SET global_names = TRUE|FALSE SCOPE=BOTH; -- 两端设为相同值 ALTER SYSTEM SET distributed_transactions = 10 SCOPE=SPFILE; -- 修改后需重启实例 ``` > **注意**:修改`distributed_transactions`需重启数据库生效。 #### **步骤2:授予必要权限** 为执行分布式操作的用户授权: ```sql GRANT FORCE ANY TRANSACTION TO <用户名>; -- 强制事务权限 GRANT SELECT ON <远程表名> TO <用户名>; -- 远程表访问权限(若需查询) GRANT EXECUTE ON DBMS_TRANSACTION TO <用户名>; -- 事务包执行权限 ``` #### **步骤3:验证服务名配置** 1. 检查本地`tnsnames.ora`中远程数据库的服务名: ```conf REMOTE_DB = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = <远程主机IP>)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = <远程实例名>)) ) ``` 2. 使用`tnsping`测试连通性: ```bash tnsping REMOTE_DB ``` #### **步骤4:检查监听状态(远程服务器)** ```bash lsnrctl status # 确认监听器正常运行且服务已注册 ``` --- ### **补充检查项** 1. **全局数据库名一致性** 若`global_names=TRUE`,本地使用的dblink名**必须等于**远程数据库的全局名: ```sql SELECT * FROM GLOBAL_NAME@<dblink名>; -- 返回结果应与远程库的全局名一致 ``` 2. **事务恢复状态** 查询`DBA_2PC_PENDING`视图,清理异常事务: ```sql SELECT * FROM DBA_2PC_PENDING; -- 若有残留事务 EXEC DBMS_TRANSACTION.PURGE_LOST_DB_ENTRY('<事务ID>'); ``` --- ### **典型错误场景示例** ```sql -- 错误案例:global_names=TRUE时使用非全局名的dblink UPDATE remote_table@my_dblink SET ... ; -- ORA-02045若my_dblink≠远程全局名 -- 正确写法(当global_names=TRUE时): UPDATE remote_table@ORCL_PDB1.EXAMPLE.COM SET ... ; -- dblink名=远程全局名 ``` > **提示**:通过`SELECT * FROM GLOBAL_NAME;`可查询当前库全局名[^2]。 --- ### **相关问题** 1. ORA-02068如何解决?(分布式事务中的后续错误) 2. 如何监控Oracle分布式事务的状态? 3. 在RAC环境中配置dblink需要注意什么? 4. `global_names`参数设为`TRUE`的优缺点是什么? [^1]: ORA-39213错误通常与数据泵元数据处理异常相关,与分布式事务无关。 [^2]: ORA-28000的账户锁定机制由`FAILED_LOGIN_ATTEMPTS`控制,与分布式事务权限无关。 [^3]: ORA-01092等启动错误多因字典表损坏,需通过`recover database`或PITR修复。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值