oracle 控制文件的重建
oracle 控制文件的重建
不到最后时刻,如三个控制文件都已损坏,又没有控制文件的备份。还是不要重建控制文件,处理不好就会有数据丢失。
NORESETLOGS
Set #1. NORESETLOGS case
--
-- The following commands will create a new control file and use it
-- to open the database.
-- Data used by Recovery Manager will be lost.
-- Additional logs may be required for media recovery of offline
-- Use this only if the current versions of all online logs are
-- available.
-- After mounting the created controlfile, the following SQL
-- statement will place the database in the appropriate
-- protection mode:
-- ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "KYEUPDB" NORESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 4096
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '+DGSYSTEM/kyeupdb/onlinelog/group_1.266.978829167' SIZE 200M BLOCKSIZE 512,
GROUP 2 '+DGSYSTEM/kyeupdb/onlinelog/group_2.267.978829169' SIZE 200M BLOCKSIZE 512,
GROUP 3 '+DGSYSTEM/kyeupdb/onlinelog/group_3.268.978829173' SIZE 200M BLOCKSIZE 512,
GROUP 4 '+DGSYSTEM/kyeupdb/onlinelog/group_4.269.978829183' SIZE 200M BLOCKSIZE 512,
GROUP 5 '+DGSYSTEM/kyeupdb/onlinelog/group_5.270.978829193' SIZE 200M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
'+DGSYSTEM/kyeupdb/datafile/system.271.978829205',
'+DGSYSTEM/kyeupdb/datafile/sysaux.272.978829265',
'+DGSYSTEM/kyeupdb/datafile/undotbs1.273.978829323',
'+DGSYSTEM/kyeupdb/datafile/users.275.978829391',
'+DGSYSTEM/kyeupdb/datafile/ts_example.277.978855421',
'+DGSYSTEM/kyeupdb/datafile/kye_tbs02.dbf'
CHARACTER SET ZHS16GBK
;
-- Commands to re-create incarnation table
-- Below log names MUST be changed to existing filenames on
-- disk. Any one log file from each branch can be used to
-- re-create incarnation records.
-- ALTER DATABASE REGISTER LOGFILE '/oracle/app/oracle/product/11.2.0/dbs/arch1_1_978829161.dbf';
-- Recovery is required if any of the datafiles are restored backups,
-- or if the last shutdown was not normal or immediate.
RECOVER DATABASE
-- Database can now be opened normally.
ALTER DATABASE OPEN;
-- Files in normal offline tablespaces are now named.
ALTER DATABASE RENAME FILE 'MISSING00006'
TO '+DGSYSTEM/kyeupdb/datafile/kye_tbs01.dbf';
-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE '+DGSYSTEM/kyeupdb/tempfile/temp.274.978829379'
SIZE 1024M REUSE AUTOEXTEND OFF;
-- End of tempfile additions.
操作:
[BEGIN] 2018/6/22 21:28:55
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 3858223104 bytes
Fixed Size 2259080 bytes
Variable Size 788531064 bytes
Database Buffers 3053453312 bytes
Redo Buffers 13979648 bytes
CREATE CONTROLFILE REUSE DATABASE "KYEUPDB" NORESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 4096
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '+DGSYSTEM/kyeupdb/onlinelog/group_1.266.978829167' SIZE 200M BLOCKSIZE 512,
GROUP 2 '+DGSYSTEM/kyeupdb/onlinelog/group_2.267.978829169' SIZE 200M BLOCKSIZE 512,
GROUP 3 '+DGSYSTEM/kyeupdb/onlinelog/group_3.268.978829173' SIZE 200M BLOCKSIZE 512,
GROUP 4 '+DGSYSTEM/kyeupdb/onlinelog/group_4.269.978829183' SIZE 200M BLOCKSIZE 512,
GROUP 5 '+DGSYSTEM/kyeupdb/onlinelog/group_5.270.978829193' SIZE 200M BLOCKSIZE 512
DATAFILE
'+DGSYSTEM/kyeupdb/datafile/system.271.978829205',
'+DGSYSTEM/kyeupdb/datafile/sysaux.272.978829265',
'+DGSYSTEM/kyeupdb/datafile/undotbs1.273.978829323',
'+DGSYSTEM/kyeupdb/datafile/users.275.978829391',
'+DGSYSTEM/kyeupdb/datafile/ts_example.277.978855421',
'+DGSYSTEM/kyeupdb/datafile/kye_tbs02.dbf'
CHARACTER SET ZHS16GBK
21 ;
Control file created.
SQL> recover database;
ORA-00283: recovery session canceled due to errors
ORA-00264: no recovery required
SQL> alter database open;
Database altered.
SQL> select * from dba_temp_files;
no rows selected
ALTER TABLESPACE TEMP ADD TEMPFILE '+DGSYSTEM/kyeupdb/tempfile/temp.274.978829379'
2 SIZE 1024M REUSE AUTOEXTEND OFF;
Tablespace altered.
SQL> select * from dba_temp_files;
FILE_NAME
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FILE_ID TABLESPACE_NAME BYTES BLOCKS STATUS RELATIVE_FNO AUT MAXBYTES MAXBLOCKS INCREMENT_BY USER_BYTES USER_BLOCKS
---------- ------------------------------ ---------- ---------- ------- ------------ --- ---------- ---------- ------------ ---------- -----------
+DGSYSTEM/kyeupdb/tempfile/temp.274.978829379
1 TEMP 1073741824 131072 ONLINE 1 NO 0 0 1072693248 130944
[END] 2018/6/22 21:49:09
RESETLOGS
-- Set #2. RESETLOGS case
--
-- The following commands will create a new control file and use it
-- to open the database.
-- Data used by Recovery Manager will be lost.
-- The contents of online logs will be lost and all backups will
-- be invalidated. Use this only if online logs are damaged.
-- After mounting the created controlfile, the following SQL
-- statement will place the database in the appropriate
-- protection mode:
-- ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "KYEUPDB" RESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 4096
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '+DGSYSTEM/kyeupdb/onlinelog/group_1.266.978829167' SIZE 200M BLOCKSIZE 512,
GROUP 2 '+DGSYSTEM/kyeupdb/onlinelog/group_2.267.978829169' SIZE 200M BLOCKSIZE 512,
GROUP 3 '+DGSYSTEM/kyeupdb/onlinelog/group_3.268.978829173' SIZE 200M BLOCKSIZE 512,
GROUP 4 '+DGSYSTEM/kyeupdb/onlinelog/group_4.269.978829183' SIZE 200M BLOCKSIZE 512,
GROUP 5 '+DGSYSTEM/kyeupdb/onlinelog/group_5.270.978829193' SIZE 200M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
'+DGSYSTEM/kyeupdb/datafile/system.271.978829205',
'+DGSYSTEM/kyeupdb/datafile/sysaux.272.978829265',
'+DGSYSTEM/kyeupdb/datafile/undotbs1.273.978829323',
'+DGSYSTEM/kyeupdb/datafile/users.275.978829391',
'+DGSYSTEM/kyeupdb/datafile/ts_example.277.978855421',
'+DGSYSTEM/kyeupdb/datafile/kye_tbs02.dbf'
CHARACTER SET ZHS16GBK
;
-- Commands to re-create incarnation table
-- Below log names MUST be changed to existing filenames on
-- disk. Any one log file from each branch can be used to
-- re-create incarnation records.
-- ALTER DATABASE REGISTER LOGFILE '/oracle/app/oracle/product/11.2.0/dbs/arch1_1_978829161.dbf';
-- Recovery is required if any of the datafiles are restored backups,
-- or if the last shutdown was not normal or immediate.
RECOVER DATABASE USING BACKUP CONTROLFILE
-- Database can now be opened zeroing the online logs.
ALTER DATABASE OPEN RESETLOGS;
-- Files in normal offline tablespaces are now named.
ALTER DATABASE RENAME FILE 'MISSING00006'
TO '+DGSYSTEM/kyeupdb/datafile/kye_tbs01.dbf';
-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE '+DGSYSTEM/kyeupdb/tempfile/temp.274.978829379'
SIZE 1024M REUSE AUTOEXTEND OFF;
-- End of tempfile additions.
操作如下:
[BEGIN] 2018/6/22 21:58:29
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
[oracle@kyeup01 ~]$ sqlplus '/as sysdba'
SQL*Plus: Release 11.2.0.4.0 Production on Fri Jun 22 21:58:41 2018
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination /oracle/app/oracle/product/11.2.0/dbs/arch
Oldest online log sequence 10
Current log sequence 14
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
CREATE CONTROLFILE REUSE DATABASE "KYEUPDB" RESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 4096
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '+DGSYSTEM/kyeupdb/onlinelog/group_1.266.978829167' SIZE 200M BLOCKSIZE 512,
GROUP 2 '+DGSYSTEM/kyeupdb/onlinelog/group_2.267.978829169' SIZE 200M BLOCKSIZE 512,
GROUP 3 '+DGSYSTEM/kyeupdb/onlinelog/group_3.268.978829173' SIZE 200M BLOCKSIZE 512,
GROUP 4 '+DGSYSTEM/kyeupdb/onlinelog/group_4.269.978829183' SIZE 200M BLOCKSIZE 512,
GROUP 5 '+DGSYSTEM/kyeupdb/onlinelog/group_5.270.978829193' SIZE 200M BLOCKSIZE 512
DATAFILE
'+DGSYSTEM/kyeupdb/datafile/system.271.978829205',
'+DGSYSTEM/kyeupdb/datafile/sysaux.272.978829265',
'+DGSYSTEM/kyeupdb/datafile/undotbs1.273.978829323',
'+DGSYSTEM/kyeupdb/datafile/users.275.978829391',
'+DGSYSTEM/kyeupdb/datafile/ts_example.277.978855421',
'+DGSYSTEM/kyeupdb/datafile/kye_tbs02.dbf'
CHARACTER SET ZHS16GBK
21 ;
CREATE CONTROLFILE REUSE DATABASE "KYEUPDB" RESETLOGS NOARCHIVELOG
*
ERROR at line 1:
ORA-01034: ORACLE not available
Process ID: 75347
Session ID: 386 Serial number: 5
SQL>
CREATE CONTROLFILE REUSE DATABASE "KYEUPDB" RESETLOGS NOARCHIVELOG
SIZE 512,
GROUP 2 '+DGSYSTEM/kyeupdb/onlinelog/group_2.267.978829169' SIZE 200M BLOCKSIZE 512,
GROUP 3 '+DGSYSTEM/kyeupdb/onlinelog/group_3.268.978829173' SIZE 200M BLOCKSIZE 512,
GROUP 4 '+DGSYSTEM/kyeupdb/onlinelog/group_4.269.978829183' SIZE 200M BLOCKSIZE 512,
GROUP 5 '+DGSYSTEM/kyeupdb/onlinelog/group_5.270.978829193' SIZE 200M BLOCKSIZE 512
DATAFILE
'+DGSYSTEM/kyeupdb/datafile/system.271.978829205',
'+DGSYSTEM/kyeupdb/datafile/sysaux.272.978829265',
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 4096
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '+DGSYSTEM/kyeupdb/onlinelog/group_1.266.978829167' SIZE 200M BLOCKSIZE 512,
GROUP 2 '+DGSYSTEM/kyeupdb/onlinelog/group_2.267.978829169' SIZE 200M BLOCKSIZE 512,
GROUP 3 '+DGSYSTEM/kyeupdb/onlinelog/group_3.268.978829173' SIZE 200M BLOCKSIZE 512,
GROUP 4 '+DGSYSTEM/kyeupdb/onlinelog/group_4.269.978829183' SIZE 200M BLOCKSIZE 512,
GROUP 5 '+DGSYSTEM/kyeupdb/onlinelog/group_5.270.978829193' SIZE 200M BLOCKSIZE 512
DATAFILE
'+DGSYSTEM/kyeupdb/datafile/system.271.978829205',
'+DGSYSTEM/kyeupdb/datafile/sysaux.272.978829265',
'+DGSYSTEM/kyeupdb/datafile/undotbs1.273.978829323',
'+DGSYSTEM/kyeupdb/datafile/users.275.978829391',
'+DGSYSTEM/kyeupdb/datafile/ts_example.277.978855421',
'+DGSYSTEM/kyeupdb/datafile/kye_tbs02.dbf'
CHARACTER SET ZHS16GBK
21 ;
CREATE CONTROLFILE REUSE DATABASE "KYEUPDB" RESETLOGS NOARCHIVELOG
*
ERROR at line 1:
ORA-01034: ORACLE not available
Process ID: 75347
Session ID: 386 Serial number: 5
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 3858223104 bytes
Fixed Size 2259080 bytes
Variable Size 788531064 bytes
Database Buffers 3053453312 bytes
Redo Buffers 13979648 bytes
CREATE CONTROLFILE REUSE DATABASE "KYEUPDB" RESETLOGS NOARCHIVELOG
MAXLOGFILES 16
0M BLOCKSIZE 512,
GROUP 5 '+DGSYSTEM/kyeupdb/onlinelog/group_5.270.978829193' SIZE 200M BLOCKSIZE 512
DATAFILE
'+DGSYSTEM/kyeupdb/datafile/system.271.978829205',
'+DGSYSTEM/kyeupdb/datafile/sysaux.272.978829265',
'+DGSYSTEM/kyeupdb/datafile/undotbs1.273.978829323',
'+DGSYSTEM/kyeupdb/datafile/users.275.978829391',
'+DGSYSTEM/kyeupdb/datafile/ts_example.277.978855421',
'+DGSYSTEM/kyeupdb/datafile/kye_tbs02.dbf'
CHARACTER SET ZHS16GBK
MAXLOGMEMBERS 3
MAXDATAFILES 4096
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '+DGSYSTEM/kyeupdb/onlinelog/group_1.266.978829167' SIZE 200M BLOCKSIZE 512,
GROUP 2 '+DGSYSTEM/kyeupdb/onlinelog/group_2.267.978829169' SIZE 200M BLOCKSIZE 512,
GROUP 3 '+DGSYSTEM/kyeupdb/onlinelog/group_3.268.978829173' SIZE 200M BLOCKSIZE 512,
GROUP 4 '+DGSYSTEM/kyeupdb/onlinelog/group_4.269.978829183' SIZE 200M BLOCKSIZE 512,
GROUP 5 '+DGSYSTEM/kyeupdb/onlinelog/group_5.270.978829193' SIZE 200M BLOCKSIZE 512
DATAFILE
'+DGSYSTEM/kyeupdb/datafile/system.271.978829205',
'+DGSYSTEM/kyeupdb/datafile/sysaux.272.978829265',
'+DGSYSTEM/kyeupdb/datafile/undotbs1.273.978829323',
'+DGSYSTEM/kyeupdb/datafile/users.275.978829391',
'+DGSYSTEM/kyeupdb/datafile/ts_example.277.978855421',
'+DGSYSTEM/kyeupdb/datafile/kye_tbs02.dbf'
CHARACTER SET ZHS16GBK
21 ;
Control file created.
SQL> ALTER DATABASE OPEN RESETLOGS;
Database altered.
ALTER TABLESPACE TEMP ADD TEMPFILE '+DGSYSTEM/kyeupdb/tempfile/temp.274.978829379'
2 SIZE 1024M REUSE AUTOEXTEND OFF;
Tablespace altered.
SQL> select * from dba_temp_files;
FILE_NAME
--------------------------------------------------------------------------------
FILE_ID TABLESPACE_NAME BYTES BLOCKS STATUS
---------- ------------------------------ ---------- ---------- -------
RELATIVE_FNO AUT MAXBYTES MAXBLOCKS INCREMENT_BY USER_BYTES USER_BLOCKS
------------ --- ---------- ---------- ------------ ---------- -----------
+DGSYSTEM/kyeupdb/tempfile/temp.274.978829379
1 TEMP 1073741824 131072 ONLINE
1 NO 0 0 0 1072693248 130944
SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination /oracle/app/oracle/product/11.2.0/dbs/arch
Oldest online log sequence 1
Current log sequence 1
SQL>
[END] 2018/6/22 22:10:06
如果使用 resetlogs 打开的数据库,就需要对 DB 做一次备份。
resetlogs 命令表示一个数据库逻辑生存期的结束和另一个数据库逻辑生存期的开始, 每次使用 resetlogs 命令的时候,SCN 不会被重置,不过 oracle 会重置日志序列号, 而且会重置联机重做日志内容.
这样做是为了防止不完全恢复后日志序列会发生冲突(因为现有日志和数据文件间有 了时间差)。
在上面RESETLOGS重建控制文件的时候,归档是关闭的,如果是开启的,在开启RESETLOG之前,需要执行RECOVER DATABASE USING BACKUP CONTROLFILE
oracle 控制文件的重建的更多相关文章
- Oracle控制文件多路复用以及Oracle备份重建控制文件
控制文件中记录了oracle数据库的物理结构,也就是记录了数据库数据文件和日志文件的位置,控制文件中还记录了多种SCN,用这些SCN来确定数据文件和日志文件是否是正确的.如果不正确那么数据库就需要恢复 ...
- oracle控制文件丢失恢复
在学习群里有个同学误删除了控制文件,于是我也把自己数据库的控制文件删除了,看看能不能进行恢复,以下是整个实验的过程~~在做之前,先看看控制文件的备份方式:1.生成可以重建控制文件的脚本.2.备份二进制 ...
- Oracle控制文件
一.Oracle 控制文件 为二进制文件,初始化大小由CREATE DATABASE指定,可以使用RMAN备份 记录了当前数据库的结构信息,同时也包含数据文件及日志文件的信息以及相关的状态,归档信息等 ...
- Oracle 控制文件(CONTROLFILE)
一.Oracle 控制文件 为二进制文件,初始化大小由CREATE DATABASE指定,可以使用RMAN备份 记录了当前数据库的结构信息,同时也包含数据文件及日志文件的信息以及相关的状态,归档信息等 ...
- Oracle 控制文件损坏解决方案
Oracle 控制文件损坏解决方案 故障一:丢失(损坏)一个控制文件 前台报错:ORA-00205:error in identifying control file,check alert log ...
- Oracle控制文件操作
控制文件是连接instance和 database的纽带.记录了database的结构信息. 控制文件是1个2进制文件.记录的是当前database的状态. 控制文件可以有多个,在参数文件中通过con ...
- oracle控制文件问题
下午时连接数据库突然发现连不上了,监听报错找不到服务,于是登录数据库所在服务器,查看监听状态,oracle:lsnrctl status 监听状态正常,登入数据库查看[oracle@frkdb1 ~] ...
- RAC环境下控制文件损坏重建过程
处理过程参考了: https://blogs.oracle.com/Database4CN/entry/%E5%A6%82%E4%BD%95%E9%87%8D%E5%BB%BArac%E7%9A%84 ...
- Oracle控制文件丢失,日志文件丢失
控制文件丢失: alter database backup controlfile to traces; shutdown immediate; @j:\db\script\orcl_ora_ctl_ ...
随机推荐
- 获取url的参数值
var url=location.search; //获取url中从?开始的所有字符 var theRequest=new Object();//定义一个对象来存放url中的参数 if( url.i ...
- They say Rome wasn't built in a day, and yet what a difference a day makes.
They say Rome wasn't built in a day, and yet what a difference a day makes.有人说罗马不是一天建成的,但一天却能改变很多事.
- [总结] min-25筛
再不写总结我又会忘掉啊啊啊啊啊啊啊啊啊 这个\(min-25\)筛主要用来求一个积性函数的前缀和,就像这样\[\sum_{i=1}^n f(i)\] 不过这个积性函数要满足两个条件:质数\(p\)的函 ...
- 【虚拟机-可用性集】ARM 中可用性集使用的注意事项
Azure 目前有两种部署模型:经典部署模型 (ASM) 和资源管理器 (ARM).如果您之前使用过 ASM 模式下的可用性集,那么很可能在使用 ARM 模式下的可用性集时,会遇到一些问题或者疑惑.这 ...
- userBean设置属性2
package com.java.model; public class Student { private String name;private int age; public String ge ...
- 记一次RabbitMq 安装和配置坑
记一次RabbitMq 安装和配置坑 正常情况下安装 先安装erl ,在安装rabbitmq 这个在windows下的安装没什么技巧,按照默认一路下一步就ok.安装好后可以到cmd测试是否安装好. 测 ...
- python基础教程总结15——2 画幅好画
要求:从Internet上下载数据文件: 分析数据文件并提取感兴趣的部分 工具:图形生成包(ReportLab,PYX等) 数据:太阳黑子和射电辐射流量(http://services.swpc.n ...
- 使用nginx搭建一个简单的负载均衡
在windows系统上使用IIS模拟出两个不同服务器的站点: 然后再NGINX使用轮询机制配置两个服务器以及虚拟服务器的端口: 需要注意的是,配置虚拟代理域名的话需要找到windowsC盘下的host ...
- Hybrid App开发之Html基本标签使用
前言: 前面简单学习了html简单标签的使用,今天学习一下其他的标签的使用. HTML的超链接 1.)创建一个超链接 <div> <p> <a href="ht ...
- Ecshop首页购物车数量调取问题
在page_header.lbi中调用SQL: <?php $sql = 'SELECT SUM(goods_number) AS number' . ' FROM ' . $GLOBALS[' ...