达梦恢复表空间
当前版本
```sql
sql> select id_code;
id_code
-----------------------------------
--03134283914-20220901-168571-20009
```
测试过程
```sql
创建测试表空间 users
create tablespace users datafile '/dm/prod/user1.dbf' size 32 autoextend on next 2 maxsize 10000,'/dm/prod/user2.dbf' size 40 autoextend on next 2 maxsize 20000;
创建测试数据
create table test storage(on users) as select 'aa'||level mc,curtime sj,level from dual connect by level<100001;
select count(0) from test;
确认文件位置并全库备份
select file_name from dba_data_files where tablespace_name='users';
backup database to 'full_with_users';
模拟删除一个文件
host rm -fr /dm/prod/user1.dbf
sp_file_sys_check;
执行完check后,表空间自动变为offline状态
select count(0) from test;
这时再查就报错了
需要用到备份了,确认备份集信息
select * from v$backupset;
#alter tablespace users offline;
恢复表空间
必须先停库
dmservicetest stop
用另外一个工具
dmrman
restore database '/dm/prod/dm.ini' tablespace users from backupset '/dm/prod/bak/db_prod_full_20220926_201120_056407';
recover database '/dm/prod/dm.ini' tablespace users;
再启动库
dmservicetest start
验证可用了
ls -l /dm/prod/user*
disql
select count(0) from test;
```
过程结束,难道文字少就不让发布吗?
不都是在代码中了嘛?
阅读(477) | 评论(0) | 转发(0) |