达梦数据库日期格式化_达梦数据库更换磁盘路径、空间不足问题处理

2022-03-30 00:00:00 数据库 专区 订阅 备份 恢复

注意事项:

1. 所有操作,涉及到的目录,请确保 dmdba 均有权限

2. 备份命令详细语法,可以参考 help 等

3. 恢复完后,注意不要启动错了,请启动恢复后的数据库实例(即新的数据库实例)

[dmdba@localhost ~]# ps -ef|grep dmserver

dmdba 1605 1485 8 03:30 pts/0 00:00:04 ./dmserver /opt/dmdata/DAMENG/dm.ini

dmdba 1713 1662 0 03:31 pts/1 00:00:00 grep –color=auto dmserver

[dmdba @localhost ~]#

— 停掉数据库服务

— 进行脱机备份

[dmdba@localhost ~]# cd /opt/dmdbms/bin

[dmdba@localhost bin]# ./dmbackup help

Format: ./dmbackup KEYWORD=value

Example: ./dmbackup INI_PATH=/opt/dm7data/dameng/dm.ini NAME=test.bak

Imperative Argument: INI_PATH NAME

Keyword explain(default value)

——————————————————————————–

INI_PATH the path of dmserver’s dm.ini file

BASE_BAK_DIR the path with increment backup Format (dir1,dir2,dir3,…)

NAME backup name

TYPE backup type (FULL, INCREMENT), Default(FULL)

BAKFILE_PATH the file path of backup file

DESCRIBE the description of backup

MAXSIZE the max value capability of the single backup file Default(33MB~2048MB, default(2048))

ENCRYPT encrypt type (0, 1, 2), Default(0)

PASSWORD encrypt key

ENCRYPT_NAME encrypt algorithm name

COMPRESS compress level(0-9), 0:no compress, 9:high compress, Default(1)

PARALLEL parallel mapping the file path

SHOW_BAK_INFO the directory of backup Format (dir1,dir2,dir3,…)

HELP output help info

[dmdba@localhost bin]# ./dmbackup ini_path=/opt/dmdata/DAMENG/dm.ini name=test.bak

backup V7.6.0.138-Build(2019.02.20-103049)ENT

file dm.key not found, use default license!

ndct db load finished

start backup tablespace: SYSTEM.

start backup file: /opt/dmdata/DAMENG/SYSTEM.DBF, pages: 2688

end backup file: /opt/dmdata/DAMENG/SYSTEM.DBF

end backup tablespace: SYSTEM.

start backup tablespace: ROLL.

start backup file: /opt/dmdata/DAMENG/ROLL.DBF, pages: 0

end backup file: /opt/dmdata/DAMENG/ROLL.DBF

end backup tablespace: ROLL.

start backup tablespace: MAIN.

start backup file: /opt/dmdata/DAMENG/MAIN.DBF, pages: 0

end backup file: /opt/dmdata/DAMENG/MAIN.DBF

end backup tablespace: MAIN.

backup fun end time used: 1064.291(ms)

backup successfully!

backup time used: 7244.440(ms)

— 在新路径下初始化数据库

[dmdba@localhost bin]# ./dminit path=/dmbigdata

initdb V7.6.0.138-Build(2019.02.20-103049)ENT

db version: 0x7000a

file dm.key not found, use default license!

License will expire on 2020-02-20

log file path: /dmbigdata/DAMENG/DAMENG01.log

log file path: /dmbigdata/DAMENG/DAMENG02.log

write to dir [/dmbigdata/DAMENG].

create dm database success. 2019-10-18 03:34:42

— 在新路径下恢复数据库(因为数据库恢复必须恢复到一个已经存在数据库上)

[dmdba@localhost bin]# ./dmrestore help

Format: DMRESTORE KEYWORD=value or KEYWORD=(value1,value2,…,valueN)

Eg: DMRESTORE INI_PATH=/opt/dm7data/dameng/dm.ini FILE=/opt/dm7data/backup/test.bak

Imperative Argument: FILE

Keyword explain(default value)

——————————————————————————–

INI_PATH the path of the dmserver’s dm.ini file

FILE backup file

MAPPED_FIL the path of mapped file, when res_type assign 4.

TIME the timestamp of be going to recover

ARCHIVE_DIR the directory at backup, Format (dir1,dir2,dir3,…)

BACKUP_DIR the stored path of backup file, be used to search backup file, Format (dir1,dir2,dir3,…)

DATAFIL_PATH the file path at the recovery, Format (id1,path1,id2,path2,id3,path3,…)

MIRROR_PATH the mirror file path at the recovery, Format (id1,path1,id2,path2,id3,path3,…)

PARALLEL_DIR the full path of parallel mapping file

RES_TYPE restore type(0,1,2,3,4), 0: bakfil restore, 1: bakfil show, 2: archfil restore, 3: step increment restore, 4:output mapped file default(0)

END_LSN restore to end_lsn

LOG restore output log file

DUMMY quiet mode, {(Y)es,(N)o} default:No

PASSWORD restore with password

ENCRYPT_NAME restore decrypt with encrypt name

HELP output help info

— 这里的 file ,就是备份生成的文件

[root@localhost bin]# ./dmrestore ini_path=/dmbigdata/DAMENG/dm.ini file=/opt/dmdata/DAMENG/bak/DB_DAMENG_20191018033424000722.bak

restore V7.6.0.138-Build(2019.02.20-103049)ENT

file dm.key not found, use default license!

backup sig: BA

backup tool version: 12595

backup db name: DAMENG

backup db magic: 339279924

backup pemnt magic: -222693460

backup name: test.bak

backup type: full

backup level: offline

backup range: database

backup description:

compressed level: 0

encrypt_type: 0

encrypt_id: 2052

rac node: 0

page check: 0

rlog encrypt: 0

external cipher id: 0

external hash id: 0

length in char: 0

use new hash: 1

backup time: 2019-10-18 03:34:24

page size: 8 KB

extent size: 16

case sensitive: 1

log page size: 512 B

charset: 0

data version: 0x7000A

sys version: V7.1.6.138-Build(2019.02.20-103049)ENT

enable policy: 0

mpp_timestamp: 0

crc_check: TRUE

parallel type: 0

parallel info len: 0

backup db fil num: 3

archive flag: 0

after backup LSN: 39863

$bak_seq |$file_path |$size(K) |$used(K)

1|/opt/dmdata/DAMENG/bak/DB_DAMENG_20191018033424000722.bak| 32768.00| 5366.00

$file_seq |$type|$ts_name |$state |$size(K) |$seq_in_bak |$off_in_bak(B) |$len_in_bak(B) |$file_path |$mirror_path

1|DBF |SYSTEM |ONLINE | 21504| 1| 22528| 5152768|/opt/dmdata/DAMENG/SYSTEM.DBF |

2|DBF |ROLL |ONLINE | 131072| 1| 5175296| 311296|/opt/dmdata/DAMENG/ROLL.DBF |

3|DBF |MAIN |ONLINE | 131072| 1| 5486592| 8192|/opt/dmdata/DAMENG/MAIN.DBF |

n 这里需要输入 y 或者 Y

Continue?[Y/N]: y

restore bak_file: /opt/dmdata/DAMENG/bak/DB_DAMENG_20191018033424000722.bak …

start restore database…

start restore file: /dmbigdata/DAMENG/SYSTEM.DBF(SYSTEM), pages: 629

end restore file: /dmbigdata/DAMENG/SYSTEM.DBF(SYSTEM)

start restore file: /dmbigdata/DAMENG/ROLL.DBF(ROLL), pages: 38

end restore file: /dmbigdata/DAMENG/ROLL.DBF(ROLL)

start restore file: /dmbigdata/DAMENG/MAIN.DBF(MAIN), pages: 1

end restore file: /dmbigdata/DAMENG/MAIN.DBF(MAIN)

end restore database data files.

Apply archive log LSN from 39864 to 39863, time used:0.000s.

restore finished, code = 0!

restore successfully!

restore time used: 2166.080(ms)

[dmdba@localhost bin]#

— 在启动数据库,即完成了替换

[dmdba@localhost bin]# ps -ef|grep dmserver

dmdba 1781 1485 0 03:35 pts/0 00:00:00 ./dmserver /dmbigdata/DAMENG/dm.ini

dmdba 1840 1662 0 03:39 pts/1 00:00:00 grep –color=auto dmserver

[dmdba@localhost bin]#
————————————————
版权声明:本文为CSDN博主「耿建芳」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_32016817/article/details/111944410

相关文章