• No se han encontrado resultados

You will learn later in the article that you can issue complex queries in CellCLI. Some of these queries might span multiple lines. Since there is no command terminator like “;” in SQL, ending a line makes CellCLI to start

interpreting it immediately. To make sure CellCLI understands the line extends beyond the current line, you can use the continuation character “-“, just as you would have done in SQL*Plus.

CellCLI> spool

-> mycellcli.txt

Note the continuation prompt “>” above. However, unlike SQL*Plus, CellCLI does not show line numbers for the continued lines.

Scripting

When you want to execute a standard command in CellCLI, you can create a script file with the commands and execute it using STARTor @ commands. For instance, to execute a script called listdisks.cli, you would issue one of the following:

CellCLI> @listdisks.cli CellCLI> start listdisks.cli

Note that the there is no restriction on the extension. I used cli merely as a convenience, it could have been anything else.

You can also use the routine Linux redirection command. Here is an example where you put all the commands in the file mycellci.commands and you want to spool the results to mycellci.out. This is good for automatic monitoring systems.

# cellcli <mycellci.commands >mycellci.out

Comments

You can put comments in scripts as well. Comments start with REM, REMARK or "--", as shown below:

REM This is a comment

REMARK This is another comment -- This is yet another comment list physicaldisk

Environment

You can define two environmental settings

• dateformat – to show the format of the date when it is displayed.

CellCLI> set dateformat local

Date format was set: Apr 1, 2011 3:35:17 PM.

CellCLI> set dateformat standard

Date format was set: 2011-04-01T15:35:30-04:00.

• echo – to toggle the display of commands within scripts.

CellCLI> set echo on CellCLI> set echo off

I am sure you can find resemblance of the control commands with SQL*Plus, a tool you are undoubtedly familiar with. The learning curve should not be tat difficult. Now that you know about the basic commands, let’s dive down to more advanced ones.

General Structure

The CellCLI commands have the following general structure:

<Verb> <Object> <Modifier> <Filter>

• A verb is what you want or the action, e.g. display something.

• An object is what you want the action on, e.g. a disk.

• A modifier (optional) shows how you want to operation to be modified, e.g. all disks, or a specific disk, etc.

• A filter (optional) is similar to the WHERE predicate of a SQL statement, used with WHERE clause.

There are only a few primary verbs you will use mostly and need to remember. They are:

• LIST – to show something, e.g. disks, statistics, Resource Manager Plans, etc.

• CREATE – to create something, e.g. a cell disk, a threshold

• ALTER – to change something that has been established, e.g. change the size of a disk

• DROP – to delete something, e.g. a dropping a disk

• DESCRIBE – to display the various attributes of an object

There are more verbs but these five are the most common ones among the CellCLI commands.

Let’s see how they are used in common operations. In the following sections you will learn how to perform the management operations – View, Creation, Deletion and Modification – of various components of the storage, e.g.

Physical Disks, Grid Disks, LUN, etc.

Physical Disk Operations

Storage cell is all about disks. As you learned in first two installments, each storage cell has 12 physical disks. To display the physical disks in this particular cell, you execute the following command:

CellCLI> list physicaldisk

You can notice that there is no heading above the output, making it difficult to understand what these values mean. Fortunately we can fix that as we will see later. For now let’s focus on something else: To know more detail about each disk, you can use the detailmodifier. It will show details on each disk. Here is a partial output:

CellCLI> list physicaldisk detail

The output shows the details of every disk, making it somewhat unreadable. Many times when you encounter issues with specific disks you may want to find the details of a particular disk. For that, use the name of the disk as another modifier. The name is shown in both types of commands, normal and detail.

CellCLI> list physicaldisk 34:0

CellCLI> list physicaldisk 34:0 detail

Attributes

While the above command is useful for reading, it lacks a few things.

• You still don’t get a lot of other details. For instance the RPM of the disk is not shown.

• The results are not in a tabular format, if you want to see more than one disk.

To get these details you can specify named “attributes” in the listing. You can specify these attributes after the modifier attribute. In this example, we have type of the disk (hard disk, or flash disk), model, RPM, Port, and status:

CellCLI> list physicaldisk attributes name, disktype, makemodel, physicalrpm, physicalport, status This is a much better output that shows the details against each disk. This type of output is quite useful in scripts where you may want to pull the details and format them in certain pre-specified manner or parse them for further processing.

Describe

While you may appreciate the above output where using attributes specifically increased the readability of the output, you may also wonder what the valid names of these attributes are. The attribute names vary with the object as well. (For example, diskType is relevant in case of disks only, not in cells.)

Do you need to remember all of them and the context in which they are relevant? Not at all. That’s where a different verb DESCRIBE comes handy; it shows the attributes of an object, similar to what the describe command in SQL*Plus command does for a table to display the columns. Here is how you display the attributes of the physicaldisk object. Remember, unlike SQL*Plus, the command isdescribe; it cannot be shortened to desc.

physicalRPM

What if you want to display all the attributes of the physical disks; not just a few? You can list all the attribute names explicitly; or – as an easier way – you can just use the option all, as shown below.

CellCLI> list physicaldisk attributes all

This output may not be very useful for reading but if you want to write a script to parse these details and take corrective action, it becomes extremely useful. However, in many cases you may want to see only a certain attributes; not all. In the previous subsection you saw how to select only a few of these attributes.