【asmcmd】使用asmcmd工具管理ASM

kingsql發表於2014-08-14
類似於sqlplus運算元據庫一樣,asmcmd工具可以實現對ASM的管理。
簡單直觀的看一下asmcmd帶給我的功能。

1.連線到ASM例項
既然要管理ASM,必要要指定ASM例項,我們需要告知asmcmd的兩件事情是:①.ORACLE_HOME環境變數是什麼;②.所要連線到的ASM例項時什麼。
然後直接使用“asmcmd”或“asmcmd -p”(-p選項可以在命令提示符中給出當前的路徑資訊)便可連線到對應的ASM。
RACDB1@rac1 /home/oracle$ export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
RACDB1@rac1 /home/oracle$ export ORACLE_SID=+ASM1
+ASM1@rac1 /home/oracle$ asmcmd
ASMCMD>
ASMCMD> exit
+ASM1@rac1 /home/oracle$ asmcmd -p
ASMCMD [+] >

2.獲取asmcmd工具的幫助資訊
ASMCMD [+] > help
        asmcmd [-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
        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:
        --------
        cd
        du
        find
        help
        ls
        lsct
        lsdg
        mkalias
        mkdir
        pwd
        rm
        rmalias

asmcmd工具提供了以上簡單的操作ASM檔案的命令。

3.將常用的命令做一個演示
ASMCMD [+] > ls
DATA/
FRA/
ASMCMD [+] > cd DATA
ASMCMD [+DATA] >
ASMCMD [+DATA] > cd ..
ASMCMD [+] > lsct
DB_Name   Status        Software_Version  Compatible_version  Instance_Name
RACDB     CONNECTED           10.2.0.1.0          10.2.0.1.0  RACDB1
RACDB     CONNECTED           10.2.0.1.0          10.2.0.1.0  RACDB1
ASMCMD [+] > lsdg
State    Type    Rebal  Unbal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Name
MOUNTED  EXTERN  N      N         512   4096  1048576      2047        7                0               7              0  DATA/
MOUNTED  EXTERN  N      N         512   4096  1048576      2047     1825                0            1825              0  FRA/

ASMCMD [+data/racdb] > pwd
+data/racdb
ASMCMD [+data/racdb] > ls
1_10_733447664.dbf
1_11_733447664.dbf
1_12_733447664.dbf
1_13_733447664.dbf
1_14_733447664.dbf
1_15_733447664.dbf
1_16_733447664.dbf
1_17_733447664.dbf
1_18_733447664.dbf
1_19_733447664.dbf
1_20_733447664.dbf
1_3_733447664.dbf
1_4_733447664.dbf
1_5_733447664.dbf
1_6_733447664.dbf
1_7_733447664.dbf
1_8_733447664.dbf
1_9_733447664.dbf
2_1_733447664.dbf
2_2_733447664.dbf
2_3_733447664.dbf
2_4_733447664.dbf
2_5_733447664.dbf
ARCHIVELOG/
CONTROLFILE/
DATAFILE/
ONLINELOG/
PARAMETERFILE/
TEMPFILE/
spfileRACDB.ora

4.小結
asmcmd工具提供的功能雖然不是很豐富,但對於相對閉塞的ASM來說,它是一個非常有效的操作工具。

Good luck.

secooler
10.11.06

-- The End --

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

相關文章