Skip to content

MDATA命令使用手册

MDATA的命令可以通过-help获取,参考如下:

MDATA>help

help ---- get command list
exit ---- exit from minidul
desc ---- display table structure
unload ---- unload data
unload table ---- unload data
unload table all
unload user
list ---- list schema object,partition,datafile
list users
list

<user_name>

命令介绍:
1.reload dict
重新加载数据字典,该作用为测试时候新建完对象使得数据库checkpoint一次后执行,主要是同步数据库数据字典,使用如下:

MDATA>reload dict
Start reload dict,Thu Aug 14 22:39:19 CST 2014
SQLException: State:   X0X95Severity: 30000
Operation 'TRUNCATE TABLE' cannot be performed on object 'IDUL_OBJ' because there is an open ResultSet dependent on that object.
load BOOTSTRAP$ success!
load TAB$ success!
load COL$ success!
load OBJ$ success!
load USER$ success!
load PROPS$ success!
load TABPART$ success!
load TABSUBPART$ success!
End reload dict,Thu Aug 14 22:39:26 CST 2014,reload success!

2.list命令
list命令可以列出当前数据库的用户,表等,使用如下:

MDATA>list table luda
OWNER                         TABLE
---------------               --------------
LUDA                          LUDA
LUDA                          LUDA
LUDA                          LUDA
LUDA                          LUDA
MDATA>list index scott
OWNER                         INDEX
---------------               --------------
SCOTT                         PK_DEPT
SCOTT                         PK_EMP
SCOTT                         PK_DEPT
SCOTT                         PK_EMP
MDATA>list users
USER#                         USER_NAME
---------------               --------------
43                            XDBWEBSERVICES
44                            ORDSYS
45                            ORDPLUGINS
46                            SI_INFORMTN_SCHEMA
47                            MDSYS
48                            OLAPI_TRACE_USER
50                            OLAP_DBA
......

3.desc 命令
该命令与sqlplus下的desc命令完全一致,列出表结构使用如下:

MDATA>desc luda.luda
Name                          Null?               Type
ID                                                NUMBER
NAME                                              NVARCHAR2(100)

4.unload命令
默认情况下unload是不会删除delete的数据的,要恢复delete的数据需要在unloadl table/unload user username 后面加上contain delete data(1.8版本更新)
unload命令为恢复导出数据使用,可以针对以某张表,也可以针对某个用户下的所有对象(用户级别的恢复),使用如下:

MDATA>unload user luda
unload user:LUDA
file_id:4,segment_id:51879
file_id:4,segment_id:51880
file_id:4,segment_id:51878
MDATA>unload table luda.luda
schema:LUDA;tab:LUDA
file_id:4,segment_id:51879
file_id:4,segment_id:51880
file_id:4,segment_id:51878
MDATA>

恢复出来的数据会存放在程序根目录的data文件夹中,恢复使用sqlload工具,此恢复参考http://www.ludatou.com/?p=1531

还有一篇场景恢复,目前MDATA支持delete,truncate的恢复,暂不支持drop的恢复,drop的恢复会在fk(扫描数据文件)功能开发完成后分享出来。