MACHSQL is a tool to dynamically execute SQL queries against Machbase server in the console, and it also allows you to check the results on the screenMACHSQL은 SQL질의를 수행하는 대화형 도구이다.
Options and Features
Code Block |
---|
[mach@localhost]$ machsql -h |
...
Short option | Long option | Description |
---|---|---|
-s | --serverIt specifies the IP address of the server where machbased is running. (e.g. localhost) | 접속할 서버의 ip |
-u | --user | It specifies the user ID to login machbased. 사용자명 (e.g. SYS) |
-p | --password | It specifies the user's password to login machbased. (e.g. 패스워드 (e.g. MANAGER) |
-P | --portIt specifies the port number to access machbased. The default value is 5656, and it is set in machbase.conf file. | 서버의 포트 번호 |
-n | --nls | It specifies the NLS.NLS설정 |
-f | --scriptIt | designates the external file name to execute.실행할 sql 스크립트 파일 |
-o | --output | It specifies the external file name to store the execution results. It is stored as a tab delimiter 질의 결과를 저장할 파일. 결과파일은 tab을 구분자로 생성된다. |
-i | --silentIt doesn't display copyright statements. | 저작권 관련 출력 내용 제거하고 실행함 |
-v | --verbose | Run in Verbose mode. |
-t | --testing | Run in Testing mode. ←삭제 |
-r--format | --format | 출력 파일 포멧(csv등)을 지정함 It specifies teh format of the file to be output. (e.g. csv)) ←영문 메뉴얼 수정 teh→the |
-h | --helpDisplay help message. | 옵션 출력 |
Example:
Code Block |
---|
machsql -s localhost -u sys -p manager machsql --server=localhost --user=sys --password=manager machsql -s localhost -u sys -p manager -f script.sql |
SHOW Commands
The commands display information about index, tablespace, and other servers테이블, 테이블스페이스, 인덱스 등의 정보를 출력한다.
List of show options
- SHOW INDEX
- SHOW INDEXES
- SHOW INDEXGAP
- SHOW LSM
- SHOW LICENSE
- SHOW STATEMENTS
- SHOW TABLE
- SHOW TABLES
- SHOW TABLESPACE
- SHOW TABLESPACES
- SHOW USERS
SHOW INDEX
It displays the detailed information about a specified index.인덱스 정보를 출력함
Syntax:
Code Block |
---|
SHOW INDEX index_name |
...
Code Block |
---|
Mach> CREATE TABLE t1 (c1 INTEGER, c2 VARCHAR(10)); Created successfully. Mach> CREATE VOLATILE TABLE t2 (c1 INTEGER, c2 VARCHAR(10)); Created successfully. Mach> CREATE INDEX t1_idx1 ON t1(c1) INDEX_TYPE LSM; Created successfully. Mach> CREATE INDEX t1_idx2 ON t1(c1) INDEX_TYPE BITMAP; Created successfully. Mach> CREATE INDEX t2_idx1 ON t2(c1) INDEX_TYPE REDBLACK; Created successfully. Mach> CREATE INDEX t2_idx2 ON t2(c2) INDEX_TYPE REDBLACK; Created successfully. Mach> SHOW INDEX t1_idx2; TABLE_NAME COLUMN_NAME INDEX_NAME ---------------------------------------------------------------------------------------------------------------------------------- INDEX_TYPE BLOOM_FILTER KEY_COMPRESS MAX_LEVEL PART_VALUE_COUNT BITMAP_ENCODE -------------------------------------------------------------------------------------------- T1 C1 T1_IDX2 LSM ENABLE COMPRESSED 2 100000 EQUAL [1] row(s) selected. Elapsed time: 0.001 |
SHOW INDEXES
It displays the list of all indexes.인덱스 전체 리스트를 출력함
Syntax:
Code Block |
---|
SHOW INDEXES |
...
Code Block |
---|
Mach> CREATE TABLE t1 (c1 INTEGER, c2 VARCHAR(10)); Created successfully. Mach> CREATE VOLATILE TABLE t2 (c1 INTEGER, c2 VARCHAR(10)); Created successfully. Mach> CREATE INDEX t1_idx1 ON t1(c1) INDEX_TYPE LSM; Created successfully. Mach> CREATE INDEX t1_idx2 ON t1(c1) INDEX_TYPE BITMAP; Created successfully. Mach> CREATE INDEX t2_idx1 ON t2(c1) INDEX_TYPE REDBLACK; Created successfully. Mach> CREATE INDEX t2_idx2 ON t2(c2) INDEX_TYPE REDBLACK; Created successfully. Mach> SHOW INDEXES; TABLE_NAME COLUMN_NAME INDEX_NAME ---------------------------------------------------------------------------------------------------------------------------------- INDEX_TYPE --------------- T1 C1 T1_IDX1 LSM T1 C1 T1_IDX2 LSM T2 C2 T2_IDX2 REDBLACK T2 C1 T2_IDX1 REDBLACK [4] row(s) selected. Elapsed time: 0.001 |
SHOW INDEXGAP
It displays information about index gap.Index gap정보를 출력함
Example:
Code Block |
---|
Mach> SHOW INDEXGAP TABLE_NAME INDEX_NAME GAP ------------------------------------------------------------------------------------------------------------- INDEX_TABLE T1_IDX1 0 INDEX_TABLE T1_IDX2 0 |
SHOW LSM
It displays information about LSM index .정보를 출력함
Example:
Code Block |
---|
Mach> SHOW LSM; TABLE_NAME INDEX_NAME LEVEL COUNT -------------------------------------------------------------------------------------------------------------------------- T1 IDX1 0 0 T1 IDX1 1 100000 T1 IDX1 2 0 T1 IDX1 3 0 T1 IDX2 0 100000 T1 IDX2 1 0 [6] row(s) selected. |
SHOW LICENSE
It displays the license information.라이센스 정보의 출력
Example:
Code Block |
---|
Mach> SHOW LICENSE INSTALL_DATE ISSUE_DATE EXPIRY_DATE TYPE POLICY --------------------------------------------------------------------------------------- 2016-07-01 10:24:37 20160325 20170325 2 0 [1] row(s) selected. |
SHOW STATEMENTS
It displays SQL statements used in all sessions.서버에 등록(Prepare, Execute, Fetch)된 모든 질의문 출력
Example:
Code Block |
---|
Mach> SHOW STATEMENTS USER_ID SESSION_ID QUERY -------------------------------------------------------------------------------------------------------------- 0 2 SELECT ID USER_ID, SESS_ID SESSION_ID, QUERY FROM V$STMT [1] row(s) selected. |
SHOW TABLE
It displays information about table info.테이블에 대한 정보 출력
Syntax:
Code Block |
---|
SHOW TABLE table_name |
...
Code Block |
---|
Mach> CREATE TABLE t1 (c1 INTEGER, c2 VARCHAR(10)); Created successfully. Mach> CREATE INDEX t1_idx1 ON t1(c1) INDEX_TYPE LSM; Created successfully. Mach> CREATE INDEX t1_idx2 ON t1(c1) INDEX_TYPE BITMAP; Created successfully. Mach> SHOW TABLE T1 [ COLUMN ] ---------------------------------------------------------------- NAME TYPE LENGTH ---------------------------------------------------------------- C1 integer 11 C2 varchar 10 [ INDEX ] ---------------------------------------------------------------- NAME TYPE COLUMN ---------------------------------------------------------------- T1_IDX1 LSM C1 T1_IDX2 LSM C1 |
SHOW TABLES
It displays lists of a table.테이블 리스트 출력
Example:
Code Block |
---|
Mach> SHOW TABLES NAME -------------------------------------------- BONUS DEPT EMP SALGRADE [4] row(s) selected. |
SHOW TABLESPACE
It displays information about tablespace.테이블 스페이스 정보 출력
Example:
Code Block |
---|
Mach> CREATE TABLE t1 (id integer); Created successfully. Elapsed time: 0.071 Mach> CREATE INDEX t1_idx_id ON t1(id); Created successfully. Elapsed time: 0.081 Mach> SHOW TABLESPACE SYSTEM_TABLESPACE; [TABLE] NAME TYPE ------------------------------------------------------- T1 LOG [1] row(s) selected. Elapsed time: 0.001 [INDEX] TABLE_NAME COLUMN_NAME INDEX_NAME ---------------------------------------------------------------------------------------------------------------------------------- T1 ID T1_IDX_ID [1] row(s) selected. Elapsed time: 0.000 |
SHOW TABLESPACES
It displays information about tablespaces.테이블스페이스 목록 출력
Example:
Code Block |
---|
Mach> CREATE TABLESPACE tbs1 DATADISK disk1 (DISK_PATH="tbs1_disk1"), disk2 (DISK_PATH="tbs1_disk2"), disk3 (DISK_PATH="tbs1_disk3"); Created successfully. Mach> Insert some records... ... ... Mach> SHOW TABLESPACES; NAME DISK_COUNT USAGE ----------------------------------------------------------------------------------------------------------------------- SYSTEM_TABLESPACE 1 0 TBS1 3 25824256 [2] row(s) selected. |
SHOW USERS
It displays names of registered users.사용자리스트 출력
Example:
Code Block |
---|
Mach> CREATE USER testuser IDENTIFIED BY 'test1234'; Created successfully. Mach> SHOW USERS; USER_NAME -------------------------------------------- SYS TESTUSER [2] row(s) selected. |
...