7 Replies Latest reply: May 23, 2012 3:52 AM by 505789 RSS

    Validate if ASM file is in use

    505789
      Is there a way to validate if a file in ASM is being used by the database? Like the old fuser...?

      Thank you.
        • 1. Re: Validate if ASM file is in use
          Billy~Verreynne
          usersp wrote:
          Is there a way to validate if a file in ASM is being used by the database? Like the old fuser...?
          No - ASM is not like a cooked file system. Have not seen any asmcmd or ASM v$ virtual view that shows process owners that own open file handles on a specific file.

          Exactly why do you want this?

          There is a v$asm_client that indicates which database instances are using the ASM instance:
          SQL> desc v$asm_client
           Name                    Null?    Type
           ----------------------- -------- ----------------
           GROUP_NUMBER                     NUMBER
           INSTANCE_NAME                    VARCHAR2(64)
           DB_NAME                          VARCHAR2(8)
           STATUS                           VARCHAR2(12)
           SOFTWARE_VERSION                 VARCHAR2(60)
           COMPATIBLE_VERSION               VARCHAR2(60)
          • 2. Re: Validate if ASM file is in use
            505789
            To delete a file and to be sure nothing bad will happen... :)
            • 3. Re: Validate if ASM file is in use
              Levi Pereira
              Hi,

              If you are using Grid Infrastructure 11.2

              You can use asmcmd commands
              Check it:
              $ asmcmd help lsof
                      lsof
              
                      Lists the open files of the local clients.
              
                      lsof [--suppressheader] {-G diskgroup|--dbname db| -C instance}
              
                      The options for the lsof command are described below.
              
                      --suppressheader - Suppresses column headings.
                      -G diskgroup     - List files only from this specified disk group.
                      --dbname db      - List files only from this specified database.
                      -C instance      - List files only from this specified instance.
              
                      The following are examples of the lsof command. The first example lists
                      the open files for the data disk group. The second example lists the
                      open files for the Oracle ASM instance.
              
              ASMCMD [+] > lsof -G data
              DB_Name  Instance_Name  Path
              orcl     orcl           +data/orcl/controlfile/current.260.691577263
              orcl     orcl           +data/orcl/datafile/example.265.691577295
              orcl     orcl           +data/orcl/datafile/sysaux.257.691577149
              orcl     orcl           +data/orcl/datafile/system.256.691577149
              orcl     orcl           +data/orcl/datafile/undotbs1.258.691577151
              orcl     orcl           +data/orcl/datafile/users.259.691577151
              orcl     orcl           +data/orcl/onlinelog/group_1.261.691577267
              orcl     orcl           +data/orcl/onlinelog/group_2.262.691577271
              orcl     orcl           +data/orcl/onlinelog/group_3.263.691577275
              orcl     orcl           +data/orcl/tempfile/temp.264.691577287
              
              ASMCMD [+] > lsof -C +ASM
              DB_Name  Instance_Name  Path
              asmvol   +ASM           +data/VOLUME1.271.679226013
              asmvol   +ASM           +data/VOLUME2.272.679227351
              $ asmcmd help lsod
                      lsod
              
                      Lists the open ASM disks.
              
                      lsod [-G diskgroup] [--suppressheader] [--process process] [pattern]
              
                      The options for the lsod command are described below.
              
                      -G diskgroup    - Specifies the disk group that contains the open disks.
                      --suppressheader        - Suppresses column header information from the output.
                      --process - Specifies a pattern to filter the list of processes.
                      pattern - Specifies a pattern to filter the list of disks.
              
                      The rebalance operation (RBAL) opens a disk both globally and
                      locally so the same disk may be listed twice in the output for
                      the RBAL process.
              
                      The following are examples of the lsod command. The first example lists
                      the open devices associated with the DATA disk group and the LGWR
                      process. The second example lists the open devices associated with
                      the LGWR process for disks that match the diska pattern.
              
                      ASMCMD [+] > lsod -G DATA --process LGWR
                      Instance Process                  OSPID Path
                      1        oracle@dadvmn0652 (LGWR) 26593 /devices/diska1
                      1        oracle@dadvmn0652 (LGWR) 26593 /devices/diska2
                      1        oracle@dadvmn0652 (LGWR) 26593 /devices/diska3
                      1        oracle@dadvmn0652 (LGWR) 26593 /devices/diskb1
                      1        oracle@dadvmn0652 (LGWR) 26593 /devices/diskb2
                      1        oracle@dadvmn0652 (LGWR) 26593 /devices/diskb3
                      1        oracle@dadvmn0652 (LGWR) 26593 /devices/diskd1
              
                      ASMCMD [+] > lsod --process LGWR diska
                      Instance Process                  OSPID Path
                      1        oracle@dadvmn0652 (LGWR) 26593 /devices/diska1
                      1        oracle@dadvmn0652 (LGWR) 26593 /devices/diska2
                      1        oracle@dadvmn0652 (LGWR) 26593 /devices/diska3
              Regards,
              Levi Pereira
              • 4. Re: Validate if ASM file is in use
                Levi Pereira
                usersp wrote:
                To delete a file and to be sure nothing bad will happen... :)
                ASM does not allow delete a file in use. You should check a database level (e.g v$datafile) to see if that file belong a database.

                Regards,
                Levi Pereira
                • 5. Re: Validate if ASM file is in use
                  Billy~Verreynne
                  Levi Pereira wrote:

                  If you are using Grid Infrastructure 11.2
                  You can use asmcmd commands
                  Thanks Levi. I had a look in asmcmd and missed seeing this command - but then I only had 2 cups of coffee and not the usual 4+ in the morning. Its with caffeine I set my mind in motion, it is with the beans of Java that thought acquires speed. ;-)
                  • 6. Re: Validate if ASM file is in use
                    Levi Pereira
                    Due timezone (here was 4pm) I took several cups of coffee. So my mind was going very fast. (My processor was running at 10GHZ). :)
                    • 7. Re: Validate if ASM file is in use
                      505789
                      Thank you to both :)