Concord/Sqlplus

From s23
Jump to navigation Jump to search

you can use sql to access Concord's database


first use the "sqlplus" command to open the SQL commandline interface

 host# sqlplus user/pass 

you can turn off the table headers (this is usefull if you are scripting)
increase the number of pages / lines in each page.

SQL>SQL> set pages 100 lines 1000 head off
SQL>


you can use the DESCRIBE command to find detales about tables eg:

SQL>  DESCRIBE NH_GROUP;
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 GROUP_ID                                  NOT NULL NUMBER(11)
 GROUP_TYPE                                NOT NULL NUMBER(11)
 MACHINE_ID                                NOT NULL NUMBER(11)
 CREATE_TIME                               NOT NULL NUMBER(11)
 MODIFY_TIME                               NOT NULL NUMBER(11)
 NAME                                      NOT NULL VARCHAR2(64)
 CONTAINER_TYPE                            NOT NULL NUMBER(11)
 EXPIRE_TIME                               NOT NULL NUMBER(11)
SQL> DESCRIBE NH_ELEMENT;
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 ELEMENT_ID                                NOT NULL NUMBER(11)
 MACHINE_ID                                         NUMBER(11)
 NAME                                      NOT NULL VARCHAR2(64)
 NAME_LOWERCASE                            NOT NULL VARCHAR2(64)
 ALIAS                                              VARCHAR2(64)
 ALIAS_LOWERCASE                                    VARCHAR2(64)
 IP_ADDRESS                                         VARCHAR2(21)
 IF_IP_ADDRESS                                      CHAR(15)
 MTF_NAME                                           VARCHAR2(64)
 ELEMENT_TYPE                              NOT NULL NUMBER(11)
 LATENCY_PARTNER                                    VARCHAR2(64)
 LATENCY_SOURCE                                     NUMBER(11)
 INDEX1                                             NUMBER(11)
 INDEX2                                             VARCHAR2(256)
 INDEX3                                             VARCHAR2(256)
 INDEX4                                             VARCHAR2(256)
 SPEED                                              NUMBER(38,7)
 SPEED1                                             NUMBER(38,7)
 DEVICE_SPEED                                       NUMBER(38,7)
 DEVICE_SPEED2                                      NUMBER(38,7)
 RESPONSE_LIMIT                                     NUMBER(11)
 POLL_RATE                                          NUMBER(11)
 POLL_TIMEOUT                                       NUMBER(11)
 POLL_RETRIES                                       NUMBER(11)
 COMMUNITY_STRING                                   VARCHAR2(64)
 READ_COMMUNITY                                     VARCHAR2(64)
 STORE_IN_DB                                        NUMBER(1)
 CISCO_PING                                         NUMBER(1)
 REMOTELY_POLLED                                    NUMBER(1)
 MONITOR_LE                                         NUMBER(1)
 FULL_DUPLEX                                        NUMBER(1)
 INC_IN_LW_RPTS                                     NUMBER(1)
 HOSTNAME                                           VARCHAR2(64)
 SYS_NAME                                           VARCHAR2(64)
 SYS_DESCR                                          VARCHAR2(256)
 DISCOVER_KEY                                       VARCHAR2(128)
 VIRTUAL_ID                                         VARCHAR2(32)
 UNIQUE_DEV_ID                                      VARCHAR2(128)
 NMS_KEY                                            VARCHAR2(128)
 NMS_STATE                                          NUMBER(11)
 IF_PHYS_ADDRESS                                    CHAR(17)
 DEVICE_HASH_KEY                                    VARCHAR2(16)
 ELEM_TIMEZONE                                      VARCHAR2(20)
 APP_TYPE                                           NUMBER(11)
 APP_KEY                                            VARCHAR2(64)
 CLIENT_ACCESS                                      NUMBER(11)
 CAPTION                                            VARCHAR2(64)
 USER_STRING                                        VARCHAR2(256)
 IMPORT_MODULE_NAME                                 VARCHAR2(10)
 IMPORT_NMS_HOST                                    VARCHAR2(64)
 CREATE_TIME                               NOT NULL NUMBER(11)
 MODIFY_TIME                                        NUMBER(11)


you can use the SELECT command to list detale about elements in a table

ie. to list the group names and there id numbers from the NH_GROUP table:

SQL> SELECT NAME,GROUP_ID from NH_GROUP
 groupName1      00001
 groupName2      00002

to list all elements with X ip address

SQL> SELECT NAME from NH_ELEMENT where IP_ADDRESS='x.x.x.x';

NAME
----------------------------------------------------------------
router-001-Serial0/0-dlci-1
router-001-Serial0/0-dlci-2
router-001-RH-Cpu-1
router-001-RH-Serial0/0
router-001-RH-Serial0/1
router-001-RH-Ethernet0/0
router-001-RH-Ethernet0/1
router-001-RH

8 rows selected.


this is a cool link about, [OracleAndPerl]

Back to Concord Index