CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
ASM Reclamation Utility (ASRU)

 

First page Previous page 1 2 Next page Last page  View All


NiaCo
Novice

Nov 23, 2013, 5:27 AM

Post #1 of 32 (3086 views)
ASM Reclamation Utility (ASRU) Can't Post

Dear all,
The story is too long but I'll try my best to sum it up.

Main Problem: The SAN storage which is storing the ORACLE ASM database, cannot reclaim the free space after you eliminate one or more databases or tablespaces. Therefore at the end the storage will go offline as it indicates that the storage capacity is over and there is no more free space, whereas in reality there might be hundreds of GB free space.

Solution: Don't even think about any other solution rather than the one which I'm going to mention here.
To overcome this problem, there is a utility which has been created by cooperation of HP 3PAR and Oracle, known as ASM Reclamation Utility (ASRU).

Perl problem: Now I'm stuck because when I try to use this utility it will throw me an error at the middle of the reclamation process saying that "Zerofill is not executable".
This utility is containing 2-3 scripts which are written in Perl language, and when I run the main script (ASRU.pl) by using "perl ASRU.pl - MyDiskGroupName" it will start the process and at the middle that sounds that it wants to call the second script (zerofill), but it can not and say that : Zerofill is not executable

Specifications:
OS : Win Server 2008 R2 x64
Oracle : 11gR2 x64
Visual Studio 2012 is installed to run the script from its command line
All Microsoft .Net framework is are installed
Windows SDK is installed
The latest version of ActivePerl is installed and ppm is used to install and update all required packages (such as DBI, and DBD,...)

I can be considered a novice in Perl, but I need this problem of mine by this utility.
I don't know how can you guys help me, but I'll appreciate your assists in advance.

Regards.
Attachments: asruv12-1517734.zip (12.1 KB)


FishMonger
Veteran / Moderator

Nov 23, 2013, 6:29 AM

Post #2 of 32 (3082 views)
Re: [NiaCo] ASM Reclamation Utility (ASRU) [In reply to] Can't Post

zerofill is a perl script but doesn't have the .pl file extension, which Windows needs to know what program to use to execute the script (i.e., the perl interpreter).

Do you have a .pl file type association configured i.e., can you run perl scripts from the command line without directly passing the script to perl?

e.g., instead of executing it like this:
C:\>perl ASRU.pl

can you execute it like this:
C:\>ASRU.pl

If not, then fixing that problem should be your first step. The next step would be to add the .pl extension to the zerofill script and adjust the ASRU.pl script accordingly.


(This post was edited by FishMonger on Nov 23, 2013, 6:45 AM)


NiaCo
Novice

Nov 24, 2013, 11:31 PM

Post #3 of 32 (3016 views)
Re: [FishMonger] ASM Reclamation Utility (ASRU) [In reply to] Can't Post

Dear FishMonger,

First of all thanks for your reply, and your willingness to help me.
No, I can not do such a thing, e.g. executing "C:\>ASRU.pl".
How to fix? what do you mean by fix, and how am I supposed to fix?
Windows CMD does not recognize ASRU.pl as a command.
I did not find anything about zerofill in ASRU.pl script to modify it.

What do you think?


NiaCo
Novice

Nov 25, 2013, 11:33 PM

Post #4 of 32 (2947 views)
Re: [NiaCo] ASM Reclamation Utility (ASRU) [In reply to] Can't Post

I found in the script this one:

if(! -x $script)
{
print "\n $script is not executable\n";
return;
}

What I might need to know in the first step is knowing that what is "-x" exactly. Maybe if I know I can solve the problem.

What do you think?


Laurent_R
Veteran / Moderator

Nov 26, 2013, 2:31 PM

Post #5 of 32 (2940 views)
Re: [NiaCo] ASM Reclamation Utility (ASRU) [In reply to] Can't Post

This is a test on the file mode. You may want to change the file mode of the script to 755 if this is under Unix or Linux.

If this is under Windows, I am not quite sure on how to do that (or even if these modes even exist with the same leven of details).


BillKSmith
Veteran

Nov 26, 2013, 3:35 PM

Post #6 of 32 (2937 views)
Re: [NiaCo] ASM Reclamation Utility (ASRU) [In reply to] Can't Post

File tests are documented in peldoc -f -X
Good Luck,
Bill


NiaCo
Novice

Nov 26, 2013, 11:18 PM

Post #7 of 32 (2911 views)
Re: [Laurent_R] ASM Reclamation Utility (ASRU) [In reply to] Can't Post

Hi,
Thanks for your assists,
I found out the permission in windows is different in Unix or Linux, and you can not modify these permissions in windows. So I installed "Cygwin" to do that.
I went to the directory in which the zerofill file exist and then I did like this:
chmod ugoa+rwx zerofill

another time I did like this:
chmod 777 zerofill

also I've given the whole directory full permission to everyone, but it does not make any change at all, and every time I use this command:
ls -l zerofill
I'll get this result:
-rwxrwxrwx+ 1 Administrator None 4235 Nov 26 05:14 zerofill

or when I use this command in the directory:
ls -l
I'll get this:
total 145
-rwxrwxrwx+ 1 Administrator None 1467 Feb 8 2012 ASRU
-rwxrwxrwx+ 1 Administrator None 34589 Nov 25 23:59 ASRU.pl
-rwxrwxrwx+ 1 Administrator None 86818 Nov 26 22:32 ASRU.trc
-rwxrwxrwx+ 1 Administrator None 4308 Nov 2 2011 README
-rwsrwsrwt+ 1 Administrator None 4235 Nov 26 05:14 zerofill

What do you think guys? What do I have to do? Is cygwin only a simulator or I can apply some changes like this? What do you suggest?

Regards.


FishMonger
Veteran / Moderator

Nov 27, 2013, 6:29 AM

Post #8 of 32 (2886 views)
Re: [NiaCo] ASM Reclamation Utility (ASRU) [In reply to] Can't Post

Your original error message was not related to file permissions. It was due to the fact that Windows did not know how to execute the script because there was no .pl file type association. You'd have the same error/problem running batch files if you remove the .bat file type association.

With a normal install of Activestate perl, the install process will create that .pl file type association. However, you can uncheck that option and not have it create that association, which is what it appears you did. So now you need to manually create that file type association.

http://technet.microsoft.com/en-us/library/cc754587.aspx
http://dataerror.blogspot.com/2008/05/changing-file-type-association-in.html

When running scripts under Cygwin, instead of using a file extension to determine how to execute a script, it uses the shebang line (the first line in the script) to point to the interpreter. In addition to that, the execute bit needs to be set which is done via the chmod command and you need to execute it under the Cygwin environment instead of the Windows prompt.

What error message do you get when running the script under the cygwin environment?


NiaCo
Novice

Nov 27, 2013, 1:03 PM

Post #9 of 32 (2868 views)
Re: [FishMonger] ASM Reclamation Utility (ASRU) [In reply to] Can't Post

Hey FishMonger,

I appreciate your willingness for helping me.
the "zerofill" file does not have any extension such as ".pl"

As I said the main file is "ASRU.pl" that I run it in the Visual studio's command line using the follwing command:
"perl ASRU.pl MyDiskGroupName"
Then it shows the progress, but at the middle of running it needs to call "zerofill" (NOT zerofill.pl) it will ask me that specify where the "zerofill" is located because of these lines of code:

if( -e "$ENV{'PWD'}/zerofill")
{
$script = "$ENV{'PWD'}";
}
else
{
print "Enter the path for the zerofill script: ";

then it will take it:

$script = <STDIN>;

chomp($script);

and then it will tell me that the file which I am indicating is not an executable script because of this:

if(! -x $script)
{
print "\n $script is not executable\n";
return;
}

whereas, if everything was fine it was not supposed to ask anything or throw me this error, but also it is supposed to execute the "zerofill" (and other files) to accomplish the job automatically.

I am not that much into programing or writing scripts, as my background is in storage, cloud computing, and network.
So I can be seen as a novice in this area.
But my problem needs to be solved by running this script.

I read the script and I thought that it should be because of permission issues as I investigated in the switch in the script. "x" is used with "chmod" for making a file executable as I understood, and when according to my system's environment and configuration the script's trend is navigated to this switch it is set to warn me that the "zerofill" file is not executable.

I tried to make the attribute of this file "executable" (or something like full permission for everyone).
But very soon, I got to know that with windows permission can not modify the permission which is given to a file in a Linux or UNIX.
Even I planned to change the permission of this file in Linux, and then bring it back to windows, but again I understood that you can do this, but again when the file come back to windows it will loos the execute permission permission as it could not keep execute permission when I took these scripts for the first time (though I did not try this way, and I just read about it).

That's why I installed Cygwin to provide a Linux command line environment to be able to give the required permission (not for running the script, although after that I tried to use it to run the script inside, but bunch of errors appeared and I just forgot this idea).
I don't know how silly that sound to you, but that is my challenge and I've to find a way for that.

Then I tried this one:
"chmod ugoa+rwx zerofill"

and so many other chmod, but whenever I used "ls -l zerofill", I could see that no change is applied to the file.

I don't know what to do and I don't really know whether the problem is with permission or not.

I'll be happy if you or anyone else share their idea about this with me.

Again I want to emphasize that the "zerofill" does not have any extension like ".pl", and my question is that, can it be because of that or not.

Regards.


FishMonger
Veteran / Moderator

Nov 27, 2013, 1:28 PM

Post #10 of 32 (2864 views)
Re: [NiaCo] ASM Reclamation Utility (ASRU) [In reply to] Can't Post

Your main problem is that you're not understanding the differences between Windows and *nix in how they determine how to execute programs/scripts.

Windows uses the file extension and *nix uses the shebang line.

For example, a plain text file with an extension of .txt is not by itself executable, but if you double click on it, it will open in your default text editor. That's because you have a .txt file type association that Windows uses to know which program (text editor) to pass the file to in order to open it up.

You need to either add the .pl ext to zerofill and do the same in the script and create the .pl file type association OR you need to adjust the script to execute perl and pass zerofill as its argument just like you're doing when you execute "perl ASRU.pl MyDiskGroupName".

At this point I'm assuming you're running the script at the Windows cmd prompt which uses your Activestate perl installation. If you're running the script under the cygwin environment, which is an emulated bash shell, you would then need to use chmod to set the correct permissions and verify that the shebang line in each of the scripts is correct.


NiaCo
Novice

Nov 27, 2013, 10:34 PM

Post #11 of 32 (2848 views)
Re: [FishMonger] ASM Reclamation Utility (ASRU) [In reply to] Can't Post

Hi,

I did this one:
You need to either add the .pl ext to zerofill and do the same in the script and create the .pl file type association

but same error apears, but this time intead of saying "zerofill is not executable" it throws me this error:
"zerofill.pl is not executable"

while I modified the codes correctly.

Also take a look at this one please:

ASRU is a shell script wrapper for ASRU.pl. It calls ASRU.pl with appropriate
arguements.

ASRU.pl has the code that does the necessary actions to reclaim the allocated
but unused space. It calls the zerofill script with appropriate arguements
appended.

zerofill script takes the power, name of the disks and ranges to be zeroed as
arguements. It writes zeroes using the 'dd' command. This script can be
customized.


But I cannot run asru (not asru.pl), as it gives me this error:

Can't exec /bin/sh at asru line 1.

that's why I ignored it, and started by running ASRU.pl not ASRU.
I think if I can solve this problem, it will solve zerofill problem as well, as both of them have same problem which is not executing in windows command prompt.
What do you think?

Regards.


BillKSmith
Veteran

Nov 28, 2013, 7:11 AM

Post #12 of 32 (2842 views)
Re: [NiaCo] ASM Reclamation Utility (ASRU) [In reply to] Can't Post

I am not sure that this is relavent, but worth checking.

I am using Activestate 5.16.1 under windows XP home. A small experimet shows that perl's -x reports .pl files as "not executable" evn if they are associsated with perl.
Good Luck,
Bill


FishMonger
Veteran / Moderator

Nov 28, 2013, 7:20 AM

Post #13 of 32 (2841 views)
Re: [NiaCo] ASM Reclamation Utility (ASRU) [In reply to] Can't Post

All of those scripts are written for and expected to be run on a *nix system. If you want to run them on Windows, you'll need to make the appropriate changes to the scripts. I need to start prepping for thanksgiving dinner, so I can't spend any time today showing or explaining or teaching you Perl.


NiaCo
Novice

Nov 29, 2013, 12:23 PM

Post #14 of 32 (2759 views)
Re: [BillKSmith] ASM Reclamation Utility (ASRU) [In reply to] Can't Post

Dear BillKSmith,

Thanks for your reply,
You are totally right. This is exactly what I've beleived from the beginning but I need to know how to change it in windows. This is my question.
Don't ask me to change my OS or don't nag at me that why I'm using Windows as the OS here. There are so may other thing which forced me to use windows and I don't want to go through that as it is irrelevent.

Regards.


NiaCo
Novice

Nov 29, 2013, 12:34 PM

Post #15 of 32 (2756 views)
Re: [FishMonger] ASM Reclamation Utility (ASRU) [In reply to] Can't Post

Dear FishMonger,

Although I might not know Perl that much you know, but I can rationally realize that unlike you, I believe it is because of permission issues not extension or file associations.
The problem is how to change these permission in windows, even when I used Cygwin, and used appropriate commands which are mentioned in previous posts, still they won't be changed while I can change other file's permission!

Happy thanksgiving.


FishMonger
Veteran / Moderator

Nov 29, 2013, 12:53 PM

Post #16 of 32 (2750 views)
Re: [NiaCo] ASM Reclamation Utility (ASRU) [In reply to] Can't Post

Perl scripts are plain text files. They are not executable binary files.

As I said earlier, to execute Perl scripts in windows you need to either create a .pl file type association that point to the perl interpreter (i.e. perl.exe) or you need to execute the perl interpreter (perl.exe) and pass the filename of the script to it as an argument. The other option is to run the scripts under the cygwin environment which uses the shebang line in the script to point to the interpreter.

Did you look over the links I provided that show you how to create the .pl file type association?


FishMonger
Veteran / Moderator

Nov 29, 2013, 12:54 PM

Post #17 of 32 (2748 views)
Re: [NiaCo] ASM Reclamation Utility (ASRU) [In reply to] Can't Post

You use the chmod command to set the file permissions.


NiaCo
Novice

Nov 29, 2013, 1:06 PM

Post #18 of 32 (2747 views)
Re: [FishMonger] ASM Reclamation Utility (ASRU) [In reply to] Can't Post

Hey.

I'll look at the links in which you gave me right now to see what you mean exactly, but before that I want to emphesize one more time that, I do not have any problem by running any .pl file in my windows CMD enviornment at all. I just run any .pl file like this:
"perl AnyPerlFile.pl"
And they all will be executed without any problem, and all .pl files are associated with ActivePerl in my PC.
The "zerfill" does not have any extension.
I don't know whether it is a problem or not.
I just can obviously see that, when the code in "ASRU.pl" wants to check the "zerofill" file permission, it will be seen as a file in which does not have execute permission.
Now I'll double check the links that you posted before.
Thanks.


NiaCo
Novice

Nov 29, 2013, 1:12 PM

Post #19 of 32 (2744 views)
Re: [FishMonger] ASM Reclamation Utility (ASRU) [In reply to] Can't Post

I use this:
chmod ugoa+rwx zerofill
in Cygwin inside my Windows.

And when use this command:
ls -l zerofill

I'll receive this:
-rwx------+ 1 Administrators None 4041 Feb 9 2012 zerofill


FishMonger
Veteran / Moderator

Nov 29, 2013, 1:18 PM

Post #20 of 32 (2742 views)
Re: [NiaCo] ASM Reclamation Utility (ASRU) [In reply to] Can't Post


Quote
and all .pl files are associated with ActivePerl in my PC.

If that were true, then instead of executing the script via:

Quote
perl AnyPerlFile.pl

you would be able to execute the script via:

Quote
AnyPerlFile.pl

but you've already stated that you can't execute it that way. And as I've stated several times the reason that fails is because you don't have .pl files associated with perl.exe

It appears that you're not very familiar with Windows or how Windows determines what files are executable and what files aren't executable.


FishMonger
Veteran / Moderator

Nov 29, 2013, 1:21 PM

Post #21 of 32 (2740 views)
Re: [NiaCo] ASM Reclamation Utility (ASRU) [In reply to] Can't Post


In Reply To
I use this:
chmod ugoa+rwx zerofill
in Cygwin inside my Windows.

And when use this command:
ls -l zerofill

I'll receive this:
-rwx------+ 1 Administrators None 4041 Feb 9 2012 zerofill


Did you try
chmod 777 zerofill


BillKSmith
Veteran

Nov 29, 2013, 1:21 PM

Post #22 of 32 (2740 views)
Re: [NiaCo] ASM Reclamation Utility (ASRU) [In reply to] Can't Post

FishMonger is correct. Your utility is written for Unix. You only have two choices. You either use Unix or rewrite the utility for windows. You have already excluded the former. You may have legal as well as technical problems with the other. It is worth a great deal of effort to find a windows compatible program that will do the job for you.

Ok, you have decided to take on the job yourself. Do not fool yourself into thinking that the current symptom is all that you have to fix. That approach would be much like peeling an onion. You would never be done (or would not know it if you were.) First read all of the document perlport (type: perldoc perlport). Take any advice that FishMonger offers. You have a lot to learn about both operating systems as well as Perl before you have any chance of success.
Good Luck,
Bill


NiaCo
Novice

Nov 29, 2013, 1:38 PM

Post #23 of 32 (2736 views)
Re: [FishMonger] ASM Reclamation Utility (ASRU) [In reply to] Can't Post

Yes, I did. And no change in permission at all.
let's assume I don't know what is Windows and perl at all.
How will you justify this?

Anyway, many thanks for your helps, and I'll try to read more about perl and also I'll take your advice about file association in Windows and will read the links and apply them in my PC and will let you know about the result later on.

Regards.


FishMonger
Veteran / Moderator

Nov 29, 2013, 1:57 PM

Post #24 of 32 (2729 views)
Re: [NiaCo] ASM Reclamation Utility (ASRU) [In reply to] Can't Post

If that chmod command didn't work in the cygwin environment, then it sounds like your cygwin installation is broken.


NiaCo
Novice

Dec 14, 2013, 4:22 AM

Post #25 of 32 (2418 views)
Re: [FishMonger] ASM Reclamation Utility (ASRU) [In reply to] Can't Post

Hi again,

I uninstalled and reinstalled the Cygwin and again tried these and got the following results:

chmod ugoa+rwx zerofill

ls -l zerofill

-rwxrwxrwx 1 Administrator None 4235 Nov 26 05:14 zerofill

then:

chmod 777 zerofill

-rwxrwxrwx 1 Administrator None 4235 Nov 26 05:14 zerofill


Now, I'm pretty sure that, the problem is with permission, but I can not change it in windows, and the real problem is running these codes in windows.
And I have to run them in windows for some reasons.

Can you tell me in general case how should a file's permission be shown to be able to execute or even more to have the full permission for everyone?

And what is the difference between giving permission by numbers and giving by words?(ugoa+rwx & 777)

I'll be so thankful if anyone can help me with this issue, and tell me how to change a linux or unix file's permission in Windows.
Thanks in advance.

Regards.

First page Previous page 1 2 Next page Last page  View All
 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives