DM8表空间备份还原

1、在DMHR表空间创建测试表 
create table dmhr.CITY_TEST tablespace DMHR as select * from dmhr.CITY ; 
SQL> select count(*) from dmhr.CITY_TEST; 
行号 COUNT(*) 
---------- -------------------- 
1 11 
2、表空间级,全备和增备 
表空间全备: 
SQL> BACKUP TABLESPACE DMHR BACKUPSET '/dm/dmback/ts_dmhr_full_bak_01'; 
操作已执行 
已用时间: 00:00:03.497. 执行号:900. 
SQL> insert into dmhr.CITY_TEST select * from dmhr.CITY_TEST;commit; 
DMSQL 过程已成功完成 
已用时间: 6.127(毫秒). 执行号:1000. 
SQL> select count(*) from dmhr.CITY_TEST; 
行号 COUNT(*) 
---------- -------------------- 
1 22 
表空间增备: 
SQL> BACKUP TABLESPACE DMHR INCREMENT BASE ON BACKUPSET '/dm/dmback/ts_dmhr_full_bak_01' BACKUPSET '/dm/dmback/ts_dmhr_increment_bak_02'; 
SQL> alter system switch logfile; 
操作已执行 
已用时间: 11.695(毫秒). 执行号:0. 
SQL> select sysdate from dual; 
行号 SYSDATE 
---------- ------------------- 
1 2023-07-14 14:29:54 
3、模拟删除DMHR表空间的数据文件 
SQL> select t.FILE_NAME from DBA_DATA_FILES t where t.TABLESPACE_NAME='DMHR'; 
行号 FILE_NAME 
---------- ------------------------ 
1 /dm/dmdata/CB/DMHR01.dbf 
[dmdba@Kylin01 CB]$ rm -rf /dm/dmdata/CB/DMHR01.dbf 
[dmdba@Kylin01 CB]$ ls -rlt /dm/dmdata/CB/DMHR01.dbf 
ls: 无法访问 '/dm/dmdata/CB/DMHR01.dbf': 没有那个文件或目录 
4、表空间还原 
注意:表空间不能跨库还原(还原报错:[-8232]:备份集DB_MAGIC与当前库不匹配) 
[dmdba@Kylin01 dmback]$ DmServiceDMSERVER stop 
Stopping DmServiceDMSERVER: [ OK ] 
--还原表空间全量 
RESTORE DATABASE '/dm/dmdata/CB/dm.ini' TABLESPACE DMHR FROM BACKUPSET '/dm/dmback/ts_dmhr_full_bak_01'; 
--还原表空间增量 
RESTORE DATABASE '/dm/dmdata/CB/dm.ini' TABLESPACE DMHR FROM BACKUPSET '/dm/dmback/ts_dmhr_increment_bak_02'; 
--表空间恢复 
RECOVER DATABASE '/dm/dmdata/CB/dm.ini' TABLESPACE DMHR; 
还原过程: 
[dmdba@Kylin01 CB]$ DmServiceDMSERVER stop 
Stopping DmServiceDMSERVER: [ OK ] 
[dmdba@Kylin01 CB]$ dmrman 
dmrman V8 
RMAN> RESTORE DATABASE '/dm/dmdata/CB/dm.ini' TABLESPACE DMHR FROM BACKUPSET '/dm/dmback/ts_dmhr_full_bak_01'; 
RESTORE DATABASE '/dm/dmdata/CB/dm.ini' TABLESPACE DMHR FROM BACKUPSET '/dm/dmback/ts_dmhr_full_bak_01'; 
file dm.key not found, use default license! 
Database mode = 0, oguid = 0 
Normal of FAST 
Normal of DEFAULT 
Normal of RECYCLE 
Normal of KEEP 
Normal of ROLL 
EP[0]'s cur_lsn[90151], file_lsn[90151] 
[Percent:100.00%][Speed:0.00M/s][Cost:00:00:02][Remaining:00:00:00] 
restore successfully. 
time used: 00:00:02.515 
RMAN> exit 
time used: 0.288(ms) 
[dmdba@Kylin01 CB]$ ls -rlt /dm/dmdata/CB/DMHR01.dbf 
-rw-r--r-- 1 dmdba dinstall 268435456 5月 29 14:31 /dm/dmdata/CB/DMHR01.dbf 
[dmdba@Kylin01 CB]$ dmrman 
dmrman V8 
RMAN> RESTORE DATABASE '/dm/dmdata/CB/dm.ini' TABLESPACE DMHR FROM BACKUPSET '/dm/dmback/ts_dmhr_increment_bak_02'; 
RESTORE DATABASE '/dm/dmdata/CB/dm.ini' TABLESPACE DMHR FROM BACKUPSET '/dm/dmback/ts_dmhr_increment_bak_02'; 
file dm.key not found, use default license! 
Database mode = 0, oguid = 0 
Normal of FAST 
Normal of DEFAULT 
Normal of RECYCLE 
Normal of KEEP 
Normal of ROLL 
EP[0]'s cur_lsn[90151], file_lsn[90151] 
[Percent:100.00%][Speed:0.00M/s][Cost:00:00:02][Remaining:00:00:00] 
restore successfully. 
time used: 00:00:02.543 
RMAN> RECOVER DATABASE '/dm/dmdata/CB/dm.ini' TABLESPACE DMHR; 
RECOVER DATABASE '/dm/dmdata/CB/dm.ini' TABLESPACE DMHR; 
Database mode = 0, oguid = 0 
Normal of FAST 
Normal of DEFAULT 
Normal of RECYCLE 
Normal of KEEP 
Normal of ROLL 
EP[0]'s cur_lsn[90151], file_lsn[90151] 
dres_backupset_recover_ts bgein. 
[Percent:100.00%][Speed:0.00PKG/s][Cost:00:00:00][Remaining:00:00:00] 
dres_backupset_recover_ts end. 
recover successfully. 
time used: 476.392(ms) 
RMAN> 
验证: 
[dmdba@Kylin01 CB]$ disql sysdba/dameng123 
服务器[LOCALHOST:5236]:处于普通打开状态 
登录使用时间 : 3.009(ms) 
disql V8 
SQL> select count(*) from dmhr.CITY_TEST; 
行号 COUNT(*) 
---------- -------------------- 
1 22 
已用时间: 4.988(毫秒). 执行号:500. 
SQL> 
SQL> select t.FILE_NAME from DBA_DATA_FILES t where t.TABLESPACE_NAME='DMHR'; 
行号 FILE_NAME 
---------- ------------------------ 
1 /dm/dmdata/CB/DMHR01.dbf

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

相关推荐
nangonghen9 天前
k8clone二进制工具迁移k8s中的无状态应用
云原生·kubernetes·备份·恢复
嗝~壁老黄25 天前
XtraBackup开源热备工具
开源·备份·xtrabackup·备份工具
954L1 个月前
Mysql8异地定时自动备份
mysql·安全·备份·shell脚本·定时任务·异地灾备
sysin.org1 个月前
Veritas Backup Exec 24.0 (Windows) - 面向中小型企业的数据备份和恢复
备份·恢复·veritas·backup exec
guochanof1 个月前
达梦数据库使用笔记,备份还原,迁移
数据库·达梦·达梦数据库·达梦迁移·达梦备份
卡西里弗斯奥1 个月前
【达梦数据库】两台或多台服务器之间免密登录设置-【dmdba用户】
ssh·github·达梦
gc_22991 个月前
SqlSugar查询达梦数据库时搜索不到列值为NULL的记录
达梦·sqlsugar
敲代码不忘补水1 个月前
Docker 安装达梦 DM8 数据库实战指南
数据库·docker·容器·达梦·dm8
smile_life_1 个月前
麒麟桌面版v10 SP1以docker方式安装达梦数据库
数据库·docker·达梦·麒麟
卡西里弗斯奥2 个月前
【达梦数据库】存储过程统计模式下表信息-SQL改写
数据库·sql·oracle·达梦