solaris10上oracle10g之asm_asmcmd和rman歸檔日誌資料不同學習

wisdomone1發表於2009-11-25
Normal 0 7.8 磅 0 2 false false false MicrosoftInternetExplorer4 1.       -bash-3.00# su - ora10g                ---切換到oracle使用者

2.       -bash-3.00$ export ORACLE_SID=+ASM     ---配置連線asm例項的環境變數

3.       -bash-3.00$ asmcmd                     ---進入asmcmd工具

ASMCMD> help                         ---檢視asmcmd工具的相關指南說明

        asmcmd [-p] [command]        --加上-p選項會在asmcmd中顯示當前目錄

 

        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

        SYSDBA.  The user must be a member of the SYSDBA group.

 

        Specifying the -p option allows the current directory to be displayed

        in the command prompt, like so:

 

        ASMCMD [+DATAFILE/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:                       ---下為asmcmd工具的相關命令

        --------

        cd  --切換目錄(類似於solaris的cd)

        du  --檢視目錄已使用情況

        find 檢視一個命令的用法

        help

        ls   --類似於solaris的ls

        lsct  --檢視目前使用asm 例項的oracle例項(注:可能多個oracle例項共享一個asm例項,或者一個oracle例項對應一個asm例項)

        lsdg  --顯示碰盤組的情況(asm例項,是由多個碰盤組構成,一個磁碟組下含1或從個磁碟)

        mkalias 

        mkdir  --構建一個目錄

        pwd    --顯示當前目錄

        rm     --類似於solaris的rm

        rmalias

-bash-3.00$ asmcmd -p

ASMCMD [+] > pwd   --[+] 為當前目錄

+

ASMCMD [+] > ls    --可以看到目錄有兩個目錄

ARCH/

DATA/

ASMCMD [+] > cd arch  --切換目錄

ASMCMD [+arch] > pwd

+arch

ASMCMD [+arch] > ls

ASM10G/

ASMCMD [+arch] > cd asm10g

ASMCMD [+arch/asm10g] > ls

ARCHIVELOG/

ASMCMD [+arch/asm10g] > cd archivelog

ASMCMD [+arch/asm10g/archivelog] > pwd

+arch/asm10g/archivelog

ASMCMD [+arch/asm10g/archivelog] > ls

2009_11_26/

ASMCMD [+arch/asm10g/archivelog] > cd 2009_11_26

ASMCMD [+arch/asm10g/archivelog/2009_11_26] > ls

thread_1_seq_7.260.703906467

thread_1_seq_8.259.703906519

ASMCMD [+arch/asm10g/archivelog/2009_11_26] > rm thread_1_seq_8.259.703906519

--刪除一個歸檔日誌

ASMCMD [+arch/asm10g/archivelog/2009_11_26] > ls  --再次檢視已經刪除

thread_1_seq_7.260.703906467

ASMCMD [+arch/asm10g/archivelog/2009_11_26] > exit  --退出asmcmd

4.       -bash-3.00$ export ORACLE_SID=asm10g   --連線oracle例項

--(注:asm例項和oracle例項的ORACLE_SID是不同的,請注意)

5.       -bash-3.00$ rman target /   --進入rman工具

 

Recovery Manager: Release 10.2.0.2.0 - Production on Thu Nov 26 01:50:33 2009

 

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

 

connected to target database: ASM10G (DBID=40435634)

 

RMAN> list archivelog all;   --顯示所有的歸檔日誌

--請注意:塗藍部分,可以看到在asmcmd中刪除的歸檔日誌也顯示在這兒

 

using target database control file instead of recovery catalog

 

List of Archived Log Copies

Key     Thrd Seq     S Low Time  Name

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

2       1    2       X 26-NOV-09 +ARCH/asm10g/archivelog/2009_11_26/thread_1_seq_2.256.703906333

1       1    3       X 26-NOV-09 +ARCH/asm10g/archivelog/2009_11_26/thread_1_seq_3.257.703906335

3       1    4       X 26-NOV-09 +ARCH/asm10g/archivelog/2009_11_26/thread_1_seq_4.258.703906339

4       1    5       X 26-NOV-09 +ARCH/asm10g/archivelog/2009_11_26/thread_1_seq_5.259.703906347

5       1    6       X 26-NOV-09 +ARCH/asm10g/archivelog/2009_11_26/thread_1_seq_6.260.703906373

6       1    7       A 26-NOV-09 +ARCH/asm10g/archivelog/2009_11_26/thread_1_seq_7.260.703906467

7       1    8       A 26-NOV-09 +ARCH/asm10g/archivelog/2009_11_26/thread_1_seq_8.259.703906519

 

RMAN> crosscheck archivelog all;--更新rman中儲存歸檔日誌的資訊

 

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=138 devtype=DISK

validation failed for archived log

archive log filename=+ARCH/asm10g/archivelog/2009_11_26/thread_1_seq_2.256.703906333 recid=2 stamp=703906336

validation failed for archived log

archive log filename=+ARCH/asm10g/archivelog/2009_11_26/thread_1_seq_3.257.703906335 recid=1 stamp=703906335

validation failed for archived log

archive log filename=+ARCH/asm10g/archivelog/2009_11_26/thread_1_seq_4.258.703906339 recid=3 stamp=703906338

validation failed for archived log

archive log filename=+ARCH/asm10g/archivelog/2009_11_26/thread_1_seq_5.259.703906347 recid=4 stamp=703906346

validation failed for archived log

archive log filename=+ARCH/asm10g/archivelog/2009_11_26/thread_1_seq_6.260.703906373 recid=5 stamp=703906373

validation succeeded for archived log

archive log filename=+ARCH/asm10g/archivelog/2009_11_26/thread_1_seq_7.260.703906467 recid=6 stamp=703906466

validation failed for archived log

archive log filename=+ARCH/asm10g/archivelog/2009_11_26/thread_1_seq_8.259.703906519 recid=7 stamp=703906519

Crosschecked 7 objects

 

 

RMAN> list expired archivelog all;--顯示過期的歸檔日誌(過期就是已經物理刪除的歸檔)

                                  對比發現透過asmcmd刪除的歸檔已經顯示出來

 

 

List of Archived Log Copies

Key     Thrd Seq     S Low Time  Name

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

2       1    2       X 26-NOV-09 +ARCH/asm10g/archivelog/2009_11_26/thread_1_seq_2.256.703906333

1       1    3       X 26-NOV-09 +ARCH/asm10g/archivelog/2009_11_26/thread_1_seq_3.257.703906335

3       1    4       X 26-NOV-09 +ARCH/asm10g/archivelog/2009_11_26/thread_1_seq_4.258.703906339

4       1    5       X 26-NOV-09 +ARCH/asm10g/archivelog/2009_11_26/thread_1_seq_5.259.703906347

5       1    6       X 26-NOV-09 +ARCH/asm10g/archivelog/2009_11_26/thread_1_seq_6.260.703906373

7       1    8       X 26-NOV-09 +ARCH/asm10g/archivelog/2009_11_26/thread_1_seq_8.259.703906519

 

6.       總結:

A.       asmcmd是oracle為了簡化asm管理,引入的一種工具

B.       asmcmd可以直接刪除oracle產生的歸檔日誌,但並未及時更新rman對應儲存歸檔日誌的資訊,所以利用rman 看到的歸檔日誌和利用asmcmd看到的歸檔日誌數量會不一樣

(也就是說rman中的list archivelog all把所有刪除和沒有刪除的歸檔全部顯示出來)

C.       不建議直接利用asmcmd刪除歸檔日誌,在生產請採用rman進行歸檔日誌的清理工作

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9240380/viewspace-620546/,如需轉載,請註明出處,否則將追究法律責任。

相關文章