欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

ORA-00257 解决办法,使用RMAN删除归档日志

程序员文章站 2022-05-07 21:53:52
...

 

删除7天前的归档日志

[root@rac3 ~]# su - oracle
[oracle@rac3 ~]$ rman target /

Recovery Manager: Release 11.2.0.3.0 - Production on Fri May 2 13:38:06 2014

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: HH (DBID=2971317483)

RMAN> delete archivelog all completed before 'sysdate-7';

 

使用这种方法删除归档日志比较慢,他是一个一个删,1年的得删半个小时到一个小时。

估计在文件系统上按目录删除会快点,再清理。

 

----------------------------------------------------------------------------------------

我的参考:

sqlplus /nolog

connect / as sysdba

 

(2)查看数据库REDOLOG情况

select * from v$log;


(4)查看Oracle数据库后台归档服务进程

[oracle@hrmsdb ~]$ ps -ef|grep oracle

find -name flash_recovery_area

 

(6)查看FLASH_RECOVERY_AREA空间中各部分使用情况

SQL> select * from v$recovery_file_dest;

(7)SQL>select * from v$flash_recovery_area_usage;

发现ARCHIVELOG PERCENT_SPACE_USED已超过90%;

 


1.进入rman
p630_1#oracle> rman


2.连接到目标数据库
RMAN> connect target /;

3.查看所有日志情况
RMAN> list archivelog all;

4.检测归档日志

RMAN> crosscheck archivelog all;


5.删除过期的归档日志
RMAN> delete expired archivelog all;


以下命令备份日志,并删除一周前的所有日志:

BACKUP ARCHIVELOG ALL;

delete archivelog all completed before 'sysdate-7';

 

-----------------------------------------------------------------------------------------

 

参考:

ORA-00257 解决办法

http://pimg2005.blog.51cto.com/842469/857879/

ORA-00257报错解决办法

http://blog.csdn.net/bullettrain1433/article/details/20903473

如何删除Archivelog  

http://www.blogjava.net/decode360/archive/2009/06/25/287747.html

ASM删除archivelog

http://biancheng.dnbcw.info/oracle/237372.html

 

-------------------------------------------------------------------------------------

 

ASM Automatic Storage Management 自动存储管理,他是一个单独的实例,有自己的SID,有自己的文件

 

查看ASM的SID,+ASM1就是他的SID

[oracle@rac3 ~]$ cat /etc/oratab
+ASM1:/u01/app/11.2.0/grid:N  # line added by Agent
rr:/u01/app/oracle/product/11.2.0/db_1:N  # line added by Agent

 

查看asm进程

[oracle@rac3 ~]$ ps -ef|grep asm

 

用grid用户连接到asm

[root@rac3 ~]# su - grid
[grid@rac3 ~]$ sqlplus / as sysasm

SQL*Plus: Release 11.2.0.3.0 Production on Wed Apr 30 13:32:36 2014

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options

SQL> select instance_name,status from v$instance; --查看状态

INSTANCE_NAME  STATUS
---------------- ------------
+ASM1   STARTED

SQL>

在这可以启动停止

 

ASMCMD

[root@rac3 ~]# su - grid                      --grid用户
[grid@rac3 ~]$ asmcmd
ASMCMD> ls
ASM_DATA/
ASM_FRA/
OCR_VOTE/
ASMCMD> cd ASM_FRA

ASMCMD> cd +ASM_FRA/HH/ARCHIVELOG/
ASMCMD> ls
2014_04_26/
2014_04_27/
2014_04_28/
ASMCMD> cd 2014_04_28/
ASMCMD> ls
thread_1_seq_5303.6076.846032419
thread_1_seq_5304.6078.846050457
thread_1_seq_5305.6082.846057975
thread_1_seq_5306.6085.846072425
thread_1_seq_5307.6087.846090029
thread_2_seq_5098.6077.846041781
thread_2_seq_5099.6079.846057963
thread_2_seq_5100.6080.846057969
thread_2_seq_5101.6081.846057973
thread_2_seq_5102.6083.846057975
thread_2_seq_5103.6084.846063413
thread_2_seq_5104.6086.846086451
ASMCMD> help
        
            asmcmd [-V] [-v <errors|warnings|normal|info|debug>] [--privilege <sysasm|sysdba>] [-p] [command]
asmcmd_no_conn_str

        Starts asmcmd or executes the command

        asmcmd [-V] [-v <errors|warnings|normal|info|debug>] [--privilege <sysasm|sysdba>] [-p] [command]

        The environment variables ORACLE_HOME and ORACLE_SID determine the
        instance to which the program connects, and ASMCMD establishes a
        bequeath connection to it, in the same manner as a SQLPLUS / AS
        SYSASM.  The user must be a member of the OSASM group.

        Specifying the -V option prints the asmcmd version number and
        exits immediately.

        Specifying the -v option prints extra information that can help
        advanced users diagnose problems.

        Specify the --privilege option to choose the type of connection. There are
        only two possibilities: connecting as SYSASM or as SYSDBA.
        The default value if this option is unspecified is SYSASM.

        Specifying the -p option allows the current directory to be displayed
        in the command prompt, like so:

        ASMCMD [+DATA/ORCL/CONTROLFILE] >

        [command] specifies one of the following commands, along with its
        parameters.

        Type "help [command]" to get help on a specific ASMCMD command.';

        commands:
        --------

        md_backup, md_restore

        lsattr, setattr

        cd, cp, du, find, help, ls, lsct, lsdg, lsof, mkalias
        mkdir, pwd, rm, rmalias

        chdg, chkdg, dropdg, iostat, lsdsk, lsod, mkdg, mount
        offline, online, rebal, remap, umount

        dsget, dsset, lsop, shutdown, spbackup, spcopy, spget
        spmove, spset, startup

        chtmpl, lstmpl, mktmpl, rmtmpl

        chgrp, chmod, chown, groups, grpmod, lsgrp, lspwusr, lsusr
        mkgrp, mkusr, orapwusr, passwd, rmgrp, rmusr

        volcreate, voldelete, voldisable, volenable, volinfo
        volresize, volset, volstat
ASMCMD> quit          --退出