达梦数据库系统表空间的迁移

SYSTEM 表空间和ROLL表空间

SYSTEM 表空间存放了有关 DM 数据库的字典信息,用户不能在 SYSTEM 表空间创建表和索引。
ROLL表空间完全由DM数据库自动维护,用户无需干预。
ROLL表空间用来存放事务运行过程中执行DML作之前的值,从而为访问该表的其他用户提供表数据的读一致性视图。

迁移SYSTEM和ROLL表空间

	SYSTEM表空间数据文件从/dm8/dmdbms/data/DAMENG/SYSTEM.DBF期望调整为/dm8/dmdbms/DAMENG/SYSTEM01.DBF
	ROLL表空间数据文件从/dm8/dmdbms/data/DAMENG/ROLL.DBF期望调整为/dm8/dmdbms/DAMENG/ROLL01.DBF

迁移前SYSTEM和ROLL表空间的数据文件情况

SQL> select TABLESPACE_NAME,FILE_NAME,round(BYTES/1024/1024) size_MB,BLOCKS,AUTOEXTENSIBLE from dba_data_files where TABLESPACE_NAME in('SYSTEM','ROLL');

LINEID     TABLESPACE_NAME FILE_NAME                            SIZE_MB BLOCKS               AUTOEXTENSIBLE
---------- --------------- ------------------------------------ ------- -------------------- --------------
1          SYSTEM          /dm8/dmdbms/data/DAMENG/SYSTEM.DBF   25      3200                 YES
2          ROLL            /dm8/dmdbms/data/DAMENG/ROLL02.DBF   64      8192                 YES
3          ROLL            /dm8/dmdbms/data/DAMENG/ROLL.DBF     128     16384                YES
4          SYSTEM          /dm8/dmdbms/data/DAMENG/SYSTEM02.DBF 64      8192                 YES

used time: 1.855(ms). Execute id is 501.
SQL> 

停止数据库

[root@dmdb1 root]# systemctl stop DmServiceDMSERVER.service

找到控制文件路径

[dmdba@dmdb1 DAMENG]$ cat dm.ini|grep CTL_PATH
                CTL_PATH                        = /dm8/dmdbms/data/DAMENG/dm.ctl     #ctl file path
[dmdba@dmdb1 DAMENG]$ 

冷备份控制文件

[dmdba@dmdb1 DAMENG]$ cp dm.ctl dm0509.ctl

控制文件变成文本文件

[dmdba@dmdb1 DAMENG]$ dmctlcvt c2t /dm8/dmdbms/data/DAMENG/dm.ctl dm0509.txt
DMCTLCVT V8
convert ctl to txt success!
[dmdba@dmdb1 DAMENG]$ 

找到待迁移SYSTEM和ROLL的数据文件项目

[dmdba@dmdb1 DAMENG]$ 
[dmdba@dmdb1 DAMENG]$ cat dm0509.txt 
##############################################################################
## please do not adjust parameter order, ensure the ctl have no difference ###
##########################################################################


# database name
dbname=DAMENG
# server mode
svr_mode=0
#OGUID
oguid=0
# db server version
version=117508180
# database version
db_version=458764
# pseg version
pseg_version=458762
#SGUID
sguid=400761439
#NEXT_TS_ID
next_ts_id=6
#RAC_NODES
rac_nodes=1
#NEXT_HTS_ID
next_htsid=129
#TIME_FLAG
time_flag=170
#MDIR_FLAG
mdir_flag=31
#STARTUP_CNT
startup_cnt=7
#LAST_STARTUP_TIME
last_startup_time=DATETIME '2022-5-9 15:23:16'
#DM7_DCT_VERSION
dm7_dct_version=11
#DM8_DCT_VERSION
dm8_dct_version=38

#===============================================
#===============================================

# table space name
ts_name=SYSTEM
 # table space ID
ts_id=0
# table space status
ts_state=0
# table space cache
ts_cache=
# DSC node number
ts_nth=0
# DSC optimized node number
ts_opt_node=0
# table space create time
ts_create_time=DATETIME '2022-5-7 17:19:17'
# table space modify time
ts_modify_time=DATETIME '2022-5-9 15:24:59'
# table space encrypt flag
ts_encrypt_flag=0
# table space copy num
ts_copy_num=0
# table space region size flag
ts_size_flag=0

#-----------------------------------------------

# file path
fil_path=/dm8/dmdbms/data/DAMENG/SYSTEM.DBF   ###期望调整为/dm8/dmdbms/DAMENG/SYSTEM01.DBF
# mirror path
mirror_path=
# file id
fil_id=0
# whether the file is auto extend
autoextend=1
# file create time
fil_create_time=DATETIME '2022-5-7 17:19:17'
# file modify time
fil_modify_time=DATETIME '2022-5-7 17:19:17'
# the max size of file
fil_max_size=0
# next size of file
fil_next_size=0

# file path
fil_path=/dm8/dmdbms/data/DAMENG/SYSTEM02.DBF
# mirror path
mirror_path=
# file id
fil_id=1
# whether the file is auto extend
autoextend=1
# file create time
fil_create_time=DATETIME '2022-5-9 15:24:59'
# file modify time
fil_modify_time=DATETIME '2022-5-9 15:24:59'
# the max size of file
fil_max_size=0
# next size of file
fil_next_size=5


#===============================================

# table space name
ts_name=ROLL
 # table space ID
ts_id=1
# table space status
ts_state=0
# table space cache
ts_cache=
# DSC node number
ts_nth=0
# DSC optimized node number
ts_opt_node=0
# table space create time
ts_create_time=DATETIME '2022-5-7 17:19:17'
# table space modify time
ts_modify_time=DATETIME '2022-5-9 15:14:18'
# table space encrypt flag
ts_encrypt_flag=0
# table space copy num
ts_copy_num=0
# table space region size flag
ts_size_flag=0

#-----------------------------------------------

# file path
fil_path=/dm8/dmdbms/data/DAMENG/ROLL.DBF  ###期望调整为/dm8/dmdbms/DAMENG/ROLL01.DBF
# mirror path
mirror_path=
# file id
fil_id=0
# whether the file is auto extend
autoextend=1
# file create time
fil_create_time=DATETIME '2022-5-7 17:19:17'
# file modify time
fil_modify_time=DATETIME '2022-5-7 17:19:17'
# the max size of file
fil_max_size=0
# next size of file
fil_next_size=0

# file path
fil_path=/dm8/dmdbms/data/DAMENG/ROLL02.DBF
# mirror path
mirror_path=
# file id
fil_id=1
# whether the file is auto extend
autoextend=1
# file create time
fil_create_time=DATETIME '2022-5-9 15:14:18'
# file modify time
fil_modify_time=DATETIME '2022-5-9 15:14:18'
# the max size of file
fil_max_size=100
# next size of file
fil_next_size=5


#===============================================

# table space name
ts_name=RLOG
 # table space ID
ts_id=2
# table space status
ts_state=0
# table space cache
ts_cache=
# DSC node number
ts_nth=0
# DSC optimized node number
ts_opt_node=0
# table space create time
ts_create_time=DATETIME '2022-5-7 17:19:17'
# table space modify time
ts_modify_time=DATETIME '2022-5-7 17:19:17'
# table space encrypt flag
ts_encrypt_flag=0
# table space copy num
ts_copy_num=0
# table space region size flag
ts_size_flag=0

#-----------------------------------------------

# file path
fil_path=/dm8/dmdbms/data/DAMENG/DAMENG01.log
# mirror path
mirror_path=
# file id
fil_id=0
# whether the file is auto extend
autoextend=1
# file create time
fil_create_time=DATETIME '2022-5-7 17:19:17'
# file modify time
fil_modify_time=DATETIME '2022-5-7 17:19:17'
# the max size of file
fil_max_size=0
# next size of file
fil_next_size=0

# file path
fil_path=/dm8/dmdbms/data/DAMENG/DAMENG02.log
# mirror path
mirror_path=
# file id
fil_id=1
# whether the file is auto extend
autoextend=1
# file create time
fil_create_time=DATETIME '2022-5-7 17:19:17'
# file modify time
fil_modify_time=DATETIME '2022-5-7 17:19:17'
# the max size of file
fil_max_size=0
# next size of file
fil_next_size=0


#===============================================

# table space name
ts_name=MAIN
 # table space ID
ts_id=4
# table space status
ts_state=0
# table space cache
ts_cache=
# DSC node number
ts_nth=0
# DSC optimized node number
ts_opt_node=0
# table space create time
ts_create_time=DATETIME '2022-5-7 17:19:17'
# table space modify time
ts_modify_time=DATETIME '2022-5-7 17:19:17'
# table space encrypt flag
ts_encrypt_flag=0
# table space copy num
ts_copy_num=0
# table space region size flag
ts_size_flag=0

#-----------------------------------------------

# file path
fil_path=/dm8/dmdbms/data/DAMENG/MAIN.DBF
# mirror path
mirror_path=
# file id
fil_id=0
# whether the file is auto extend
autoextend=1
# file create time
fil_create_time=DATETIME '2022-5-7 17:19:17'
# file modify time
fil_modify_time=DATETIME '2022-5-7 17:19:17'
# the max size of file
fil_max_size=0
# next size of file
fil_next_size=0


#===============================================

# HUGE table space name
htsname=HMAIN
# HUGE table space id
htsid=128
#HUGE table space share flag
htsflag=0
# HUGE table space copy num
hts_copy_num=0
# HUGE table space region size flag
hts_size_flag=0
# HUGE table space create time
hts_create_time=DATETIME '2022-5-7 17:19:17'
# HUGE table space modify time
hts_modify_time=DATETIME '2022-5-7 17:19:17'
# HUGE table space path
htspath=/dm8/dmdbms/data/DAMENG/HMAIN

#===============================================

[dmdba@dmdb1 DAMENG]$ 

保存修改后dm0509.txt

vi 进入后,按照上面期望调整,摁 wq完成保存退出。

将txt文件变成control file文件

[dmdba@dmdb1 DAMENG]$ pwd
/dm8/dmdbms/data/DAMENG
[dmdba@dmdb1 DAMENG]$ 
[dmdba@dmdb1 DAMENG]$ dmctlcvt t2c  dm0509.txt dm.ctl
DMCTLCVT V8
convert txt to ctl success!
[dmdba@dmdb1 DAMENG]$ 

迁移数据文件


[dmdba@dmdb1 DAMENG]$ cp SYSTEM.DBF /dm8/dmdbms/DAMENG/SYSTEM01.DBF
[dmdba@dmdb1 DAMENG]$ 
[dmdba@dmdb1 DAMENG]$ mv SYSTEM.DBF SYSTEM.DBF.0509
[dmdba@dmdb1 DAMENG]$ 
[dmdba@dmdb1 DAMENG]$ 
[dmdba@dmdb1 DAMENG]$  cp ROLL.DBF /dm8/dmdbms/DAMENG/ROLL01.DBF
[dmdba@dmdb1 DAMENG]$ mv ROLL.DBF ROLL.DBF.0509
[dmdba@dmdb1 DAMENG]$ 
[dmdba@dmdb1 DAMENG]$ ls -ltr /dm8/dmdbms/DAMENG/SYSTEM01.DBF
-rw-r--r-- 1 dmdba dinstall 26214400 May  9 17:29 /dm8/dmdbms/DAMENG/SYSTEM01.DBF
[dmdba@dmdb1 DAMENG]$ 
[dmdba@dmdb1 DAMENG]$ ls -ltr /dm8/dmdbms/DAMENG/ROLL01.DBF
-rw-r--r-- 1 dmdba dinstall 134217728 May  9 17:29 /dm8/dmdbms/DAMENG/ROLL01.DBF
[dmdba@dmdb1 DAMENG]$ 

启动数据库

[root@dmdb1 root]# 
[root@dmdb1 root]# systemctl start DmServiceDMSERVER.service
[root@dmdb1 root]# 

迁移后SYSTEM和ROLL表空间的数据文件情况

SQL> select TABLESPACE_NAME,FILE_NAME,round(BYTES/1024/1024) size_MB,BLOCKS,AUTOEXTENSIBLE from dba_data_files where TABLESPACE_NAME in('SYSTEM','ROLL');

LINEID     TABLESPACE_NAME FILE_NAME                            SIZE_MB BLOCKS               AUTOEXTENSIBLE
---------- --------------- ------------------------------------ ------- -------------------- --------------
1          SYSTEM          /dm8/dmdbms/DAMENG/SYSTEM01.DBF      25      3200                 YES
2          ROLL            /dm8/dmdbms/data/DAMENG/ROLL02.DBF   64      8192                 YES
3          ROLL            /dm8/dmdbms/DAMENG/ROLL01.DBF        128     16384                YES
4          SYSTEM          /dm8/dmdbms/data/DAMENG/SYSTEM02.DBF 64      8192                 YES

used time: 7.857(ms). Execute id is 500.
SQL> 

达梦在线服务平台:https://eco.dameng.com

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值