Oracle数据库数据恢复、性能优化

找回密码
注册
搜索
热搜: 活动 交友 discuz
发新帖

94

积分

0

好友

1

主题
1#
发表于 2012-4-11 22:00:07 | 查看: 6121| 回复: 6
这边有个客户环境是AIX 上的oracle 10g asm rac,由于备份软件的问题将近一年没有正常备份,导致归档日志积累将近1个T,今天把备份软件重新配置好后,仔细的看了下备份过程。有几个疑问:
   1.rman备份归档日志不按照sequence号的吗?我看到rman备份日志的顺序很乱一会备2012年 一会备2011年的
   2.归档日志一直没有删除过,只是前几天存放换目录了个diskgroup。脚本里面是写着backup archivelog all delete input;
        但是发现归档日志并没有完全备份删除。那些没备份的2011年生成的归档日志crosscheck 也无法检测到.这是为什么?
  3.试图通过asmcmd,去删除无效的归档日志,rm -rf archivelog一直卡住,只能通过删除archivelog目录下所有的文件才能删除。有没有更好的办法直接删除ASM里面的非空目录?11g里面是可以直接删除的。
7#
发表于 2012-4-12 13:54:35

回复 6# 的帖子

11g 中 asmcmd rm 定义
help rm
        rm

        Deletes the specified Oracle ASM files and directories.

        rm [-f|-r] name [name...]

        The options for the rm command are described below.

        -r      - Recursively deletes files and subdirectories.
        -f      - Forces the deletion of files and subdirectories.
        name    - Name of the file, pattern, or directory you want to remove.

        If name is a file or alias, then the rm command can delete the file
        or alias only if it is not currently in use. If name is a directory,
        then the rm command can delete it only if it is empty (unless the -r
        flag is used) and it is not a system-generated directory. If name is
        an alias, then the rm command deletes both the alias and the file to
        which the alias refers. To delete only an alias and retain the file
        that the alias references, use the rmalias command.

        Note: When you delete all of the files in a system-created directory,
        the directory is removed. If the parent directories are empty, all of
        the parent directories are also removed.

        name can contain wildcard characters. See "Wildcard Characters".

        If you use a wildcard, the rm command deletes all of the matches
        except nonempty directories, unless you use the -r flag. To
        recursively delete, use the -r flag. With -r option you can delete
        a nonempty directory, including all files and directories in it and
        in the entire directory tree underneath it. If you use the -r flag
        or a wildcard character, then the rm command prompts you to confirm
        the deletion before proceeding, unless you specify the -f flag.  If
        a wildcard character matches an alias or a system-generated file that
        has an alias, then both the alias and the system-generated file that
        it references are deleted. When using the -r flag, either the
        system-generated file or the alias must be present in the directory
        in which you run the rm command.

        For example, if you have a user alias, +data/dir1/file.alias
        that points to +data/orcl/DATAFILE/System.256.146589651,
        then running the rm -r +data/dir1 command removes the
        +data/dir1/file.alias and +data/orcl/DATAFILE/System.256.146589651.

        The following are examples of the rm command. The
        first example deletes the myexamples.bak file. The second example
        removes the subdir2 directory and its contents.

回复 只看该作者 道具 举报

6#
发表于 2012-4-12 13:54:10

回复 5# 的帖子

10g 中 asmcmd rm 定义:
help rm
rm [-rf] <name1 name2 . . .>

If <nameN> is an empty directory, then rm removes it.  It is equivalent
to ALTER DISKGROUP <dg_name> DROP DIRECTORY <name1, name2, . . .> in
SQL.  Note that rm cannot remove system-created or non-empty
directories.  Otherwise, rm treats <nameN> as files and deletes them,
removing both system-created filenames and user-defined aliases.
It is equivalent to ALTER DISKGROUP <dg_name> DROP FILE
<name1, name2, . . .> in SQL.

If using a wildcard, then rm deletes all matches with the exception
of system-created directories and non-empty directories.

If using the -r flag, then all entries under the specified <nameN> are
deleted recursively.  Note that rm does not specifically issue the
DROP DIRECTORY SQL command to drop system-created directories.  However,
these are removed automatically by ASM once they are empty.

If using the -r flag or wildcard matching, then rm prompts the user to
confirm the deletion before proceeding, unless the user also specifies
the -f flag.

Warning!  Removing an user-defined alias removes the system-created
filename as well, and vice versa.  This rule applies even when you
use wildcard or the -r option!  The wildcard needs to match only one
of the two, and both are deleted.  For -r, only one of the two needs
to be under the directory to be deleted, and both are deleted.

For instance, if you have an user-defined alias "+dg/dir1/file.alias"
that points to "+dg/ORCL/DATAFILE/System.256.1", doing a
"rm -r +dg1/dir1" will remove System.256.1 as well, even though it
is not technically under "+dg/dir1".

回复 只看该作者 道具 举报

5#
发表于 2012-4-12 13:53:24

回复 4# 的帖子

感谢刘大的回帖!该数据库的确没有catalog库,归档日志记录可能在控制文件中被覆盖了。
第2个问题估计也是因为2011年之前归档日志记录部分被覆盖造成的。
第3个问题 在10g asmcmd rm与11g的定义有所不同。不知道是不是10g 里面无法直接删除非空目录。

回复 只看该作者 道具 举报

4#
发表于 2012-4-12 12:09:14
1.backup (archivelog all delete all input);

备份归档的顺序一般是 按照sequence 的升序进行的。

2.
“但是发现归档日志并没有完全备份删除。那些没备份的2011年生成的归档日志crosscheck 也无法检测到.这是为什么?”

确认你使用了 catalog repository 而非 controlfile 记录,controlfile控制文件会覆盖过老的归档记录(control_file_record_keep_time )这可能导致 实际存在磁盘上的archivelog 无法被识别


3. rm -rf archivelog一直卡住 需要具体诊断

回复 只看该作者 道具 举报

3#
发表于 2012-4-12 10:15:27

回复 2# 的帖子

Information        2012/04/11 09:37:17        50        Data Plugin        pjdb2        connected to target database: PJWXDB (DBID=937529098)
Information        2012/04/11 09:37:17        50        Data Plugin        pjdb2        using target database control file instead of recovery catalog
Information        2012/04/11 09:37:17        50        Data Plugin        pjdb2        RMAN>  run {  
Information        2012/04/11 09:37:17        50        Data Plugin        pjdb2        2> allocate channel cspfile type 'SBT_TAPE';
Information        2012/04/11 09:37:17        50        Data Plugin        pjdb2        3> backup
Information        2012/04/11 09:37:17        50        Data Plugin        pjdb2        4> format 'BAKBONESERVER:#259:pjdb2:%s_%t:RMAN FULL DB %d_1334107756'
Information        2012/04/11 09:37:17        50        Data Plugin        pjdb2        5> spfile;
Information        2012/04/11 09:37:17        50        Data Plugin        pjdb2        6> release channel cspfile;
Information        2012/04/11 09:37:17        50        Data Plugin        pjdb2        7> allocate channel c1 type 'SBT_TAPE';
Information        2012/04/11 09:37:17        50        Data Plugin        pjdb2        8> backup full
Information        2012/04/11 09:37:17        50        Data Plugin        pjdb2        9> format 'BAKBONESERVER:#259:pjdb2:%s_%t:RMAN FULL DB %d_1334107756'
Information        2012/04/11 09:37:17        50        Data Plugin        pjdb2        10>  database
Information        2012/04/11 09:37:17        50        Data Plugin        pjdb2        11> ;
Information        2012/04/11 09:37:17        50        Data Plugin        pjdb2        12> release channel c1;
Information        2012/04/11 09:37:17        50        Data Plugin        pjdb2        13> allocate channel c1 type 'SBT_TAPE';
Information        2012/04/11 09:37:17        50        Data Plugin        pjdb2        14> sql "alter system archive log current";
Information        2012/04/11 09:37:17        50        Data Plugin        pjdb2        15> backup
Information        2012/04/11 09:37:17        50        Data Plugin        pjdb2        16> format 'BAKBONESERVER:#259:pjdb2:%s_%t:RMAN FULL DB %d_1334107756'
Information        2012/04/11 09:37:17        50        Data Plugin        pjdb2        17> (archivelog all delete all input);
Information        2012/04/11 09:37:17        50        Data Plugin        pjdb2        18> release channel c1;
Information        2012/04/11 09:37:17        50        Data Plugin        pjdb2        19> allocate channel ccontrolfile type 'SBT_TAPE';
Information        2012/04/11 09:37:17        50        Data Plugin        pjdb2        20> backup
Information        2012/04/11 09:37:17        50        Data Plugin        pjdb2        21> format 'BAKBONESERVER:#259:pjdb2:%s_%t:RMAN FULL DB %d_1334107756'
Information        2012/04/11 09:37:17        50        Data Plugin        pjdb2        22> (current controlfile);
Information        2012/04/11 09:37:17        50        Data Plugin        pjdb2        23> release channel ccontrolfile;
Information        2012/04/11 09:37:17        50        Data Plugin        pjdb2        24> }

这个是备份软件生成的脚本

回复 只看该作者 道具 举报

2#
发表于 2012-4-12 10:05:21
1.rman备份归档日志不按照sequence号的吗?我看到rman备份日志的顺序很乱一会备2012年 一会备2011年的


你用rman 备份 archivelog 的具体命令是如何的,请具体列出。

回复 只看该作者 道具 举报

您需要登录后才可以回帖 登录 | 注册

QQ|手机版|Archiver|Oracle数据库数据恢复、性能优化

GMT+8, 2024-11-15 12:59 , Processed in 0.052546 second(s), 22 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

回顶部
TEL/電話+86 13764045638
Email service@parnassusdata.com
QQ 47079569