oracle关闭归档模式

测试环境一个oracle数据库,因为归档日志满了,警告信息把磁盘写满。清理日志后,数据库启动不了了,想先关闭归档模式启动下,然后清理归档日志。

1、首先关闭数据库
shutdown immediate;

2、登录
sqlplus / as sysdba;

3、mount模式启动数据库
startup mount;

4、归档模式操作
关闭:
alter database noarchivelog;
开启:
alter database archivelog;

5、启动数据库
alter database open;

6、查看当前归档模式
archive log list;

然后启动监听就可以连上了。然后手动清理归档日志。

7、用脚本定期清理数据库归档文件
vi /home/oracle/del_arch.sh

#!/bin/bash
export ORACLE_HOME=/oracle/app/oracle/11.2.0/db_1
export ORACLE_SID=orcl
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
LOG_DIR=/home/oracle/crontabOra/log/
DATEL=`date '+%Y-%m-%d'`
LOG_NAME=${LOG_DIR}${DATEL}".log"
$ORACLE_HOME/bin/rman log=$LOG_NAME target sys/pass <

crontab添加:
0 0 */7 * * sh /home/oracle/del_arch.sh > /tmp/load.log 2>&1 &

8、以下报错是因为实例SID写错了,是区分大小写的
using target database control file instead of recovery catalog
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of crosscheck command at 02/01/2021 11:10:35
RMAN-12010: automatic channel allocation initialization failed
RMAN-06403: could not obtain a fully authorized session
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory
RMAN>
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of delete command at 02/01/2021 11:10:35
RMAN-06403: could not obtain a fully authorized session
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory