达梦恢复表空间
当前版本
```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;
```
过程结束,难道文字少就不让发布吗?
不都是在代码中了嘛?
阅读(613) | 评论(0) | 转发(0) |