一次由于关归档的 ‘小事’ 引发的 ‘ 事故 ’。。。。。 今天在一个客户那做巡检是碰到了一个有趣的问题,差点把自己给吓死。 因客户要求关掉一个库的归档,如此easy,但是,but,出了一个问题,差点吓死。。。 模拟故障报错如下: SQL startup mount ORACL
一次由于关归档的 ‘小事’ 引发的 ‘ 事故 ’。。。。。
今天在一个客户那做巡检是碰到了一个有趣的问题,差点把自己给吓死。
因客户要求关掉一个库的归档,如此easy,但是,but,出了一个问题,差点吓死。。。
模拟故障报错如下:
SQL> startup mount
ORACLE instance started.
Total System Global Area 234344448 bytes
Fixed Size 1335696 bytes
Variable Size 142610032 bytes
Database Buffers 88080384 bytes
Redo Buffers 2318336 bytes
Database mounted.
SQL> alter database noarchivelog;
alter database noarchivelog
*
ERROR at line 1:
ORA-01143: cannot disable media recovery - file 7 needs media recovery
ORA-01110: data file 7:
'/u01/app/oracle/oradata/MYNEWDB/datafile/o1_mf_admin_tb_8y6kbmb4_.dbf'
数据库没有备份策略,之前的归档空间就10g左右,客户在db hang住是手工去删归档,由于之前在登入数据前已发现此库应用压力有点大,但是当时也没多想。于是直接一个alter system checkpoint;先切了几次。然后再shutdown immediate: 但是半天没反应。客户又在催,于是乎,手工cancel 了,接着一个shutdown abort:再startup一把,然后再shutdown immediate:这是后台 alert。log 里没有任何报错,然后接着再startup mount: 开始关归档。就出现上述报错:
SQL> alter database noarchivelog;
alter database noarchivelog
*
ERROR at line 1:
ORA-01143: cannot disable media recovery - file 7 needs media recovery
ORA-01110: data file 7:
'/u01/app/oracle/oradata/MYNEWDB/datafile/o1_mf_admin_tb_8y6kbmb4_.dbf'
这下彻底吓坏了,应为见过在搞压力下,由于shutdown abort 后数据库器不来的case,而且,更吓人的是这个库没有任何备份,最经24的归档都刚刚给删了,这是瞬间,bbed dul。。。全跳到我脑门,but 这个屠龙之技哪敢在客户的生产上用,。。。。。。。。各种忐忑中。。。。。。
!!!!!!!注意:现在回想起来,以后打死也不随便在业务高峰期间敲shutdown 命令了。需要根据当前数据库系统实际情况,及先查明系统负载情况,在提出合理建议,说明可能存在的风险情况,让客户在业务低峰期,再做某些操作。
后来,重新检查数据文件的情况信息,搞清楚了是什么原因。
以下为整个问题的模拟再现:
当数据库中有数据文件在数据库open是 offline 时,这时再去禁用归档是不允许的。以下为测试文档:
[root@oracle11g ~]# !su
su - oracle
![oracle@oracle11g ~]$ !sql
sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Wed Jan 15 04:33:23 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> desc dba_data_files;
Name Null? Type
----------------------------------------- -------- ----------------------------
FILE_NAME VARCHAR2(513)
FILE_ID NUMBER
TABLESPACE_NAME VARCHAR2(30)
BYTES NUMBER
BLOCKS NUMBER
STATUS VARCHAR2(9)
RELATIVE_FNO NUMBER
AUTOEXTENSIBLE VARCHAR2(3)
MAXBYTES NUMBER
MAXBLOCKS NUMBER
INCREMENT_BY NUMBER
USER_BYTES NUMBER
USER_BLOCKS NUMBER
ONLINE_STATUS VARCHAR2(7)
SQL> select file_name, file_id ,status from dba_data_files;
FILE_NAME
--------------------------------------------------------------------------------
FILE_ID STATUS
---------- ---------
/u01/app/oracle/oradata/MYNEWDB/datafile/o1_mf_admin_tb_8y6k9o20_.dbf
6 AVAILABLE
/u01/app/oracle/oradata/MYNEWDB/datafile/o1_mf_users_814jk5bg_.dbf
4 AVAILABLE
/u01/app/oracle/oradata/MYNEWDB/datafile/o1_mf_undotbs1_814jk569_.dbf
3 AVAILABLE
/u01/app/oracle/oradata/MYNEWDB/datafile/o1_mf_sysaux_814jk53d_.dbf
2 AVAILABLE
/u01/app/oracle/oradata/MYNEWDB/datafile/o1_mf_system_814jk4rs_.dbf
1 AVAILABLE
/u01/app/oracle/oradata/MYNEWDB/datafile/o1_mf_example_814jq4jj_.dbf
5 AVAILABLE
/u01/app/oracle/oradata/MYNEWDB/datafile/o1_mf_admin_tb_8y6kbmb4_.dbf
7 AVAILABLE
7 rows selected.
先将数据文件7将数据离线:
SQL> alter database datafile 7 offline;
Database altered.
SQL> select file_name, file_id ,status from dba_data_files;
FILE_NAME
--------------------------------------------------------------------------------
FILE_ID STATUS
---------- ---------
/u01/app/oracle/oradata/MYNEWDB/datafile/o1_mf_admin_tb_8y6k9o20_.dbf
6 AVAILABLE
/u01/app/oracle/oradata/MYNEWDB/datafile/o1_mf_users_814jk5bg_.dbf
4 AVAILABLE
/u01/app/oracle/oradata/MYNEWDB/datafile/o1_mf_undotbs1_814jk569_.dbf
3 AVAILABLE
/u01/app/oracle/oradata/MYNEWDB/datafile/o1_mf_sysaux_814jk53d_.dbf
2 AVAILABLE
/u01/app/oracle/oradata/MYNEWDB/datafile/o1_mf_system_814jk4rs_.dbf
1 AVAILABLE
/u01/app/oracle/oradata/MYNEWDB/datafile/o1_mf_example_814jq4jj_.dbf
5 AVAILABLE
/u01/app/oracle/oradata/MYNEWDB/datafile/o1_mf_admin_tb_8y6kbmb4_.dbf
7 AVAILABLE
7 rows selected.
SQL> select * from v$recover_file;
FILE# ONLINE ONLINE_
---------- ------- -------
ERROR CHANGE#
----------------------------------------------------------------- ----------
TIME
---------
7 OFFLINE OFFLINE
4111255
13-JAN-14
SQL>
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /home/oracle/test
Oldest online log sequence 45
Next log sequence to archive 47
Current log sequence 47
SQL>
当前环境为归档模式,在数据库open状态下将数据文件7离线。
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 234344448 bytes
Fixed Size 1335696 bytes
Variable Size 142610032 bytes
Database Buffers 88080384 bytes
Redo Buffers 2318336 bytes
Database mounted.
禁用数据库归档模式:
SQL> alter database noarchivelog;
alter database noarchivelog
*
ERROR at line 1:
ORA-01143: cannot disable media recovery - file 7 needs media recovery
ORA-01110: data file 7:
'/u01/app/oracle/oradata/MYNEWDB/datafile/o1_mf_admin_tb_8y6kbmb4_.dbf'
对离线的数据文件进行恢复:
SQL> startup force
ORACLE instance started.
Total System Global Area 234344448 bytes
Fixed Size 1335696 bytes
Variable Size 142610032 bytes
Database Buffers 88080384 bytes
Redo Buffers 2318336 bytes
Database mounted.
Database opened.
SQL> recover datafile 7;
ORA-00279: change 4111255 generated at 01/13/2014 08:47:27 needed for thread 1
ORA-00289: suggestion : /home/oracle/test/1_47_832034536.arc
ORA-00280: change 4111255 for thread 1 is in sequence #47
Specify log: {
auto
Log applied.
Media recovery complete.
这里可以看出需要一个归档日志文件来恢复数据文件7,因此,如果某个数据文件在过去某个时间点在数据库处于open模式下,且归档是开了的情况下,被offline了。如果这时没有备份,且历史归档都不完整存在的话。对于这个
数据文件只能采用非常规方式恢复了。而这时如果必须要关掉归档的话,只能drop掉相应的表空间了。
SQL> select * from v$recover_file;
no rows selected
SQL>
SQL> shutdown abort
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 234344448 bytes
Fixed Size 1335696 bytes
Variable Size 142610032 bytes
Database Buffers 88080384 bytes
Redo Buffers 2318336 bytes
Database mounted.
SQL> alter database noarchivelog;
Database altered.
SQL> select * from v$recover_file;
no rows selected
SQL> select * from dba_data_files;
select * from dba_data_files
*
ERROR at line 1:
ORA-01219: database not open: queries allowed on fixed tables/views only
SQL> alter database open;
Database altered.
SQL> select * from dba_data_files;
FILE_NAME
--------------------------------------------------------------------------------
FILE_ID TABLESPACE_NAME BYTES BLOCKS STATUS
---------- ------------------------------ ---------- ---------- ---------
RELATIVE_FNO AUT MAXBYTES MAXBLOCKS INCREMENT_BY USER_BYTES USER_BLOCKS
------------ --- ---------- ---------- ------------ ---------- -----------
ONLINE_
-------
/u01/app/oracle/oradata/MYNEWDB/datafile/o1_mf_admin_tb_8y6k9o20_.dbf
6 ADMIN_TBS 104857600 12800 AVAILABLE
6 NO 0 0 0 103809024 12672
ONLINE
FILE_NAME
--------------------------------------------------------------------------------
FILE_ID TABLESPACE_NAME BYTES BLOCKS STATUS
---------- ------------------------------ ---------- ---------- ---------
RELATIVE_FNO AUT MAXBYTES MAXBLOCKS INCREMENT_BY USER_BYTES USER_BLOCKS
------------ --- ---------- ---------- ------------ ---------- -----------
ONLINE_
-------
/u01/app/oracle/oradata/MYNEWDB/datafile/o1_mf_users_814jk5bg_.dbf
4 USERS AVAILABLE
4
ONLINE
FILE_NAME
--------------------------------------------------------------------------------
FILE_ID TABLESPACE_NAME BYTES BLOCKS STATUS
---------- ------------------------------ ---------- ---------- ---------
RELATIVE_FNO AUT MAXBYTES MAXBLOCKS INCREMENT_BY USER_BYTES USER_BLOCKS
------------ --- ---------- ---------- ------------ ---------- -----------
ONLINE_
-------
/u01/app/oracle/oradata/MYNEWDB/datafile/o1_mf_undotbs1_814jk569_.dbf
3 UNDOTBS1 89128960 10880 AVAILABLE
3 YES 3.4360E+10 4194302 640 88080384 10752
ONLINE
FILE_NAME
--------------------------------------------------------------------------------
FILE_ID TABLESPACE_NAME BYTES BLOCKS STATUS
---------- ------------------------------ ---------- ---------- ---------
RELATIVE_FNO AUT MAXBYTES MAXBLOCKS INCREMENT_BY USER_BYTES USER_BLOCKS
------------ --- ---------- ---------- ------------ ---------- -----------
ONLINE_
-------
/u01/app/oracle/oradata/MYNEWDB/datafile/o1_mf_sysaux_814jk53d_.dbf
2 SYSAUX 660602880 80640 AVAILABLE
2 YES 3.4360E+10 4194302 1280 659554304 80512
ONLINE
FILE_NAME
--------------------------------------------------------------------------------
FILE_ID TABLESPACE_NAME BYTES BLOCKS STATUS
---------- ------------------------------ ---------- ---------- ---------
RELATIVE_FNO AUT MAXBYTES MAXBLOCKS INCREMENT_BY USER_BYTES USER_BLOCKS
------------ --- ---------- ---------- ------------ ---------- -----------
ONLINE_
-------
/u01/app/oracle/oradata/MYNEWDB/datafile/o1_mf_system_814jk4rs_.dbf
1 SYSTEM 786432000 96000 AVAILABLE
1 YES 3.4360E+10 4194302 1280 785383424 95872
SYSTEM
FILE_NAME
--------------------------------------------------------------------------------
FILE_ID TABLESPACE_NAME BYTES BLOCKS STATUS
---------- ------------------------------ ---------- ---------- ---------
RELATIVE_FNO AUT MAXBYTES MAXBLOCKS INCREMENT_BY USER_BYTES USER_BLOCKS
------------ --- ---------- ---------- ------------ ---------- -----------
ONLINE_
-------
/u01/app/oracle/oradata/MYNEWDB/datafile/o1_mf_example_814jq4jj_.dbf
5 EXAMPLE 104857600 12800 AVAILABLE
5 YES 3.4360E+10 4194302 80 103809024 12672
ONLINE
FILE_NAME
--------------------------------------------------------------------------------
FILE_ID TABLESPACE_NAME BYTES BLOCKS STATUS
---------- ------------------------------ ---------- ---------- ---------
RELATIVE_FNO AUT MAXBYTES MAXBLOCKS INCREMENT_BY USER_BYTES USER_BLOCKS
------------ --- ---------- ---------- ------------ ---------- -----------
ONLINE_
-------
/u01/app/oracle/oradata/MYNEWDB/datafile/o1_mf_admin_tb_8y6kbmb4_.dbf
7 ADMIN_TBS2 AVAILABLE
7
OFFLINE
7 rows selected.
SQL> select * from v$recover_file;
no rows selected
SQL> alter database datafile 7 online;
Database altered.
SQL> select * from v$recover_file;
no rows selected
在shutdown abort 下,且非归档模式offline数据文件: 结论如下
SQL> shutdown abort
ORACLE instance shut down.
SQL> alter database datafile 7 offline;
alter database datafile 7 offline
*
ERROR at line 1:
ORA-01034: ORACLE not available
Process ID: 12122
Session ID: 1 Serial number: 5
SQL> startup mount
ORACLE instance started.
Total System Global Area 234344448 bytes
Fixed Size 1335696 bytes
Variable Size 142610032 bytes
Database Buffers 88080384 bytes
Redo Buffers 2318336 bytes
Database mounted.
SQL> alter database datafile 7 offline;
alter database datafile 7 offline
*
ERROR at line 1:
ORA-01145: offline immediate disallowed unless media recovery enabled
SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination /home/oracle/test
Oldest online log sequence 54
Current log sequence 56
SQL>

在Windows11/10PC上,你可以使用各种文件压缩/归档软件来拆分或合并RAR文件。这些软件提供了方便的功能,可以帮助你合并或拆分RAR文件,以便更好地管理和组织文件。不仅可以将单个文件或文件集合合并为一个压缩归档,还可以在压缩归档中对文件和文件夹进行操作。因此,使用文件归档软件可以让你更有效地管理压缩文件,提高工作效率。如何在Windows11中拆分或合并RAR文件要在Windows11/10中拆分或合并RAR文件,您可以使用WinRAR这款流行的Windows文件压缩/归档软件。Win

如何在MySQL中实现数据的冷热分离和归档?随着数据量的不断增长和业务需求的变化,数据库中的数据也在不断增加。为了提高数据库的性能和效率,我们可以通过冷热分离和数据归档的方式来管理和存储数据。冷热分离是指将数据按照使用频率的高低,分成热数据和冷数据。热数据是指经常被访问和查询的数据,而冷数据则很少被访问或查询。通过将冷数据从主数据库中分离出来,我们可以减轻主

linux归档是一个聚集众多文件并将它们组合为一个大文件的过程,它通常作为系统备份的一部分,而且通常也用于将旧数据从某个系统移到某些长期存储设备的情况下;tar命令可以为linux的文件和目录创建档案。

Linux服务器是广泛用于托管网站和提供服务的平台。在服务器运行期间,日志文件被持续记录,以帮助管理员诊断问题和监控服务器活动。为了保持服务器的性能和存储空间的有效利用,日志文件需要定期进行压缩和归档。然而,有时在执行这些操作时会遇到一些常见的错误。本文将介绍几种常见的日志文件压缩和归档错误以及其修复方法。"PermissionDenied"错误当尝试压缩

近日,加利福尼亚州莫诺市附近发生了一起特斯拉事故,一名特斯拉Model3车主在使用特斯拉的辅助驾驶系统“完全自动驾驶”(FSD)时遭遇事故。这一事件引起了公众的关注,事故视频也在网络上引发了广泛讨论。在一个清晨,一位特斯拉车主正在高速公路上测试FSD系统。他对这个名为“完全自动驾驶”的系统充满信心,却没有想到前方不远处的道路上会出现黄色的“洪水泛滥”标志。令人惊讶的是,FSD系统竟然完全忽视了这个标志,没有做出任何减速或避让的动作。车主误以为FSD系统已经能够全面接管驾驶任务,因此没有注意到路标

Linux归档的定义及意义随着信息技术的飞速发展,数据的管理和存储已经成为各行各业不可或缺的一部分。在Linux系统中,归档是一项非常重要的功能,它可以帮助用户有效地组织和管理文件,节省存储空间,提高工作效率。本文将深入探讨Linux归档的定义及意义,并提供具体的代码示例,帮助读者更好地理解和应用这一功能。一、Linux归档的定义在Linux系统中,归档是指

Linux系统一直以来都是程序员、系统管理员和IT专业人士的首选操作系统,其强大的功能和灵活性使得它在工作和学习中得到了广泛的应用。其中,利用Linux的归档功能可以帮助我们更好地管理文件和数据,提高工作效率。本文将介绍如何利用Linux的归档工具来提高工作效率,并给出具体的代码示例。1.基本介绍在Linux系统中,归档是指将多个文件或目

Linux服务器的日志文件是记录服务器运行状态和各种操作记录的重要组成部分。随着时间的推移,日志文件会不断增长,占用大量的磁盘空间。为了解决这个问题,压缩和归档日志文件成为了一种常见的做法。本文将介绍一些常见的日志文件压缩和归档问题以及解决方法。问题1:日志文件过大,占用大量磁盘空间在服务器运行一段时间后,日志文件会不断增长,导致磁盘空间不足的问题。此时,需


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

SublimeText3 Mac version
God-level code editing software (SublimeText3)

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),
