本篇文章为大家展示了DM7 RAC数据库怎样恢复成单机数据库,内容简明扼要并且容易理解,绝对能使你眼前一亮,通过这篇文章的详细介绍希望你能有所收获。
DM7 RAC数据库恢复成单机数据库
1) 启动RMAN备份数据库,保证服务器处于脱机状态。
rmanbackupddatabase '/dm7/data/rac0 _ config/DM。ini ' full back uphind '/dm7/backup/db _ RAC _ full _ bak _ recover _ db magic ';
备份数据库'/dm7/data/rac0 _ config/DM。ini ' full back uphind '/dm7/backup/db _ RAC _ full _ bak _ recover _ db magic ';
文件DM。keynote找到了,usedefaultlicense!
正在运行checkingftracddatabase undsystempath[DMDATA/data/RAC].
欧洲专利[0]正在检查.
欧洲专利[1]正在检查.
EP[0]max_lsn:76986
欧洲专利[0]从[76986]调整到[77001]
BACKUPDATABASE[rac],执行.
CMDCHECKLSN.
BACKUPDATABASE[rac],collectdbf.
CMDCHECK.
DBFBACKUPSUBS.
总共1个包已处理.
总共2包已处理.
总共3包已处理.
总共4包已处理.
总计5包已处理.
DBFBACKUPMAIN.
BACKUP[/dm7/BACKUP/db _ RAC _ full _ bak _ recover _ db magic]END,CODE[0].
元生成.
total9packagesprocessed已处理已处理.
total9packagesprocessed已处理已处理!
CMDEND .代码:[0]
成功备份!
已用时间:3887.714(毫秒)
rmanshowbacrudden '/dm7/backup/db _ RAC _ full _ bak _ recover _ db magic ';
showback uphind '/dm7/backup/db _ RAC _ full _ bak _ recover _ db magic ';
systempath: DMDATA/data/rac
dbmagic:-1632052820
永久映像:45092353636
racnode:2
页面检查:0
rlogencrypt:
0
external cipher[id/name]: 0/
external hash[id/name]: 0/
length in char: 0
use new hash: 1
page size: 8 KB
extent size: 16
case sensitive: 1
log page size: 512 B
unicode_flag/charset: 0
data version: 0x7000A
sys version: V7.1.6.46-Build(2018.02.08-89107)ENT
enable policy: 0
archive flag: 1
blank_pad_mode: 0
crc_check: TRUE
backupset sig: BA
backupset version: 4009
database name: rac
backup name: DB_FULL_rac_20200616_154323_000689
backupset description:
backupset ID : 1145407476
parent backupset ID: -1
META file size : 74240
compressed level: 0
encrypt type: 0
parallel num: 1
backup range: database
mpp_timestamp: 1592293401
ddl_clone: FALSE
mpp_flag: FALSE
backup level: offline
backup type: full
without log: FALSE
START_LSN: 76987
START_SEQ: 309
END_LSN: 77001
END_SEQ: 308
base START_LSN: -1
base END_LSN: -1
base name:
base backupset:
backup time: 2020-06-16 15:43:25
min trx start lsn: 76987
min exec ver: 0x0701060C
pkg size: 0x02000000
RAC EP: 0
RAC status: OK
RAC begin lsn: 76987
RAC begin seq: 309
RAC end lsn: 77001
RAC end seq: 308
RAC base begin lsn: -1
RAC base begin seq: -1
RAC base end lsn: -1
RAC base end seq: -1
RAC EP: 1
RAC status: OK
RAC begin lsn: 77002
RAC begin seq: 308
RAC end lsn: 77001
RAC end seq: 307
RAC base begin lsn: -1
RAC base begin seq: -1
RAC base end lsn: -1
RAC base end seq: -1
backupset directory: /dm7/backup/db_rac_full_bak_recover_dbmagic
backupset name: db_rac_full_bak_recover_dbmagic
backup data file num: 5
backup piece num: 1
$file_seq |$size(KB) |$pos_desc |$content_type
0 |26103 |db_rac_full_bak_recover_dbmagic.bak |DATA
$file_seq |$group_id |$group_name |$file_id |$file_path |$mirror_path |$file_len
1 |0 |SYSTEM |0 |+DMDATA/data/rac/system.dbf | |134217728
2 |1 |ROLL |0 |+DMDATA/data/rac/roll.dbf | |134217728
3 |4 |MAIN |0 |+DMDATA/data/rac/main.dbf | |134217728
4 |5 |TS_FOR_DBF |0 |+DMDATA/data/rac/ts_for_dbf_01.dbf| |134217728
5 |5 |TS_FOR_DBF |1 |+DMDATA/data/rac/ts_for_dbf_02.dbf| |134217728
$file_seq |$file_path |$file_len |$begin_lsn |$begin_seqno |$begin_rpag_off |$end_lsn |$end_seqno |$create_time |$close_time
show backupsets successfully.
time used: 10.655(ms)
2) 准备目标库,可以使用备份库,也可以重新生成库。这里是在别一台服务器上创建新库,重新生成库操作如下:
[dmdba@dmks ~]$ dminit path=/dm_home/dmdbms/data db_name=dameng_for_recover auto_overwrite=1 port_num=5336 initdb V7.1.6.46-Build(2018.02.08-89107)ENT db version: 0x7000a file dm.key not found, use default license! License will expire in 14 day(s) on 2020-06-30 log file path: /dm_home/dmdbms/data/dameng_for_recover/dameng_for_recover01.log log file path: /dm_home/dmdbms/data/dameng_for_recover/dameng_for_recover02.log write to dir [/dm_home/dmdbms/data/dameng_for_recover]. create dm database success. 2020-06-16 16:03:18 [root@dmks root]# ./dm_service_installer.sh -i /dm_home/dmdbms/data/dameng_for_recover/dm.ini -p dmrc -t dmserver Move the service script file(/dm_home/dmdbms/bin/DmServicedmrc to /etc/rc.d/init.d/DmServicedmrc) Finished to create the service (DmServicedmrc) [root@dmks root]# service DmServicedmrc start Starting DmServicedmrc: [ OK ] [dmdba@dmks ~]$ disql SYSDBA/SYSDBA@localhost:5336 Server[localhost:5336]:mode is normal, state is open login used time: 10.727(ms) disql V7.1.6.46-Build(2018.02.08-89107)ENT Connected to: DM 7.1.6.46 SQL> select permanent_magic; LINEID PERMANENT_MAGIC ---------- --------------- 1 -1238913195 used time: 0.793(ms). Execute id is 809. SQL> select db_magic from v$rlog; LINEID DB_MAGIC ---------- ----------- 1 1319824724 used time: 0.984(ms). Execute id is 810.
3)将备份集和归档日志文件复制到目标库所在主机上
[dmdba@dmrac1 backup]$ scp -r db_rac_full_bak_recover_dbmagic dmdba@10.10.10.187:/dm_home/dmdbms/backup/
The authenticity of host '10.10.10.187 (10.10.10.187)' can't be established.
RSA key fingerprint is 34:9a:d7:67:6d:be:20:45:21:ce:96:82:23:e5:e9:11.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.10.10.187' (RSA) to the list of known hosts.
dmdba@10.10.10.187's password:
db_rac_full_bak_recover_dbmagic.meta 100% 73KB 72.5KB/s 00:00
db_rac_full_bak_recover_dbmagic.bak 100% 25MB 25.5MB/s 00:00
[dmdba@dmrac1 data]$ scp -r local_arch dmdba@10.10.10.187:/dm_home/dmdbms/backup/
dmdba@10.10.10.187's password:
ARCHIVE_LOCAL1_20200528171255857_0.log 100% 157KB 156.5KB/s 00:00
[dmdba@dmrac1 data]$ scp -r rac0_arch dmdba@10.10.10.187:/dm_home/dmdbms/backup/
dmdba@10.10.10.187's password:
ARCHIVE_LOCAL1_20200615164953273_0.log 100% 160KB 160.0KB/s 00:00
ARCHIVE_LOCAL1_20200615165648166_0.log 100% 157KB 157.0KB/s 00:00
ARCHIVE_LOCAL1_20200528202150715_0.log 100% 277KB 277.0KB/s 00:00
ARCHIVE_LOCAL1_20200608151836879_0.log 100% 158KB 157.5KB/s 00:00
ARCHIVE_LOCAL1_20200609150852829_0.log 100% 157KB 157.0KB/s 00:00
ARCHIVE_LOCAL1_20200608152638617_0.log 100% 159KB 158.5KB/s 00:00
ARCHIVE_LOCAL1_20200609170732487_0.log 100% 161KB 160.5KB/s 00:00
ARCHIVE_LOCAL1_20200615172117341_0.log 100% 159KB 158.5KB/s 00:00
ARCHIVE_LOCAL1_20200615171042444_0.log 100% 159KB 159.0KB/s 00:00
ARCHIVE_LOCAL1_20200605154214367_0.log 100% 157KB 157.0KB/s 00:00
[dmdba@dmrac1 data]$ scp -r rac1_arch dmdba@10.10.10.187:/dm_home/dmdbms/backup/
dmdba@10.10.10.187's password:
ARCH_REMOTE1_20200608152641970_1.log 100% 158KB 158.0KB/s 00:00
ARCH_REMOTE1_20200609170737070_1.log 100% 159KB 159.0KB/s 00:00
ARCH_REMOTE1_20200609150857056_1.log 100% 158KB 158.0KB/s 00:00
ARCH_REMOTE1_20200615172121038_1.log 100% 158KB 158.0KB/s 00:00
ARCH_REMOTE1_20200608151838201_1.log 100% 5632 5.5KB/s 00:00
ARCH_REMOTE1_20200528202146001_1.log 100% 158KB 158.0KB/s 00:00
ARCH_REMOTE1_20200615164957743_1.log 100% 158KB 158.0KB/s 00:00
ARCH_REMOTE1_20200605154211189_1.log 100% 159KB 159.0KB/s 00:00
ARCH_REMOTE1_20200615165652504_1.log 100% 158KB 158.0KB/s 00:00
ARCH_REMOTE1_20200615171046600_1.log 100% 158KB 158.0KB/s 00:00
[dmdba@dmrac1 data]$
4)检验备份
RMAN> check backupset '/dm_home/dmdbms/backup/db_rac_full_bak_recover_dbmagic'; check backupset '/dm_home/dmdbms/backup/db_rac_full_bak_recover_dbmagic'; CMD END.CODE:[0] check backupset successfully. time used: 5.877(ms)
5)还原数据库
RMAN> restore database '/dm_home/dmdbms/data/dameng_for_recover/dm.ini' from backupset '/dm_home/dmdbms/backup/db_rac_full_bak_recover_dbmagic'; restore database '/dm_home/dmdbms/data/dameng_for_recover/dm.ini' from backupset '/dm_home/dmdbms/backup/db_rac_full_bak_recover_dbmagic'; file dm.key not found, use default license! checking if the database under system path [/dm_home/dmdbms/data/dameng_for_recover] is running...[4]. checking if the database under system path [/dm_home/dmdbms/data/dameng_for_recover] is running...[3]. checking if the database under system path [/dm_home/dmdbms/data/dameng_for_recover] is running...[2]. checking if the database under system path [/dm_home/dmdbms/data/dameng_for_recover] is running...[1]. checking if the database under system path [/dm_home/dmdbms/data/dameng_for_recover] is running...[0]. checking if the database under system path [/dm_home/dmdbms/data/dameng_for_recover] is running, write dmrman info. RESTORE DATABASE CHECK...... RESTORE DATABASE , dbf collect...... RESTORE DATABASE , dbf refresh ...... RESTORE BACKUPSET [/dm_home/dmdbms/backup/db_rac_full_bak_recover_dbmagic] START...... total 5 packages processed... RESTORE DATABASE , UPDATE ctl file...... RESTORE DATABASE , REBUILD key file...... RESTORE DATABASE , CHECK db info...... RESTORE DATABASE , UPDATE db info...... total 7 packages processed! CMD END.CODE:[0] restore successfully. time used: 16226.253(ms)
6)恢复数据库
RMAN> recover database '/dm_home/dmdbms/data/dameng_for_recover/dm.ini' update db_magic ; recover database '/dm_home/dmdbms/data/dameng_for_recover/dm.ini' update db_magic; checking if the database under system path [/dm_home/dmdbms/data/dameng_for_recover] is running...[4]. checking if the database under system path [/dm_home/dmdbms/data/dameng_for_recover] is running...[3]. checking if the database under system path [/dm_home/dmdbms/data/dameng_for_recover] is running...[2]. checking if the database under system path [/dm_home/dmdbms/data/dameng_for_recover] is running...[1]. checking if the database under system path [/dm_home/dmdbms/data/dameng_for_recover] is running...[0]. checking if the database under system path [/dm_home/dmdbms/data/dameng_for_recover] is running, write dmrman info. EP[0] max_lsn: 76986 [-8308]:forbid updating database magic, need redo log
这里使用update db_magic选项出错了,提示需要重做日志文件。下面去掉update db_magic选项,因为每次还原恢复时也是一定会更新db_magic值。
RMAN> recover database '/dm_home/dmdbms/data/dameng_for_recover/dm.ini' with archivedir '/dm_home/dmdbms/backup/rac0_arch','/dm_home/dmdbms/backup/rac1_arch'; recover database '/dm_home/dmdbms/data/dameng_for_recover/dm.ini' with archivedir '/dm_home/dmdbms/backup/rac0_arch' , '/dm_home/dmdbms/backup/rac1_arch'; checking if the database under system path [/dm_home/dmdbms/data/dameng_for_recover] is running...[4]. checking if the database under system path [/dm_home/dmdbms/data/dameng_for_recover] is running...[3]. checking if the database under system path [/dm_home/dmdbms/data/dameng_for_recover] is running...[2]. checking if the database under system path [/dm_home/dmdbms/data/dameng_for_recover] is running...[1]. checking if the database under system path [/dm_home/dmdbms/data/dameng_for_recover] is running...[0]. checking if the database under system path [/dm_home/dmdbms/data/dameng_for_recover] is running, write dmrman info. EP[0] max_lsn: 76986 min_ckpt_lsn = The RAC recover total redo 0 ptx EP(0) slot ctl page(1, 0, 16) trxid = 9986 EP(1) slot ctl page(1, 0, 17) trxid = 8457 EP[0] Recover LSN from 76987 to 77001. EP[1] Recover LSN from 77002 to 77001. Recover from archive log finished, time used:0.006s. recover successfully! time used: 7027.075(ms)
7)检查数据,查询表t1的数据可以验证数据恢复成功
[dmdba@dmks ~]$ disql SYSDBA/SYSDBA@localhost:5336 Server[localhost:5336]:mode is normal, state is open login used time: 10.727(ms) disql V7.1.6.46-Build(2018.02.08-89107)ENT Connected to: DM 7.1.6.46 SQL> desc t1; LINEID NAME TYPE$ NULLABLE ---------- ---- ----------- -------- 1 ID INTEGER Y 2 NAME VARCHAR(20) Y used time: 20.311(ms). Execute id is 3. SQL> select * from t1; LINEID ID NAME ---------- ----------- ---- 1 1 jy 2 2 hy used time: 1.138(ms). Execute id is 4.
8)检查db_magic,还原恢复后db_magic从-1632052820变成了1009602608,
SQL> select permanent_magic; LINEID PERMANENT_MAGIC ---------- --------------- 1 450923536 used time: 1.042(ms). Execute id is 5. SQL> select db_magic from v$rlog; LINEID DB_MAGIC ---------- ----------- 1 1009602608 used time: 1.332(ms). Execute id is 6.
上述内容就是DM7 RAC数据库怎样恢复成单机数据库,你们学到知识或技能了吗?如果还想学到更多技能或者丰富自己的知识储备,欢迎关注行业资讯频道。
内容来源网络,如有侵权,联系删除,本文地址:https://www.230890.com/zhan/126949.html