Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to analyze asmcmd

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

How to carry out asmcmd analysis, I believe that many inexperienced people do not know what to do. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

In an ASM instance, all files stored in ASM disk groups are not accessible to operating system commands, so you cannot use regular commands to manipulate files on ASM disks. Fortunately, we have ASMCMD tools to do this instead of operating system commands. The ASMCMD tool provides common commands similar to operating systems, such as ls, du, find,cd, rm, mkdir, and so on. With the help of these tools, it is easier to manage ASM instances.

ASMCMD usage example

Set the ORACLE_SID environment variable before startup

$export ORACLE_SID=+ASM

$asmcmd

ASMCMD > help-- at the asmcmd command prompt, enter help [Command] to display the command help information

Asmcmd [- p] [command]-this method can directly complete the corresponding function without going to the ASMCMD prompt

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 > help lsct-- check the specific usage of the command. This example is lsct.

Lsct [- H] [group]

List all clients and their attributes from V$ASM_CLIENT. If group is

Specified, then return only information on that group.

The-H flag suppresses the column headers from the output.

$asmcmd-p ls-l-there is no need to enter the ASMCMD command prompt to complete the corresponding function

State Type Rebal Unbal Name

MOUNTED NORMAL N N DG1/

MOUNTED NORMAL N N DG2/

MOUNTED EXTERN N N REV/

ASMCMD > ls-l-- View basic information about disk groups

State Type Rebal Unbal Name

MOUNTED NORMAL N N DG1/

MOUNTED NORMAL N N DG2/

MOUNTED EXTERN N N REV/

ASMCMD > ls-s-View the details of the disk group, such as disk size, free space, sector size, etc.

Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Name

512 4096 1048576 3058 1498 0 749 0 DG1/

512 4096 1048576 200 98 0 49 0 DG2/

512 4096 1048576 3074 2949 0 2949 0 REV/

ASMCMD > ls-ld-- View directory information

Type Redund Striped Time Sys Name

Y czmmiao/

ASMCMD > du-- View the capacity used by the current directory disk

Used_MB Mirror_used_MB

804 1541

ASMCMD > pwd-- shows the current path

+

ASMCMD > cd DG1-- the cd command changes the current directory

ASMCMD > pwd

+ DG1

ASMCMD > find-t datafile + DG1/asmdb sys*-- find is used to find the object. The-t parameter specifies the object type. The object type must be the object type in v$asm_file.type.

+ DG1/asmdb/DATAFILE/SYSAUX.261.734885459

+ DG1/asmdb/DATAFILE/SYSTEM.259.734885389

ASMCMD > cd + DG1/asmdb/DATAFILE/

ASMCMD > mkalias EXAMPLE.264.800386585 aaa-- create aliases for objects

ASMCMD > ls

EXAMPLE.264.800386585

SYSAUX.257.800386397

SYSTEM.256.800386395

UNDOTBS1.258.800386397

UNDOTBS2.265.800386713

USERS.259.800386397

Aaa

ASMCMD > ls-a-- View alias information from v$asm_alias

+ DATA/CZMMIAO/DATAFILE/aaa = > EXAMPLE.264.800386585

None = > SYSAUX.257.800386397

None = > SYSTEM.256.800386395

None = > UNDOTBS1.258.800386397

None = > UNDOTBS2.265.800386713

None = > USERS.259.800386397

Aaa

ASMCMD > rmalias aaa-- Delete object aliases

ASMCMD > ls-a

None = > EXAMPLE.264.800386585

None = > SYSAUX.257.800386397

None = > SYSTEM.256.800386395

None = > UNDOTBS1.258.800386397

None = > UNDOTBS2.265.800386713

None = > USERS.259.800386397

ASMCMD > lsdg-- View disk group information

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 3815 2529 0 2529 0 DATA/

ASMCMD > lsct-- View asm client information

DB_Name Status Software_Version Compatible_version Instance_Name

Czmmiao CONNECTED 10.2.0.1.0 10.2.0.1.0 czmmiao1

ASMCMD > mkdir bbb ccc-- create bbb and ccc directories

ASMCMD > ls

EXAMPLE.264.800386585

SYSAUX.257.800386397

SYSTEM.256.800386395

UNDOTBS1.258.800386397

UNDOTBS2.265.800386713

USERS.259.800386397

Bbb/

Ccc/

ASMCMD > rmdir bbb ccc-- Delete the bbb and ccc directories. The rm command has two parameters-r and-f, using the same as the rm command of linux

11g R2 new command

Cp: you can copy files not only between ASM and OS, but also between different ASM Instance and Diskgroup

Cp + dgtest/test/datafile/USERS.264.646186565 users.dbf

Md_backup: backing up metadata in disk group to a file

Md_backup / tmp/backupfile-G DATAGP

Md_restore: restore metadata from backup files to disk group

Md_restore-full-G data-- silent / tmp/file

Lsattr: lists the attributes of disk group

Lsattr-l-G DATAGP

Setattr: setting properties of disk group

Setattr-G DATAGP compataible.asm 11.2.0.0.0

Lsof: displays the open files of local clients

Lsof-G DATAGP

Chdg: modify disk group, add, or drop disk

Chdg DATAGP_config.xml

Chkdg: metadata of check or repair disk group

Chkdg-repair DATAGP

Dropdg: drop disk group

Dropdg-r-f DATAGP

Iostat: check out statics O statics via v$asm_disk_iostat

Iostat-G DATAGP

Lsdsk: list ASM disks

Lsdsk-p-G DATAGP / dev/raw/*

Lsdsk-candidate-p

Lsod: list open ASM disks

Lsod-G DATAGP

Mkdg: create disk group based on a xml file

Mkdg DATAGP_config.xml

Mount: mount a disk group

Mount-f DATAGP

Mount-restrict DATAGP

Mount-a

Offline: offline disks or failure groups that belong to disk group.

Offline-G DATAGP-F FG1

Online: online disks or a failure group

Online-G DATAGP-D data_0001-- power=3

Rebal: rebalance a disk group

Rebal-power 4 DATAGP

Remap: mark blocks as unusable on the disk and relocates data

Remap DATAGP data_0001 50000700

Umount: dismount a disk group

Unmount-f DATAGP

Pwcopy: copy password file

Pwcopy-- asm + DG/mydir/mypwfile + DG1/mypwfile

Pwcreate: create password file for sys

Pwcreate-- asm + DG/mdir/mypwfile 'welcome'

Pwdelete: delete password file

Pwdelete-- asm + DG/mydir/mypwfile

Pwget: get the location of password file

Pwget-asm

Pwmove: move password file

Pwmove-- asm + DG/mydir/mypwfile + DG1/mypwfile

Pwset: set the location of password file

Pwset-dbuniquename aime1 + DG/mydir/mypwfile

Dsget: get the discovery disk string

Dsget

Dsset: set the discovery disk string

Dsset / dev/raw/*

Lsop: list current operations on disk group from v$asm_operation

Lsop

Shutdown: shutdown ASM instance

Shut immediate

Spbackup: backup ASM Spfile

Spbackup + DATA/asm/asmprameterfile/register.323.234 + DATA/spf.bak

Spcopy: copy spfile

Spcopy + DATA/asm/asmprameterfile/register.323.234 + DATA/spf.ora

Spget: get the spfile location

Spget

Spmove: move spfile

Spmove + DATA/spf.ora + DATA1/spf.ora

Spset: set the location of spfile

Spset + DATA/spf.ora

Startup: startup ASM instance

Startup-nomount-pfile asm.ora

Chtmpl: change the properties of template

Chtmpl-G DATAGP-redundancy high-striping fine mytemplate

Lstmpl: list templates

Ls-l-G DATAGP

Mktmpl: add template to disk group

Mktmpl-G DATA-redundancy mirror-striping coarse

Rmtmpl: remove template from disk group

Rmtmpl-G DATAGP mytp

Chgrp: change user group of files

Chgrp asm-data + data/mydir/a.f

Chmod: change permissions of files

Chmod 640 a.f

Chown: change owner of files

Chown user:usergroup a.f

Groups: list all user groups of a user

Groups DATAGP user

Grpmod: add or remove OS users to ASM user group

Grpmod-add fra asm_fra oracle1 oracle2

Lsgrp: list all ASM user groups

Lsgrp-a

Lspwusr: list users from ASM password file

Lspwusr

Lsusr: list users in a disk group

Lsusr-G DATAGP

Mkgrp: create new ASM user group

Mkgrp DATAGP asm_data oracle1 oracle2

Mkusr: add OS user to a disk group

Mkusr DATA oracle1

Orapwusr: add, drop, modify ASM password file user

Orapwusr-add-privilege sysdba hrusr

Passwd: change password of a user

Passwd oracle2

Rmgrp: remove a user group from disk group

Rmgrp DATAGP asm_data

Rmusr: remove an OS user from disk group

Rmusr DATAGP oracle2

Rpusr: replace OS user1 with OS user2

Rpusr DATAGP oracle1 oracle2

Volcreate: create an ADVM volume in disk group

Volcreate-G DATA-s 10G-- width 64K-- column 8 volume1

Voldelete: delete an ADVM volume

Voldelete-G DATAGP volume1

Voldisable: disable an ADVM volumes in mounted disk groups and remove the volume device on the local node

Voldisable-G DATAGP volume1

Volenable: enable ADVM volume in mounted disk groups

Volenable-G DATAGP volume1

Volinfo: display information of ADVM volumes

Volinfo-G DATAGP volume1

Volresize: resize an ADVM volume

Volresize-G DATAGP-s 20G volume1

Volset: set attributes of ADVM volume

Volset-G DATA-- usagestring'no file system attached' volume1

Volstat: report I/O statistics of ADVM volume

Volstat-G DATAGP

After reading the above, have you mastered the method of how to analyze asmcmd? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report