当前位置:网站首页>How to modify data file path in DM database
How to modify data file path in DM database
2022-07-02 04:38:00 【Song Xiaorong】
In real business , We sometimes encounter the situation that the disk is full , At this point, you need to transfer the data file to the newly attached disk , This is the path modification of the data file . The path modification of the data file includes ordinary table spaces 、 SYSTEM tablespace 、TEMP Table spaces and ROLL Rollback the data file of the tablespace , And redo log files , The following will be explained according to the situation .
Common tablespace data file path modification
The path of the data file can only be modified in the offline state of the ordinary table space , So before we modify the data file path of the ordinary table space , You need to query the tablespace information where the data file is located .
(1) Query tablespace and data file information
Use as follows SQL Statement to query tablespace and data file information :
select a.file_name,a.file_id,a.tablespace_name,a.status,a.bytesfrom dba_data_files aorder by a.tablespace_name,a.file_id;The query results are as follows :

(2) Modify data file path information
If we need to modify TBS Two data files of ordinary table space to TBS Under the folder ( To be guaranteed TBS Folder exists ), At this time, you can use the following SQL sentence , The operation steps are as follows :
① Take the tablespace where the data file is located offline :
alter tablespace TBS offline;② Modify data file path :
alter tablespace TBS rename datafile'/dm/data/DAMENG/TBS01.dbf'to'/dm/data/DAMENG/TBS/TBS01.dbf';alter tablespace TBS rename datafile'/dm/data/DAMENG/TBS02.dbf'to'/dm/data/DAMENG/TBS/TBS02.dbf';
③ Online the tablespace where the data file is located :
alter tablespace TBS online;Complete the above steps , Reexamine dba_data_files, At this time, the data file path has been modified to a new path . As shown in the figure below :

Be careful , When transferring data files , Because you want to take the tablespace offline for a short time , It will affect the operation of related businesses , Therefore, it is necessary to inform customers in advance of short-term business interruption . in addition , When transferring data files , Note that the new data file path exists , And belongs to dmdba User group .
in addition ,DM The client management tool can also modify the data file path of the table space , This principle is similar to the above SQL Agreement , After the interface operation, the bottom layer calls three of the above operation steps .
Redo log file path modification
Because redo logs are online , Cannot take redo logs offline , Therefore, the path of the redo log file can only be modified in mount Modify in status .
(1) Query redo log file information
Before modifying the data file , First understand the redo log file information , Use as follows SQL Statement query :
select t.group_id,t.file_id, t.path, t.rlog_size from v$rlogfile t;The query results are as follows :

(2) Modify the path information of redo log file
Before modifying the redo log file path , You need to set the database to mount state , Then modify the path information of redo log file . For example, we modify the redo log to /dm/data/DAMENG/REDO route , The operation steps are as follows :
① Switch the database to mount state :
alter database mount;② Modify the path of redo log file :
alter database rename logfile'/dm/data/DAMENG/DAMENG01.log'to'/dm/data/DAMENG/REDO/DAMENG01.log';alter database rename logfile'/dm/data/DAMENG/DAMENG02.log'to'/dm/data/DAMENG/REDO/DAMENG02.log';
③ Switch the database to open state :
alter database open;Complete the above steps , Reexamine V$RLOGFILE, At this time, the path of redo log file has been changed to a new path . As shown in the figure below :

Be careful , When transferring redo log files , Because the database should be set to mount state , At this time, the database cannot provide normal services , It will affect the operation of the business . When transferring redo log files, you should pay attention to the existence of new paths , And belongs to dmdba User group .
in addition ,DM The client management tool can also modify the redo log file path , This principle is similar to the above SQL The sentences are consistent .DM The management tool needs to set the database to the configuration state first (MOUNT), Then modify the path of redo log file .
SYSTEM tablespace 、ROLL Table space data file
Path modification
because SYSTEM SYSTEM tablespace 、ROLL Rollback tablespace does not allow offline , System tablespaces and ROLL The path modification of the tablespace data file can only be completed by modifying the path of the corresponding data file in the control file .
DM The control file is a binary file , Cannot edit directly , Need to use dmctlcvt After the tool is converted to a text file, edit . Be careful , Modify the system tablespace 、UNDO Tablespaces require manual copying of files , To maintain data consistency , Need to close database , Then copy the data file . The specific operation steps are as follows :
① The control file dm.ctl Convert to text file
perform dmctlcvt help You can view help for using this command . As shown in the figure below :

Execute the following command , The control file dm.ctl Convert to text file dmctl.txt:
[[email protected]~]$ dmctlcvt type=1src=/dm/data/DAMENG/dm.ctldest=/dm/data/DAMENG/dmctl.txt
② Modify the data file path in the text file
perform vi dmctl.txt Edit the generated text file , Modify the system tablespace 、ROLL The tablespace data file path is a new path , If it is modified to /dm/data/DAMENG/NEW Folder .

③ Convert the modified text file into the target control file
Execute the following command , The modified text file dmctl.txt Convert to new control file dmnew.ctl:
[[email protected]~]$ dmctlcvt type=2src=/dm/data/DAMENG/dmctl.txtdest=/dm/data/DAMENG/dmnew.ctl
④ Close the database , Copy the data file to the new path
Close the database , Copy SYSTEM.DBF and ROLL.DBF To the new data file path /dm/data/DAMENG/NEW, After copying , Rename the new control file to overwrite the original control file . Start the database after completion , Reexamine dba_data_files View , You can see the system table space and ROLL The tablespace file path has been modified . Here's the picture :

actually , This method can also be used to modify the path of data files and redo log files in ordinary table spaces , But this method requires closing the database , And transform the control documents , The operation did not SQL Sentence or DM The management tool interface is direct and convenient , If only for ordinary table spaces and online redo logs , This method is not recommended .
TEMP Table space data file path modification
TEMP The path of the table space is dm.ini Configured in , The parameter name is TEMP_PATH. Only need to modify when modifying dm.ini in TEMP_PATH Parameter values , because TEMP_PATH by READONLY type , So you can only modify it manually dm.ini file , And restart the database to take effect .TEMP The modification of table space path does not need to be copied TEMP.DBF, When the database starts, the file will be regenerated under the configuration path .
Here's the picture , Use vi dm.ini modify dm.ini In file TEMP_PATH by /dm/data/DAMENG/NEW.

After the modification is completed , Restart the database , Inquire about dba_data_files View , You can see TEMP The data file path of the tablespace has been modified . Here's the picture :

边栏推荐
- Yolov5 network modification tutorial (modify the backbone to efficientnet, mobilenet3, regnet, etc.)
- How to solve the problem that objects cannot be deleted in Editor Mode
- geotrust ov多域名ssl證書一年兩千一百元包含幾個域名?
- Vmware安装win10报错:operating system not found
- ThinkPHP kernel work order system source code commercial open source version multi user + multi customer service + SMS + email notification
- Dare to go out for an interview without learning some distributed technology?
- Play with concurrency: what's the use of interruptedexception?
- Arbre binaire pour résoudre le problème (2)
- 10 minutes to understand CMS garbage collector in JVM
- Pytoch --- use pytoch for image positioning
猜你喜欢

Pytoch --- use pytoch to predict birds

BGP experiment the next day

Vmware安装win10报错:operating system not found

win11安装pytorch-gpu遇到的坑

LeetCode-归并排序链表

Leetcode- insert and sort the linked list

Three years of experience in Android development interview (I regret that I didn't get n+1, Android bottom development tutorial

缓存一致性解决方案——改数据时如何保证缓存和数据库中数据的一致性

One step implementation of yolox helmet detection (combined with oak intelligent depth camera)
![[C language] Dynamic Planning --- from entry to standing up](/img/7e/29482c8f3970bb1a40240e975ef97f.png)
[C language] Dynamic Planning --- from entry to standing up
随机推荐
Summary of common string processing functions in C language
【c语言】动态规划---入门到起立
Thinkphp6 limit interface access frequency
Use a mask to restrict the input of the qlineedit control
idea自動導包和自動删包設置
CorelDRAW Graphics Suite2022免费图形设计软件
Mapping location after kotlin confusion
AcrelEMS高速公路微电网能效管理平台与智能照明解决方案智慧点亮隧道
社交媒体搜索引擎优化及其重要性
记录一次Unity 2020.3.31f1的bug
CY7C68013A之keil编译代码
Geotrust OV Multi - Domain Domain SSL Certificate rmb2100 per year contains several Domain names?
二叉樹解題(二)
缓存一致性解决方案——改数据时如何保证缓存和数据库中数据的一致性
Homework of the 16th week
[graduation season · advanced technology Er] young people have dreams, why are they afraid of hesitation
Pytorch-Yolov5从0运行Bug解决:
oracle 存储过程与job任务设置
Unity particle Foundation
How to write a client-side technical solution