首页 > 数据库 >oracle 的归档模式的 开启与关闭

oracle 的归档模式的 开启与关闭

时间:2024-04-29 16:24:00浏览次数:23  
标签:log Database 归档 bytes 开启 SQL oracle sequence alter

DB version:11.2.0.3.0

OS version:rhel 6.3

PS:测试用的数据库是一个刚刚模拟断电的库

  1. 打开归档模式
已sysdba身份登录数据库
[oracle@oracle ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Mon Apr 29 16:02:20 2024

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup mount;
ORACLE instance started.

Total System Global Area  626327552 bytes
Fixed Size		    2230952 bytes
Variable Size		  373294424 bytes
Database Buffers	  247463936 bytes
Redo Buffers		    3338240 bytes
Database mounted.

当前状态为非归档模式

SQL> archive log list;
Database log mode	       No Archive Mode
Automatic archival	       Disabled
Archive destination	       USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     5
Current log sequence	       7

开启归档模式
SQL> alter database archivelog;
alter database archivelog
*
ERROR at line 1:
ORA-00265: instance recovery required, cannot set ARCHIVELOG mode

哦?神奇的一幕出现了。。。数据库的非正常关闭的,需要recovery。。当前状态无法打开归档模式

SQL> alter database open;

Database altered.

后台日志如下

332 alter database open
333 Beginning crash recovery of 1 threads
334 Started redo scan
335 Completed redo scan
336  read 6 KB redo, 4 data blocks need recovery
337 Started redo application at
338  Thread 1: logseq 7, block 58339
339 Recovery of Online Redo Log: Thread 1 Group 1 Seq 7 Reading mem 0
340   Mem# 0: /u01/app/oracle/oradata/ORCL/redo01a.log
341 Completed redo application of 0.00MB
342 Completed crash recovery at
343  Thread 1: logseq 7, block 58351, scn 225781
344  4 data blocks read, 4 data blocks written, 6 redo k-bytes read
345 Mon Apr 29 16:03:30 2024
346 Thread 1 advanced to log sequence 8 (thread open)
347 Thread 1 opened at log sequence 8
348   Current log# 2 seq# 8 mem# 0: /u01/app/oracle/oradata/ORCL/redo02a.log
349 Successful open of redo thread 1
350 MTTR advisory is disabled because FAST_START_MTTR_TARGET is not set
351 Mon Apr 29 16:03:30 2024
352 SMON: enabling cache recovery
353 [2743] Successfully onlined Undo Tablespace 2.
354 Undo initialization finished serial:0 start:404654 end:404714 diff:60 (0 seconds)
355 Verifying file header compatibility for 11g tablespace encryption..
356 Verifying 11g file header compatibility for tablespace encryption completed
357 SMON: enabling tx recovery
358 Database Characterset is AL32UTF8
359 No Resource Manager plan active
360 replication_dependency_tracking turned off (no async multimaster replication found)
361 Starting background process QMNC
362 Mon Apr 29 16:03:31 2024
363 QMNC started with pid=20, OS id=2746
364 Completed: alter database open

数据库启动后,正常关闭数据库

SQL> shutdown immediate;  
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.

Total System Global Area  626327552 bytes
Fixed Size		    2230952 bytes
Variable Size		  373294424 bytes
Database Buffers	  247463936 bytes
Redo Buffers		    3338240 bytes
Database mounted.

SQL> archive log list;
Database log mode	       No Archive Mode
Automatic archival	       Disabled
Archive destination	       USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     6
Current log sequence	       8

启动到mount状态后,打开归档成功
SQL> alter database archivelog;

Database altered.

SQL> alter database open;

Database altered.

SQL> archive log list;      
Database log mode	       Archive Mode
Automatic archival	       Enabled
Archive destination	       USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     6
Next log sequence to archive   8
Current log sequence	       8
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
  1. 关闭归档模式
SQL> startup mount;
ORACLE instance started.

Total System Global Area  626327552 bytes
Fixed Size		    2230952 bytes
Variable Size		  373294424 bytes
Database Buffers	  247463936 bytes
Redo Buffers		    3338240 bytes
Database mounted.

启动到mount状态后,关闭归档模式
SQL> alter database noarchivelog;

Database altered.

SQL> archive log list;
Database log mode	       No Archive Mode
Automatic archival	       Disabled
Archive destination	       USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     6
Current log sequence	       8
SQL> alter database open;

Database altered.

标签:log,Database,归档,bytes,开启,SQL,oracle,sequence,alter
From: https://www.cnblogs.com/Miac/p/18165966

相关文章

  • oracle数据导入导出,备份还原命令expdp&impdp(只导出元数据,不导出表数据,最全,最完善的步
    感谢金龙鱼先生分享,原文来自https://blog.csdn.net/kou869929526/article/details/125791113一,编码要求以及数据库版本要求检查数据库版本(用于决定导出时生成为哪个版本的dmp头文件)selectversionfromv$instance;检查字符集是否一致(字符集不一致,不能导入)selectuserenv(......
  • mysql数据库转oracle数据库
    mysql->oracle前言今天的任务是把用mysql数据库编写的程序转成oracle,这也是我第一次用oracle可谓是错误百出啊。下载oracle?NO在公司我们不需要本地下载oracle,(如果你是想自己学习当我没说,不魔法下载很慢,有时间我会写一篇系统性的文章写oracle的运用),当我下载完oracle本地数据库......
  • 27.PG的归档配置
    归档功能可以将WAL复制到另一个目录。若复制目标为共享区域(如NSF或其他主机),则可以将其用于备份和PITR前滚(基于时间点的恢复)。 接下来我们来配置一个rsync归档,服务器先安装rsync软件包,然后切换到PostgreSQL用户。配置PostgreSQL用户能和远端服务器进行ssh免密钥连接。......
  • docker 安装 Oracle_12c
    最近做一个功能,需要连接:mysql、mssql、oracle,开发语言是nodejs,框架是nestjs框架,orm使用的typeorm,package包括:"oracledb":"^6.4.0""mssql":"^10.0.2""mysql2":"^3.9.7"公司没有mysql及oracle数据库,所以我在自己的云上用docker安装下,测试下。mysql还行,但是......
  • oracle 查看日志
    查看日志SELECT*FROMv$diag_alert_ext  使用SQL*Plus连接到Oracle数据库。运行以下命令来查看当前会话的日志记录:SELECTusername,os_username,machine,sql_textFROMv$sessionWHEREusernameISNOTNULL;复制代码这将显示当前所有活动会话的用户名、操作系统用户名、......
  • Oracle-无备份情况下,如何手动恢复控制文件
    1.测试场景本文主要模拟在控制文件没有备份的情况下丢失,如何根据已有的参数文件、数据文件、在线日志信息去手动生成控制文件。2.测试环境Oracle单实例:11.2.0.4数据文件目录:/u01/app/oracle/oradata/HJDB/datafile在线日志目录:/u01/app/oracle/oradata/HJDB/onlinelog3.创建......
  • Oracle 小计-汇总处理
    假设我们有一个名为employees的表,它包含部门(department)、员工姓名(employee)和工资(salary)CREATETABLEemployees(departmentVARCHAR2(50),employeeVARCHAR2(50),salaryNUMBER(10,2));初始化数据INSERTINTOemployees(department,employee,salary)VAL......
  • oracle集合
    并集(UNION)用于合并两个或多个SELECT语句的结果集SELECTcolumn_name(s)FROMtable1UNIONALLSELECTcolumn_name(s)FROMtable2;交集(INTERSECT)返回两个或多个查询结果集中都存在的行SELECTcolumn_name(s)FROMtable1INTERSECTSELECTcolumn_name(s)FROMtable2......
  • gpu机器没有开启ipv6
      参考:https://blog.csdn.net/asdfaa/article/details/137884414 检查系统是否支持IPv6,查看被禁用了在启用IPv6之前,首先要确保您的系统支持IPv6。要检查内核是否启用了IPv6,可以运行以下命令:cat/proc/sys/net/ipv6/conf/all/disable_ipv6如果返回的结果为0,则说......
  • oracle小技巧:字符串原样输出
       在sql查询中,我们经常需要原样输出字符串,如果字符串中含有大量的单引号、双引号或者特殊字符,那么需要用单引号转义拼接字符串,这样会非常的麻烦。      oracle提供了一个Q-quote的表达式来原样输出字符串。SELECTQ'[I'maboy,mynameis'david']'FROMDUAL......