暂无图片
暂无图片
1
暂无图片
暂无图片
暂无图片

只有数据文件启动数据库,遇到的ora-00600[2662]错误

dm5250 2025-06-04
103

    遇到了一个客户,只复制了数据文件,问能不能恢复,我以为是所有的oracle文件夹,包括了redo,归档,数据文件,控制文件,密码文件,spfile等等,结果给到手的只有几个数据文件。不过比想象中的好,起码数据文件是齐的。

   

1、查看数据文件

[root@db01:/root]# cd /oracle/
[root@db01:/oracle]# ll
total 3860720
-rw-r----- 1 root root 1017126912 Jun  3 16:28 sysaux01.dbf
-rw-r----- 1 root root  796925952 Jun  3 16:28 system01.dbf
-rw-r----- 1 root root 1623400448 Jun  3 16:28 t1.dbf
-rw-r----- 1 root root  243277824 Jun  3 16:28 temp01.dbf
-rw-r----- 1 root root  246423552 Jun  3 16:28 undotbs01.dbf
-rw-r----- 1 root root   26222592 Jun  3 16:28 users01.dbf
[root@db01:/oracle]# du -sh *
971M    sysaux01.dbf
761M    system01.dbf
1.6G    t1.dbf
233M    temp01.dbf
236M    undotbs01.dbf


2、查看数据库信息

    通过查看system01.dbf,可以看到数据库相关的信息。

[root@db01:/oracle]# dd if=/oracle/system01.dbf of=/tmp/dbinfo bs=8192 skip=801 count=1
[root@db01:/oracle]# strings /tmp/dbinfo |more
GLOBAL_DB_NAME
ORCL
Global database name,
DBTIMEZONE
00:00
DB time zone,
NO_USERID_VERIFIER_SALT 61FE9A498A8FB6995B77028E02D6C276,
WORKLOAD_REPLAY_MODE
bPREPARE implies external replay clients can connect; REPLAY implies workload replay is in progress,
WORKLOAD_CAPTURE_MODE
/CAPTURE implies workload capture is in progress,
EXPORT_VIEWS_VERSION
Export views revision #,
DEFAULT_PERMANENT_TABLESPACE
USERS$Name of default permanent tablespace,
GLOBAL_DB_NAME
SEEDDATA
Global database name,
NLS_RDBMS_VERSION
11.2.0.4.0 RDBMS version for NLS parameters,
NLS_NCHAR_CHARACTERSET  AL16UTF16
NCHAR Character set,
NLS_NCHAR_CONV_EXCP
FALSE
NLS conversion exception,
NLS_LENGTH_SEMANTICS
BYTE
NLS length semantics,
NLS_COMP
BINARY
NLS comparison,
NLS_DUAL_CURRENCY
Dual currency symbol,
NLS_TIMESTAMP_TZ_FORMAT
DD-MON-RR HH.MI.SSXFF AM TZR
Timestamp with timezone format,
NLS_TIME_TZ_FORMAT
HH.MI.SSXFF AM TZR
Time with timezone format,
NLS_TIMESTAMP_FORMAT
DD-MON-RR HH.MI.SSXFF AM
Time stamp format,
NLS_TIME_FORMAT
HH.MI.SSXFF AM
Time format,
NLS_SORT
BINARY
Linguistic definition,
NLS_DATE_LANGUAGE
AMERICAN
Date language,
NLS_DATE_FORMAT DD-MON-RR
Date format,
NLS_CALENDAR    GREGORIAN
Calendar system,
NLS_CHARACTERSET
ZHS16GBK
Character set,
NLS_NUMERIC_CHARACTERS
Numeric characters,
NLS_ISO_CURRENCY
AMERICA
ISO currency,
NLS_CURRENCY
Local currency,
NLS_TERRITORY
AMERICA Territory,
NLS_LANGUAGE
AMERICAN
Language,
DEFAULT_TBS_TYPE        SMALLFILE
Default tablespace type,
DST_SECONDARY_TT_VERSION
0'Version of secondary timezone data file,
DST_PRIMARY_TT_VERSION
14%Version of primary timezone data file,
DST_UPGRADE_STATE
NONE&State of Day Light Saving Time Upgrade<
DBTIMEZONE
-07:00
DB time zone,
TDE_MASTER_KEY_ID,
Flashback Timestamp TimeZone
GMT"Flashback timestamp created in GMT,
DEFAULT_TEMP_TABLESPACE
TEMP$Name of default temporary tablespace,
DEFAULT_EDITION
ORA$BASE$Name of the database default edition,
DEFAULT_PERMANENT_TABLESPACE
SYSTEM$Name of default permanent tablespace,
DEFAULT_TEMP_TABLESPACE
SYSTEM$Name of default temporary tablespace,
        DICT.BASE
2 dictionary base tables version #

通过strings查看内容,可以确定数据库名字为“orcl”,数据库版本是“11.2.0.4”,字符集为“ZHS16GBK”。


3、安装oracle软件

安装过程略,不建库即可。

[oracle@db01:/home/oracle]$ env|grep ORA
ORACLE_SID=orcl
ORACLE_BASE=/u01/app/oracle
ORACLE_TERM=xterm
ORACLE_HOME=/u01/app/oracle/product/11.2.0/db

--oradata就指定在/oracle目录下了


4、创建pfile文件

[oracle@db01:/u01/app/oracle]$ cd /u01/app/oracle/product/11.2.0/db
[oracle@db01:/u01/app/oracle/product/11.2.0/db]$ cd dbs/
[oracle@db01:/u01/app/oracle/product/11.2.0/db/dbs]$ vi pfile.ora
*.compatible='11.2.0.4'
*.control_files='/oracle/control01.ctl'
*.core_dump_dest='/u01/app/oracle/admin/zen/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_name='orcl'
*.db_unique_name='orcl'
*.job_queue_processes=10
*.pga_aggregate_target=1073741824
*.processes=1500
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=2147483648
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*._allow_resetlogs_corruption=true


5、创建控制文件

5.1、生成脚本

[oracle@db01:/oracle]$ vi /oracle/ctl.sql
CREATE CONTROLFILE REUSE DATABASE "ORCL" RESETLOGS  NOARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 8
    MAXLOGHISTORY 292
LOGFILE
  GROUP 1 '/oracle/redo01.log'  SIZE 50M,
  GROUP 2 '/oracle/redo02.log'  SIZE 50M,
  GROUP 3 '/oracle/redo03.log'  SIZE 50M
DATAFILE
  '/oracle/system01.dbf',
  '/oracle/undotbs01.dbf',
  '/oracle/sysaux01.dbf',
  '/oracle/users01.dbf',
  '/oracle/t1.dbf'
CHARACTER SET ZHS16GBK
;


5.2、创建控制文件

[root@db01:/root]# chown -R  oracle.oinstall /oracle
[root@db01:/root]# su - oracle
[oracle@db01:/home/oracle]$ cd /oracle/
[oracle@db01:/oracle]$ export ORACLE_SID=orcl
[oracle@db01:/oracle]$ sqlplus / as sysdba
SQL> startup nomount pfile='/u01/app/oracle/product/11.2.0/db/dbs/pfile.ora';
ORACLE instance started.

Total System Global Area 2137886720 bytes
Fixed Size                  2254952 bytes
Variable Size             520095640 bytes
Database Buffers         1610612736 bytes
Redo Buffers                4923392 bytes
SQL> @/oracle/ctl.sql

Control file created.

SQL> select instance_name,status from v$instance;

INSTANCE_NAME                                    STATUS
------------------------------------------------ ------------------------------------
orcl                                             MOUNTED


6、启动数据库

SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-00603: ORACLE server session terminated by fatal error
ORA-00600: internal error code, arguments: [2662], [0], [3584235], [0], [3596633], [12583040], [], [], [], [], [], []
ORA-00600: internal error code, arguments: [2662], [0], [3584234], [0], [3596633], [12583040], [], [], [], [], [], []
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00600: internal error code, arguments: [2662], [0], [3584232], [0], [3596633], [12583040], [], [], [], [], [], []
Process ID: 4117
Session ID: 572 Serial number: 3

--错误解释
ORA-600 [2662] [a] [b] [c] [d] [e]
Arg [a] Current SCN WRAP =0
Arg [b] Current SCN BASE  =3584235
Arg [c] dependent SCN WRAP =0 
Arg [d] dependent SCN BASE(数据库块的SCN) =3596633
Arg [e] Where present this is the DBA where the dependent SCN came from. =12583040

c * power(2,32) + d 
SQL> select 0*power(2,32)+ 3596633 from dual;

0*POWER(2,32)+3596633
---------------------
              3596633

--尝试推进scn
SQL> startup nomount pfile='/u01/app/oracle/product/11.2.0/db/dbs/pfile.ora';
ORACLE instance started.

Total System Global Area 2137886720 bytes
Fixed Size                  2254952 bytes
Variable Size             520095640 bytes
Database Buffers         1610612736 bytes
Redo Buffers                4923392 bytes
SQL> @ctl.sql

Control file created.

SQL> select 0*power(2,32)+ 3596633 from dual;

0*POWER(2,32)+3596633
---------------------
              3596633

SQL> oradebug setmypid
Statement processed.
SQL> oradebug dumpvar sga kcsgscn_
kcslf kcsgscn_ [06001AE70, 06001AEA0) = 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 6001AB50 00000000
SQL> select to_char(checkpoint_change#, 'XXXXXXXXXXXXXXXX') from v$database;

TO_CHAR(CHECKPOINT_CHANGE#,'XXXXXXXXXXXXXXXX')
---------------------------------------------------
                0

SQL> oradebug poke 0x06001AE70 8 3596633 
BEFORE: [06001AE70, 06001AE78) = 00000000 00000000
AFTER:  [06001AE70, 06001AE78) = 0036E159 00000000
SQL> oradebug dumpvar sga kcsgscn_
kcslf kcsgscn_ [06001AE70, 06001AEA0) = 0036E159 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 6001AB50 00000000
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open


SQL> alter database open RESETLOGS;
alter database open RESETLOGS
*
ERROR at line 1:
ORA-00603: ORACLE server session terminated by fatal error
ORA-00600: internal error code, arguments: [2662], [0], [3596642], [0],[3596975], [12583056], [], [], [], [], [], []
ORA-00600: internal error code, arguments: [2662], [0], [3596641], [0],[3596975], [12583056], [], [], [], [], [], []
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00600: internal error code, arguments: [2662], [0], [3596639], [0],[3596975], [12583056], [], [], [], [], [], []

Process ID: 62699
Session ID: 572 Serial number: 1

SQL> startup nomount pfile='/u01/app/oracle/product/11.2.0/db/dbs/pfile.ora';
ORACLE instance started.

SQL> @ctl.sql
Control file created.

Total System Global Area 2137886720 bytes
Fixed Size                  2254952 bytes
Variable Size             520095640 bytes
Database Buffers         1610612736 bytes
Redo Buffers                4923392 bytes
SQL> oradebug setmypid
Statement processed.
SQL> oradebug dumpvar sga kcsgscn_
kcslf kcsgscn_ [06001AE70, 06001AEA0) = 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 6001AB50 00000000
SQL> oradebug poke 0x06001AE70 8 3596975
BEFORE: [06001AE70, 06001AE78) = 00000000 00000000
AFTER:  [06001AE70, 06001AE78) = 0036E2AF 00000000
SQL> oradebug dumpvar sga kcsgscn_
kcslf kcsgscn_ [06001AE70, 06001AEA0) = 0036E2AF 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 6001AB50 00000000


SQL> alter database open RESETLOGS;

Database altered.

SQL> alter system switch logfile;

System altered.

SQL> select count(*) from test.t1;

  COUNT(*)
----------
     86286

SQL> update  test.t1 set  owner='hp' where rownum=1;

1 row updated.

SQL> commit;

Commit complete.


整个过程推进了2次scn,后续又做了expdp导出到一个新的数据库中,整个过程完成。

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论