kingbase8 v8r6 命令行操作指令汇总

General

  \crosstabview [COLUMNS]         execute query and display results in crosstab
  \errverbose                                    show most recent error message at maximum verbosity
  \g [FILE] or ;                            execute query (and send results to file or |pipe)
  \gdesc                                 describe result of query, without executing it
  \gexec                                 execute query, then execute each value in its result
  \gset [PREFIX]                         execute query and store results in ksql variables
  \gx [FILE]                             as \g, but forces expanded outPut mode
  \q                                     quit ksql
  \watch [SEC]                           execute query every SEC seconds

Help

  \? [commands]          show help on backslash commands
  \? options             show help on ksql command-line options
  \? variables           show help on special variables
  \h [NAME]              help on syntax of SQL commands, * for all commands

Query Buffer

  \e [FILE] [LINE]                       edit the query buffer (or file) with external editor
  \ef [FUNCNAME [LINE]]          edit function definition with external editor
  \ev [VIEWNAME [LINE]]          edit view definition with external editor
  \p                     show the contents of the query buffer
  \r                     reset (clear) the query buffer
  \s [FILE]              display history or save it to file
  \w FILE                write query buffer to file

Input/Output

  \copy ...              perform SQL COPY with data stream to the client host
  \echo [STRING]         write string to standard outPut
  \i FILE                execute commands from file
  \ir FILE               as \i, but relative to location of current script
  \o [FILE]              send all query results to file or |pipe
  \qecho [STRING]        write string to query outPut stream (see \o)

Conditional

  \if EXPR               begin conditional block
  \elif EXPR             alternative within current conditional block
  \else                  final alternative within current conditional block
  \endif                 end conditional block

Informational


  (options: S = show system objects, + = additional detail)
  \d[S+]                 list tables, views, and sequences
  \d[S+]  NAME           describe table, view, sequence, or index
  \da[S]  [PATTERN]      list aggregates
  \dA[+]  [PATTERN]      list access methods
  \db[+]  [PATTERN]      list tablespaces
  \dc[S+] [PATTERN]      list conversions
  \dC[+]  [PATTERN]      list casts
  \dd[S]  [PATTERN]      show object descriptions not displayed elsewhere
  \dD[S+] [PATTERN]      list domains
  \ddp    [PATTERN]      list default privileges
  \dE[S+] [PATTERN]      list foreign tables
  \det[+] [PATTERN]      list foreign tables
  \des[+] [PATTERN]      list foreign servers
  \deu[+] [PATTERN]      list user mappings
  \dew[+] [PATTERN]      list foreign-data wrappers
  \df[anptw][S+] [PATRN] list [only agg/normal/procedures/trigger/window] functions
  \dF[+]  [PATTERN]      list text search configurations
  \dFd[+] [PATTERN]      list text search dictionaries
  \dFp[+] [PATTERN]      list text search parsers
  \dFt[+] [PATTERN]      list text search templates
  \dg[S+] [PATTERN]      list roles
  \di[S+] [PATTERN]      list indexes
  \dl                    list large objects, same as \lo_list
  \dL[S+] [PATTERN]      list procedural languages
  \dm[S+] [PATTERN]      list materialized views
  \dn[S+] [PATTERN]      list schemas
  \do[S]  [PATTERN]      list operators
  \dO[S+] [PATTERN]      list collations
  \dp     [PATTERN]      list table, view, and sequence access privileges
  \dpkg[S+] [PATTERN]    list packages
  \dP[itn+] [PATTERN]    list [only index/table] partitioned relations [n=nested]
  \drds [PATRN1 [PATRN2]] list per-database role settings
  \dRp[+] [PATTERN]      list replication publications
  \dRs[+] [PATTERN]      list replication subscriptions
  \ds[S+] [PATTERN]      list sequences
  \dt[S+] [PATTERN]      list tables
  \dT[S+] [PATTERN]      list data types
  \du[S+] [PATTERN]      list roles
  \dv[S+] [PATTERN]      list views
  \dx[+]  [PATTERN]      list extensions
  \dy     [PATTERN]      list event triggers
  \l[+]   [PATTERN]      list databases
  \sf[+]  FUNCNAME       show a function's definition
  \sv[+]  VIEWNAME       show a view's definition
  \z      [PATTERN]      same as \dp
 

Formatting

  \a                     toggle between unaligned and aligned outPut mode
  \C [STRING]            set table title, or unset if none
  \f [STRING]            show or set field separator for unaligned query outPut
  \H                     toggle HTML outPut mode (currently off)
  \pset [NAME [VALUE]]   set table outPut option
                         (border|columns|csv_fieldsep|expanded|fieldsep|
                         fieldsep_zero|footer|format|linestyle|null|
                         numericlocale|pager|pager_min_lines|recordsep|
                         recordsep_zero|tableattr|title|tuples_only|
                         unicode_border_linestyle|unicode_column_linestyle|
                         unicode_header_linestyle)
  \t [on|off]            show only rows (currently off)
  \T [STRING]            set HTML <table> tag attributes, or unset if none
  \x [on|off|auto]       toggle expanded outPut (currently off)

Connection

  \c[onnect] {[DBNAME|- USER|- HOST|- PORT|-] | conninfo}
                         connect to new database (currently "gdsqjz")
  \conninfo              display information about current connection
  \encoding [ENCODING]   show or set client encoding
  \password [USERNAME]   securely change the password for a user

Operating System

  \cd [DIR]              change the current working directory
  \setenv NAME [VALUE]   set or unset environment variable
  \timing [on|off]       toggle timing of commands (currently off)
  \! [COMMAND]           execute command in shell or start interactive shell

Variables
 

\prompt [TEXT] NAME    prompt user to set internal variable
  \set [NAME [VALUE]]    set internal variable, or list all if no parameters
  \unset NAME            unset (delete) internal variable

Large Objects

  \lo_export LOBOID FILE
  \lo_import FILE [COMMENT]
  \lo_list
  \lo_unlink LOBOID      large object operations
 

### KingbaseES v8R6 物理备份操作指南 #### 初始化配置 为了确保物理备份顺利进行,需先完成必要的初始化配置。这通常涉及设置备份环境变量以及确认目标数据库实例处于正常运行状态[^1]。 #### 使用 `sys_rman` 工具进行备份 对于KingbaseES v8R6而言,官方推荐采用内置的`sys_rman`工具来实现高效稳定的物理备份功能。该工具支持全量与增量两种模式: - **全量备份**:可以利用如下命令创建完整的数据副本: ```bash sys_rman target / backup full format='/path/to/backup/%U' ``` - **增量备份**:如果仅希望保存自上次成功备份以来发生变化的数据,则可通过指定`incremental level`参数来进行增量备份: ```bash sys_rman target / backup incremental level=1 format='/path/to/incremental_backup/%U' ``` 上述命令中的路径应替换为实际存储位置,并确保有足够的空间容纳备份文件。 #### 备份集管理 每次执行备份操作后都会生成相应的备份集,这些集合包含了用于后续恢复所需的所有元数据信息。可以通过`list backup`查看现有备份情况;而当不再需要某些旧版备份时,也可以借助`delete expired backup`清理过期条目以释放资源。 #### 还原与恢复流程 一旦发生意外丢失或损坏事件,在准备好的备份基础上实施快速有效的还原至关重要。具体步骤包括但不限于停止当前正在工作的实例、定位至最近一次成功的备份点并加载其内容回到原始介质上。注意在此过程中务必遵循产品文档给出的操作指引以免造成二次损害。 ```sql -- 停止数据库服务前请确保已完成所有事务处理 sudo systemctl stop kingbase.service; -- 执行还原命令(假设已切换到正确的目录) sys_rman target / restore db; ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值