达梦数据库,不同模式迁移(指令篇)
执行命令:
/opt/dmdbms/bin/disql
登陆帐号;
用户名: SYSDBA
密码: SYSDBA
执行命令(下方表空间名称替换为地市名称):
create tablespace "表空间名称" datafile '/dmdbms/data/DAMENG/表空间名称.DBF' size 169 CACHE = NORMAL;
例子: create tablespace "test" datafile '/dmdbms/data/DAMENG/test.DBF' size 169 CACHE = NORMAL;
执行命令(下方)
create user "用户名称" identified by "用户密码"
limit failed_login_attemps 3, password_lock_time 1, password_grace_time 10
default tablespace "所属表空间"
default index tablespace "所属表空间";
例子:
create user "test" identified by "test123456"
limit failed_login_attemps 3, password_lock_time 1, password_grace_time 10
default tablespace "test"
default index tablespace "test";
执行命令:
grant "DBA","PUBLIC","RESOURCE" to "用户名称";
例子:
grant "DBA","PUBLIC","RESOURCE" to "test";
退出sql指令
exit;
将BASE.dmp放到目标文件夹下;
执行导入命令
(更改remap_schema=BASE:目标模式名称(创建的用户名称)
更改LOG的命名 => BASE_年_月_日_目标模式名称.log
):
/opt/dmdbms/bin/dimp SYSDBA/SYSDBA DIRECTORY=/dmdbms/data/DAMENG/bak/ FILE=BASE.dmp remap_schema=BASE:目标模式 IGNORE=Y COMPILE=Y INDEXFIRST=N COMMIT_ROWS=5000 FAST_LOAD=N LOG=BASE_年_月_日_目标模式名称.log LOG_WRITE=N
例子:
/opt/dmdbms/bin/dimp SYSDBA/SYSDBA DIRECTORY=/dmdbms/data/DAMENG/bak/ FILE=BASE.dmp remap_schema=BASE:TEST IGNORE=Y COMPILE=Y INDEXFIRST=N COMMIT_ROWS=5000 FAST_LOAD=N LOG=BASE_2021_10_14_test.log LOG_WRITE=N