12c: ORA-00210 & ORA-01079
如题所示的问题,发生在我的12c的多租户数据库启动的时候,具体表现如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
[oracle@rhel7 ~]$ env | grep SID ORACLE_SID=callah [oracle@rhel7 ~]$ [oracle@rhel7 ~]$ sqlplus / as sysdba SQL*Plus: Release 12.1.0.2.0 Production on Thu Apr 21 11:19:37 2016 Copyright (c) 1982, 2014, Oracle. All rights reserved. Connected to an idle instance. SQL> startup ORACLE instance started. Total System Global Area 251658240 bytes Fixed Size 2923096 bytes Variable Size 192939432 bytes Database Buffers 50331648 bytes Redo Buffers 5464064 bytes ORA-00205: error in identifying control file, check alert log for more info SQL> |
这个时候,我的后台日志(alert日志)的报错是这样的:
1 2 3 4 5 6 7 8 |
alter database mount Thu Apr 21 11:23:44 2016 ORA-00210: cannot open the specified control file ORA-00202: control file: '/u01/app/oracle/product/12/db_1/dbs/cntrlcallah.dbf' 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... |
报错中,提到的控制文件:“cntrlcallah.dbf”,确实不存在:
1 2 3 4 5 |
[oracle@rhel7 controlfile]$ ls /u01/app/oracle/product/12/db_1/dbs/ | grep --color callah hc_callah.dat initcallah.ora spfilecallah.ora [oracle@rhel7 controlfile]$ |
但是OMF管理的“oradata”目录下,却存在一切控制文件:
1 2 3 4 5 6 |
[oracle@rhel7 controlfile]$ pwd /u01/app/oracle/oradata/CALLAH/controlfile [oracle@rhel7 controlfile]$ [oracle@rhel7 controlfile]$ ls o1_mf_ck5rsmv9_.ctl o1_mf_ck5s1qh5_.ctl [oracle@rhel7 controlfile]$ |
将实例的控制文件,修改(指定)为上面找到的控制文件:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
(当前数据库不是SPFILE启动的:) SQL> show parameter spfile NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ spfile string (从当前的PFILE创建SPFILE) SQL> create spfile from pfile; File created. (以SPFILE方式,重新启动数据库) SQL> shutdown immediate; ORA-01507: database not mounted ORACLE instance shut down. SQL> SQL> startup nomount; ORACLE instance started. Total System Global Area 251658240 bytes Fixed Size 2923096 bytes Variable Size 192939432 bytes Database Buffers 50331648 bytes Redo Buffers 5464064 bytes SQL> SQL> show parameter pfile NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ spfile string /u01/app/oracle/product/12/db_ 1/dbs/spfilecallah.ora SQL> (修改参数“control_files”) SQL> alter system set control_files='/u01/app/oracle/oradata/CALLAH/controlfile/o1_mf_ck5rsmv9_.ctl' scope=spfile; System altered. SQL> (重启数据库后,对参数的修改才会生效) SQL> shutdown immediate; ORA-01507: database not mounted ORACLE instance shut down. SQL> SQL> !env | grep SID ORACLE_SID=callah SQL> SQL> startup nomount; ORACLE instance started. Total System Global Area 251658240 bytes Fixed Size 2923096 bytes Variable Size 192939432 bytes Database Buffers 50331648 bytes Redo Buffers 5464064 bytes SQL> SQL> alter database mount; alter database mount * ERROR at line 1: ORA-01079: ORACLE database was not properly created, operation aborted SQL> |
可以看到,还是出问题了。
这个时候,后台日志(alert)的报错,如下:
1 2 3 |
Thu Apr 21 14:07:08 2016 alter database mount ORA-1079 signalled during: alter database mount... |
解法:
在数据库“NOMOUNT”阶段重建控制文件:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
SQL> select instance_name,status from v$instance; INSTANCE_NAME STATUS ---------------- ------------ callah STARTED SQL> SQL> create controlfile reuse database "callah" noresetlogs archivelog 2 maxlogfiles 16 3 maxlogmembers 3 4 maxloghistory 1 5 maxdatafiles 1024 6 logfile 7 group 1 ('/u01/app/oracle/oradata/callah/redo01a.log','/u01/app/oracle/oradata/callah/redo01b.log') size 100m, 8 group 2 ('/u01/app/oracle/oradata/callah/redo02a.log','/u01/app/oracle/oradata/callah/redo02b.log') size 100m, 9 group 3 ('/u01/app/oracle/oradata/callah/redo03a.log','/u01/app/oracle/oradata/callah/redo03b.log') size 100m 10 datafile 11 '/u01/app/oracle/oradata/callah/pdb_seed_datasysaux01.dbf', 12 '/u01/app/oracle/oradata/callah/pdb_seed_datasystem01.dbf', 13 '/u01/app/oracle/oradata/callah/pdb_seed_datausers01.dbf', 14 '/u01/app/oracle/oradata/callah/sysaux01.dbf', 15 '/u01/app/oracle/oradata/callah/system01.dbf', 16 '/u01/app/oracle/oradata/callah/undotbs01a.dbf', 17 '/u01/app/oracle/oradata/callah/users01.dbf' 18 character set AL32UTF8 19 ; Control file created. SQL> SQL> select instance_name,status from v$instance; INSTANCE_NAME STATUS ---------------- ------------ callah MOUNTED SQL> |
可以看到,当控制文件成功的创建完成后,数据库的状态就从NOMOUNT,到MOUNT了。
而这一步需要注意:创建控制文件的时候,引用的datafile的部分,不要包含临时表空间的数据文件。(CDB与PDB的临时文件都不能包含)
然后,数据库就可以打开了:
1 2 3 4 5 6 7 8 9 10 11 12 |
SQL> alter database open; Database altered. SQL> SQL> select instance_name,status from v$instance; INSTANCE_NAME STATUS ---------------- ------------ callah OPEN SQL> |
上面,从创建控制文件到数据库OPEN,这部分的后台日志(alert)如下:
控制文件的创建部分:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
create controlfile reuse database "callah" noresetlogs archivelog maxlogfiles 16 maxlogmembers 3 maxloghistory 1 maxdatafiles 1024 logfile group 1 ('/u01/app/oracle/oradata/callah/redo01a.log','/u01/app/oracle/oradata/callah/redo01b.log') size 100m, group 2 ('/u01/app/oracle/oradata/callah/redo02a.log','/u01/app/oracle/oradata/callah/redo02b.log') size 100m, group 3 ('/u01/app/oracle/oradata/callah/redo03a.log','/u01/app/oracle/oradata/callah/redo03b.log') size 100m datafile '/u01/app/oracle/oradata/callah/pdb_seed_datasysaux01.dbf', '/u01/app/oracle/oradata/callah/pdb_seed_datasystem01.dbf', '/u01/app/oracle/oradata/callah/pdb_seed_datausers01.dbf', '/u01/app/oracle/oradata/callah/sysaux01.dbf', '/u01/app/oracle/oradata/callah/system01.dbf', '/u01/app/oracle/oradata/callah/undotbs01a.dbf', '/u01/app/oracle/oradata/callah/users01.dbf' character set AL32UTF8 Fri Apr 22 11:21:54 2016 WARNING: Default Temporary Tablespace not specified in CREATE DATABASE command Default Temporary Tablespace will be necessary for a locally managed database in future release Fri Apr 22 11:21:54 2016 Successful mount of redo thread 1, with mount id 653421906 Completed: create controlfile reuse database "callah" noresetlogs archivelog maxlogfiles 16 maxlogmembers 3 maxloghistory 1 maxdatafiles 1024 logfile group 1 ('/u01/app/oracle/oradata/callah/redo01a.log','/u01/app/oracle/oradata/callah/redo01b.log') size 100m, group 2 ('/u01/app/oracle/oradata/callah/redo02a.log','/u01/app/oracle/oradata/callah/redo02b.log') size 100m, group 3 ('/u01/app/oracle/oradata/callah/redo03a.log','/u01/app/oracle/oradata/callah/redo03b.log') size 100m datafile '/u01/app/oracle/oradata/callah/pdb_seed_datasysaux01.dbf', '/u01/app/oracle/oradata/callah/pdb_seed_datasystem01.dbf', '/u01/app/oracle/oradata/callah/pdb_seed_datausers01.dbf', '/u01/app/oracle/oradata/callah/sysaux01.dbf', '/u01/app/oracle/oradata/callah/system01.dbf', '/u01/app/oracle/oradata/callah/undotbs01a.dbf', '/u01/app/oracle/oradata/callah/users01.dbf' character set AL32UTF8 |
数据库OPEN的部分:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
alter database open Fri Apr 22 11:25:59 2016 Ping without log force is disabled . Initializing SCN for created control file Database SCN compatibility initialized to 1 Starting background process TMON Fri Apr 22 11:25:59 2016 TMON started with pid=21, OS id=100127 Fri Apr 22 11:25:59 2016 LGWR: STARTING ARCH PROCESSES Starting background process ARC0 Fri Apr 22 11:25:59 2016 ARC0 started with pid=22, OS id=100129 ARC0: Archival started LGWR: STARTING ARCH PROCESSES COMPLETE Fri Apr 22 11:25:59 2016 ARC0: STARTING ARCH PROCESSES Starting background process ARC1 Fri Apr 22 11:25:59 2016 ARC1 started with pid=23, OS id=100131 Starting background process ARC2 Fri Apr 22 11:25:59 2016 ARC2 started with pid=24, OS id=100133 Starting background process ARC3 Fri Apr 22 11:25:59 2016 ARC3 started with pid=25, OS id=100135 ARC1: Archival started ARC2: Archival started ARC3: Archival started ARC0: STARTING ARCH PROCESSES COMPLETE ARC0: Becoming the 'no FAL' ARCH ARC0: Becoming the 'no SRL' ARCH Fri Apr 22 11:25:59 2016 ARC1: Becoming the heartbeat ARCH Fri Apr 22 11:26:06 2016 Warning: VKTM detected a time drift. Time drifts can result in an unexpected behavior such as time-outs. Please check trace file for more details. Fri Apr 22 11:26:07 2016 Archived Log entry 1 added for thread 1 sequence 10 ID 0x26ebd7b7 dest 1: Fri Apr 22 11:26:07 2016 Thread 1 advanced to log sequence 13 (thread open) Thread 1 opened at log sequence 13 Current log# 1 seq# 13 mem# 0: /u01/app/oracle/oradata/callah/redo01a.log Current log# 1 seq# 13 mem# 1: /u01/app/oracle/oradata/callah/redo01b.log Successful open of redo thread 1 Fri Apr 22 11:26:07 2016 MTTR advisory is disabled because FAST_START_MTTR_TARGET is not set Fri Apr 22 11:26:07 2016 SMON: enabling cache recovery Fri Apr 22 11:26:12 2016 Archived Log entry 2 added for thread 1 sequence 11 ID 0x26ebd7b7 dest 1: Fri Apr 22 11:26:16 2016 Archived Log entry 3 added for thread 1 sequence 12 ID 0x26ebd7b7 dest 1: Fri Apr 22 11:26:17 2016 [99533] Successfully onlined Undo Tablespace 2. Undo initialization finished serial:0 start:263091364 end:263095134 diff:3770 ms (3.8 seconds) Dictionary check beginning Tablespace 'TEMPTBS01' #3 found in data dictionary, but not in the controlfile. Adding to controlfile. Dictionary check complete Verifying minimum file header compatibility (11g) for tablespace encryption.. Verifying 11g file header compatibility for tablespace encryption completed Fri Apr 22 11:26:17 2016 SMON: enabling tx recovery Fri Apr 22 11:26:17 2016 ********************************************************************* WARNING: The following temporary tablespaces in container(CDB$ROOT) contain no files. This condition can occur when a backup controlfile has been restored. It may be necessary to add files to these tablespaces. That can be done using the SQL statement: ALTER TABLESPACE <tablespace_name> ADD TEMPFILE Alternatively, if these temporary tablespaces are no longer needed, then they can be dropped. Empty temporary tablespace: TEMPTBS01 ********************************************************************* Starting background process SMCO Database Characterset is AL32UTF8 Fri Apr 22 11:26:18 2016 SMCO started with pid=27, OS id=100152 No Resource Manager plan active ********************************************************** WARNING: Files may exists in db_recovery_file_dest that are not known to the database. Use the RMAN command CATALOG RECOVERY AREA to re-catalog any such files. If files cannot be cataloged, then manually delete them using OS command. One of the following events caused this: 1. A backup controlfile was restored. 2. A standby controlfile was restored. 3. The controlfile was re-created. 4. db_recovery_file_dest had previously been enabled and then disabled. ********************************************************** replication_dependency_tracking turned off (no async multimaster replication found) Starting background process AQPC Fri Apr 22 11:26:26 2016 AQPC started with pid=30, OS id=100158 LOGSTDBY: Validating controlfile with logical metadata LOGSTDBY: Validation complete Fri Apr 22 11:26:28 2016 Pluggable database PDB$SEED dictionary check beginning Tablespace 'TEMPTBS01' #2 found in data dictionary, but not in the controlfile. Adding to controlfile. Pluggable Database PDB$SEED Dictionary check complete Database Characterset for PDB$SEED is AL32UTF8 ********************************************************************* WARNING: The following temporary tablespaces in container(PDB$SEED) contain no files. This condition can occur when a backup controlfile has been restored. It may be necessary to add files to these tablespaces. That can be done using the SQL statement: ALTER TABLESPACE <tablespace_name> ADD TEMPFILE Alternatively, if these temporary tablespaces are no longer needed, then they can be dropped. Empty temporary tablespace: TEMPTBS01 ********************************************************************* Due to limited space in shared pool (need 6094848 bytes, have 3981120 bytes), limiting Resource Manager entities from 2048 to 32 Opening pdb PDB$SEED (2) with no Resource Manager plan active Fri Apr 22 11:26:30 2016 ORA-7452: resource manager plan 'INTERNAL_PLAN' does not exist Fri Apr 22 11:26:30 2016 Resource Manager failed to initialize on pdb 2 Starting background process CJQ0 Fri Apr 22 11:26:31 2016 CJQ0 started with pid=31, OS id=100170 Completed: alter database open Fri Apr 22 11:26:44 2016 Shared IO Pool defaulting to 4MB. Trying to get it from Buffer Cache for process 72681. =========================================================== Dumping current patch information =========================================================== No patches have been applied =========================================================== Fri Apr 22 11:26:46 2016 db_recovery_file_dest_size of 4827 MB is 4.48% used. This is a user-specified limit on the amount of space that will be used by this database for recovery-related files, and does not reflect the amount of space available in the underlying filesystem or ASM diskgroup. |
可以从日志中看到,由于创建控制文件的时候,没有跟上临时文件,于是有了一些关于临时文件的告警:
*********************************************************************
WARNING: The following temporary tablespaces in container(CDB$ROOT)
contain no files.
This condition can occur when a backup controlfile has
been restored. It may be necessary to add files to these
tablespaces. That can be done using the SQL statement:
ALTER TABLESPACE
Alternatively, if these temporary tablespaces are no longer
needed, then they can be dropped.
Empty temporary tablespace: TEMPTBS01
*********************************************************************
在处理临时文件的问题前,我们先查看下当前数据库的状态:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
SQL> select con_id,dbid,name,open_mode from v$pdbs; CON_ID DBID NAME OPEN_MODE ---------- ---------- ------------------------------ ---------- 2 3126348575 PDB$SEED READ ONLY SQL> col member for a50 SQL> set linesize 400 SQL> select con_id,group#,member from v$logfile order by con_id,group#; CON_ID GROUP# MEMBER ---------- ---------- -------------------------------------------------- 0 1 /u01/app/oracle/oradata/callah/redo01a.log 0 1 /u01/app/oracle/oradata/callah/redo01b.log 0 2 /u01/app/oracle/oradata/callah/redo02a.log 0 2 /u01/app/oracle/oradata/callah/redo02b.log 0 3 /u01/app/oracle/oradata/callah/redo03a.log 0 3 /u01/app/oracle/oradata/callah/redo03b.log 6 rows selected. SQL> col name for a70 SQL> select con_id,name from v$controlfile order by con_id; CON_ID NAME ---------- ---------------------------------------------------------------------- 0 /u01/app/oracle/oradata/CALLAH/controlfile/o1_mf_ck5rsmv9_.ctl SQL> !ls -ltr /u01/app/oracle/oradata/CALLAH/controlfile/ total 34848 -rw-r----- 1 oracle oinstall 17842176 Apr 19 20:47 o1_mf_ck5s1qh5_.ctl -rw-r----- 1 oracle oinstall 17842176 Apr 22 11:40 o1_mf_ck5rsmv9_.ctl SQL> !date Fri Apr 22 11:40:46 CST 2016 SQL> !ls -ltr $ORACLE_HOME/dbs total 60 -rw-r--r-- 1 oracle oinstall 2992 Feb 3 2012 init.ora -rw-r--r-- 1 oracle oinstall 383 Apr 16 23:31 initcallah.ora -rw-r----- 1 oracle oinstall 24 Apr 16 23:42 lkCALLAH -rw-r----- 1 oracle oinstall 24 Apr 19 17:17 lkORCL -rw-r----- 1 oracle oinstall 7680 Apr 19 17:24 orapworcl -rw-r----- 1 oracle oinstall 24 Apr 19 21:17 lkCONME -rw-r----- 1 oracle oinstall 7680 Apr 19 21:22 orapwconme -rw-rw---- 1 oracle oinstall 1544 Apr 20 10:41 hc_conme.dat -rw-rw---- 1 oracle oinstall 1544 Apr 20 22:41 hc_orcl.dat -rw-r----- 1 oracle oinstall 3584 Apr 20 22:41 spfileorcl.ora -rw-r----- 1 oracle oinstall 2560 Apr 21 11:29 spfilecallah.ora -rw-r----- 1 oracle oinstall 3584 Apr 22 01:00 spfileconme.ora -rw-rw---- 1 oracle oinstall 1544 Apr 22 11:26 hc_callah.dat SQL> SQL> set linesize 400 SQL> set pagesize 400 SQL> SQL> col file_name for a70 SQL> col tablespace_name for a16 SQL> col file_id for 9999 SQL> col con_id for 999 SQL> SQL> select con_id,file_id,file_name,tablespace_name from cdb_data_files order by con_id,tablespace_name,file_id; CON_ID FILE_ID FILE_NAME TABLESPACE_NAME ------ ------- ---------------------------------------------------------------------- ---------------- 1 3 /u01/app/oracle/oradata/callah/sysaux01.dbf SYSAUX 1 1 /u01/app/oracle/oradata/callah/system01.dbf SYSTEM 1 5 /u01/app/oracle/oradata/callah/undotbs01a.dbf UNDOTBS01 1 6 /u01/app/oracle/oradata/callah/users01.dbf USERS SQL> SQL> col name for a12 SQL> select ts.con_id,file#,ts.name,ts.ts# from v$datafile d,v$tablespace ts where d.ts#=ts.ts# and d.con_id=ts.con_id order by ts.con_id,ts.ts#,file#; CON_ID FILE# NAME TS# ------ ---------- ------------ ---------- 1 1 SYSTEM 0 1 3 SYSAUX 1 1 5 UNDOTBS01 2 1 6 USERS 4 2 2 SYSTEM 0 2 4 SYSAUX 1 2 7 USERS 3 7 rows selected. SQL> col name for a45 SQL> select file_id,file_name,tablespace_name from cdb_temp_files; no rows selected SQL> |
可以看到,确实查不到有关临时文件的信息。
创建临时表空间,并设为默认临时表空间:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
SQL> set linesize 900 SQL> set pagesize 900 SQL> col file_name for a70 SQL> col tablespace_name for a16 SQL> SQL> create temporary tablespace temp tempfile '/u01/app/oracle/oradata/callah/temp01.dbf' size 400m reuse autoextend on next 100m maxsize unlimited; Tablespace created. SQL> SQL> select file_id,file_name,tablespace_name from cdb_temp_files; FILE_ID FILE_NAME TABLESPACE_NAME ---------- ---------------------------------------------------------------------- ---------------- 1 /u01/app/oracle/oradata/callah/temp01.dbf TEMP SQL> SQL> alter database default temporary tablespace temp; Database altered. SQL> |
——————————————————
Done。