Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Behavior of asmcmd 'rm' command

EdStevensOct 20 2015 — edited Oct 26 2015

Oracle 11.2.0.4 SE One

GI 11.2.0.4 standalone ASM, no RAC no cluster

Oracle Linux 5

Noticed this today while doing some testing of a script to 'refresh' a test db from prod via the rman DUPLICATE db command.  This script was inherited from my predecessor and has been running for several years with only an occasional hiccup.  One of the steps has multiple asmcmd commands to delete the files of the test db prior to running the rman DUPLICATE.  Over the years the specification of the files to be deleted has become something of a mish-mash, so I thought I'd clean it up and fix it so it doesn' care so much about specifics.

I thought I noticed something strange in the running of my revised script, but in the end everything came out ok.  But I was still a bit curious so tried it manually (with the db shut down, of course).  Here's what I observed.

Notice the following:

line 2 - change directories to +LARGE/DWSTGVB

line 3 - confirm the current directory

line 5 - check the contents

line 13 - delete the contents, recursively.

line 14 - check that the contents have been deleted

line 15 - WHAAT?

line 16 - says I'm in the directory that line 15 says does not exist

line 18 - try to go to the parent directory - +LARGE

line 19 - WHAAT???

line 20-21 .. my current directory is still the directory that 'does not exist'

line 22 - go directly to the parent directory ... not relative to the current

line 23 - check the contents .. sure enough +LARGE/DWSTGVB does not exist

oracle:+ASM$ asmcmd

ASMCMD> cd LARGE/DWSTGVB

ASMCMD> pwd

+LARGE/DWSTGVB

ASMCMD> ls -l

Type         Redund  Striped  Time             Sys  Name

                                               Y    CONTROLFILE/

                                               Y    DATAFILE/

                                               Y    ONLINELOG/

                                               Y    TEMPFILE/

                                               N    control01.ctl => +LARGE/DWSTGVB/CONTROLFILE/current.260.893598983

                                               N    control02.ctl => +LARGE/DWSTGVB/CONTROLFILE/current.261.893598987

ASMCMD> rm -fr *

ASMCMD> ls -l

ASMCMD-8002: entry 'DWSTGVB' does not exist in directory '+LARGE/'

ASMCMD> pwd

+LARGE/DWSTGVB

ASMCMD> cd ..

ASMCMD-8002: entry 'DWSTGVB' does not exist in directory '+LARGE/'

ASMCMD> pwd

+LARGE/DWSTGVB

ASMCMD> cd +LARGE

ASMCMD> ls

ASMCMD> pwd

+LARGE

ASMCMD> exit

So, how is it the 'rm' command deleted the current directory? 

This post has been answered by JuanM on Oct 20 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 23 2015
Added on Oct 20 2015
8 comments
2,263 views