接続しているセッションを確認

#目的
現在接続しているセッションを確認する。
（オラクルではv$sessionを確認）

#コマンド
| 内容 | コマンド | 実行例 |
|:-:|:-:|:-:|
| cnsterm supervisor screenを起動  | cnsterm 6  |   |
| Query Sessionユーティリティ(qrysessn)の起動  | start qrysessn  |   |
| 結果の確認  | cnsterm 1  |   |
| CNSコンソールの一覧を表示  | cnscim -s  |   |
#実行例
###cnsterm supervisor screenを起動
```
TDExpress1620_Sles11:~ # cnsterm 6
Attempting to connect to CNS...Completed.
Hello

Input Supervisor Command:
>
```

###Query Sessionユーティリティ(qrysessn)の起動
```
> start qrysessn 
start qrysessn

Started 'qrysessn' in window 1
 at Sun Sep 27 12:57:31 2020
```

###結果確認
```
TDExpress1620_Sles11:~ # cnsterm 1
Attempting to connect to CNS...Completed.
Hello
 


There are currently no host utility locks in the DBC

              --ShowLocks Processing Complete--

 

 _______
    |                                |              |
    |    ___     __     ____         |    ____    __|__    ____
    |   /      |/  \    ____|    ____|    ____|     |      ____|
    |   ---    |       /    |   /    |   /    |     |     /    |
    |   \___   |       \____|   \____|   \____|     |__   \____|
 
    Release 16.20.32.23 Version 16.20.32.23
    SESSION STATUS Utility (Dec 94)
 

 Session state Query Utility : 20/09/27  12:57:31 

 Please enter a logical host id (? for help): 

> *
*


 Please enter session ids (? for help):


> *
*


Is detail information needed if the session is involved in HUT/FASTLOAD/MLOAD/EXPORT/Concurrency?
y-yes, n-no
> y
y

QUERYSESSION will run in Workload Def: WD-Default


 Session state query results : 20/09/27  12:59:43 

 Host   Session  PE     DBC User ID
 -----  -------  -----  -------------------------------
     1     1002  30719  DBC

 State details : IDLE 


 ========================================================================

 Host   Session  PE     DBC User ID
 -----  -------  -----  -------------------------------
     1     1003  30719  DBC

 State details : IDLE 


 ========================================================================


 End of session state report
```

###「CNSSUPV start: All Interactive Partitions are busy!!」エラー
CNSコンソールのWindowは最大で4つ
空きが無い場合に発生するエラー

```
> start qrysessn
start qrysessn


CNSSUPV start: All Interactive Partitions are busy!!
 at Tue Apr  6 13:40:50 2021
```

####対応
「cnscim -s」でCNSコンソールの一覧を表示

```
TDExpress1620_Sles11:~ # cnscim -s

CNS Screens

Screen 1  --  qrysessn
   active=True,  enabled fkeys=, help level=0,
   nostop=False,  reading=True, hide=True

Screen 2  --  qrysessn
   active=True,  enabled fkeys=, help level=0,
   nostop=False,  reading=True, hide=True

Screen 3  --  qrysessn
   active=True,  enabled fkeys=, help level=0,
   nostop=False,  reading=True, hide=True

Screen 4  --  qrysessn
   active=True,  enabled fkeys=, help level=0,
   nostop=False,  reading=True, hide=True

Screen 5  --  DBS I/O
   active=True,  enabled fkeys=, help level=0,
   nostop=False,  reading=False, hide=False

Screen 6  --  SUPERVISOR
   active=True,  enabled fkeys=, help level=0,
   nostop=False,  reading=True, hide=False
```
不要なWindow（screen）を停止

#####（１）Windowに接続して停止
````
TDExpress1620_Sles11:~ # cnsterm 1
(中略)

> quit;
quit;


 QrySession has terminated
````

#####（２）Supervisorコマンドで停止
```
TDExpress1620_Sles11:~ # cnsterm 6

Input Supervisor Command:
> stop 2
stop 2


CNSSUPV 'stop': Screen 2 (qrysessn) is stopped!!
 at Tue Apr  6 13:52:46 2021


Input Supervisor Command:
```

####確認
Windowの1と2が空いたことを確認

```
TDExpress1620_Sles11:~ # cnscim -s

CNS Screens

Screen 3  --  qrysessn
   active=True,  enabled fkeys=, help level=0,
   nostop=False,  reading=True, hide=True

Screen 4  --  qrysessn
   active=True,  enabled fkeys=, help level=0,
   nostop=False,  reading=True, hide=True

Screen 5  --  DBS I/O
   active=True,  enabled fkeys=, help level=0,
   nostop=False,  reading=False, hide=False

Screen 6  --  SUPERVISOR
   active=True,  enabled fkeys=, help level=0,
   nostop=False,  reading=True, hide=False
```

#参考
[Query Sessionユーティリティ(qrysessn)概要 • Teradata Vantage™ - データベース ユーティリティ • リーダー • Teradataドキュメント](https://docs.teradata.com/reader/gjXRKe910A9hOE8O2C3Ufw/b50eDgcR4yGQgcvmB72AwQ)
[PDEツール - Qiita](https://qiita.com/bickel/items/1f4fcb472aaeb0b249cb)
[]()