【手摸手玩轉 OceanBase 159】如何檢視歸檔引數?

13579NB232發表於2023-01-19

完成  LOG_ARCHIVE_DEST 歸檔引數的配置後,您可以透過檢視檢視引數配置。

系統租戶檢視所有租戶的歸檔引數

CDB 檢視是叢集檢視,可以檢視叢集所有租戶的歸檔引數,您需要登入  sys 租戶才可以檢視。 sys 租戶可以透過  oceanbase.CDB_OB_ARCHIVE_DEST 檢視檢視叢集中所有租戶的歸檔引數配置資訊。

  1. 使用  root 使用者登入資料庫的  sys 租戶。

  2. 執行以下語句,檢視所有租戶的  LOG_ARCHIVE_DEST 配置引數。

    obclient> SELECT * FROM oceanbase.CDB_OB_ARCHIVE_DEST;
    +-----------+---------+-----------------------+-------------------------------------------------------------------------------------------------------------------------+
    | TENANT_ID | DEST_NO | NAME                  | VALUE                                                                                                                   |
    +-----------+---------+-----------------------+-------------------------------------------------------------------------------------------------------------------------+
    |      1002 |       0 | binding               | OPTIONAL                                                                                                                |
    |      1002 |       0 | checkpoint_interval   | 1d                                                                                                                      |
    |      1002 |       0 | dest_id               | 2                                                                                                                       |
    |      1002 |       0 | path                  | file:///data/nfs/backuparchive                                                                                          |                
    |      1002 |       0 | piece_switch_interval | 1d                                                                                                                      |
    |      1002 |       0 | state                 | ENBALE                                                                                                                  |
    |      1004 |       0 | binding               | Mandatory                                                                                                               |
    |      1004 |       0 | checkpoint_interval   | 2m                                                                                                                      |
    |      1004 |       0 | dest_id               | 1                                                                                                                       |
    |      1004 |       0 | path                  | oss://oceanbase-test-bucket/backup/archive?host=xxx.aliyun-inc.com&access_id=xxx&access_key=xxx&delete_mode=tagging     |
    |      1004 |       0 | piece_switch_interval | 1d                                                                                                                      |
    |      1004 |       0 | state                 | ENBALE                                                                                                                  |
    +-----------+---------+-----------------------+-------------------------------------------------------------------------------------------------------------------------+
    12 rows in set

    上面的示例中, 當前叢集中有租戶 ID 為  1002 和  1004 的 2 個租戶配置了  LOG_ARCHIVE_DEST 引數。

    1002 租戶  LOG_ARCHIVE_DEST 引數配置的命令如下:

    obclient> ALTER SYSTEM SET LOG_ARCHIVE_DEST = 'LOCATION=file:///data/nfs/backup/archive BINDING=Optional CHECKPOINT_INTERVAL=2m PIECE_SWITCH_INTERVAL=1d';

    系統為該路徑分配的  dest_id 是  2,並且該路徑的歸檔已經開啟。

    1004 租戶  LOG_ARCHIVE_DEST 引數配置的命令如下:

    obclient> ALTER SYSTEM SET LOG_ARCHIVE_DEST = 'LOCATION=oss://oceanbase-test-bucket/backup/archive?host=xxx.aliyun-inc.com&access_id=xxx&access_key=xxx&delete_mode=tagging BINDING=Mandatory CHECKPOINT_INTERVAL=2m PIECE_SWITCH_INTERVAL=1d';

    系統為該路徑分配的  dest_id 是  1,且該路徑的歸檔也已經開啟。

更多  CDB_OB_ARCHIVE_DEST 檢視的說明,請參見  CDB_OB_ARCHIVE_DEST

使用者租戶檢視本租戶的歸檔引數

使用者租戶可以透過  oceanbase.DBA_OB_ARCHIVE_DEST 檢視(MySQL 模式)和  sys.DBA_OB_ARCHIVE_DEST 檢視(Oracle 模式)檢視本租戶的歸檔引數。

  1. 使用者租戶的租戶管理員登入到對應的租戶。

    說明

    MySQL 租戶的管理員使用者為  root 使用者,Oracle 租戶的管理員使用者為  SYS 使用者。

  2. 執行以下語句,檢視當前租戶的  LOG_ARCHIVE_DEST 配置引數。

    MySQL 租戶檢視本租戶的 LOG_ARCHIVE_DEST 引數的示例如下:

    obclient> SELECT * FROM oceanbase.DBA_OB_ARCHIVE_DEST;
    +---------+-----------------------+---------------------------------+
    | DEST_NO | NAME                  | VALUE                           |
    +---------+-----------------------+---------------------------------+
    |       0 | binding               | OPTIONAL                        |
    |       0 | checkpoint_interval   | 1d                              |
    |       0 | dest_id               | 2                               |
    |       0 | path                  | file:///data/nfs/backup/archive |
    |       0 | piece_switch_interval | 1d                              |
    |       0 | state                 | ENBALE                          |
    +---------+-----------------------+---------------------------------+
    6 rows in set

相關閱讀

歸檔引數的設定,請參見  準備工作 。


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/70026124/viewspace-2932873/,如需轉載,請註明出處,否則將追究法律責任。

相關文章