人工智能操作系统的相关说明(机器人控制系统需使用实时操作系统)
814
2022-05-30
本文仅是闲暇时间,所做的一次迁移尝试,没有理论依据,不做实际项目实施参考,以此记录以备后查;
先说结论,此次通过RMAN备份,进行跨OS平台迁的移测试失败~_~;
正确的操作方式,参考本人的另一篇实践手记:https://bbs.huaweicloud.com/blogs/242955
源主机:操作系统:Redhat Enterprise Linux Server 6.5
数据库:Oracle 11G Release 11.2.0.1.0 RAC
存储方式:ASM(Auto Storage Manager)
目标主机:操作系统:Windows Server 2008 R2 SP1
数据库:Oracle 11G Release 11.2.0.3.0
存储方式:文件系统
1.Linux平台上的数据库的备份
--备份脚本如下:
run {
allocate channel t1 type disk;
backup incremental level 0
skip inaccessible
format '/oracle/orabak/orcl/data/bak_%s_%p_%T_%d'
database plus archivelog
format '/oracle/orabak/orcl/arch/arc_%s_%p_%t_%d'
delete input;
delete obsolete;
release channel t1;
}
2.复制备份集到目标主机
--可以通过linux的mount去挂载Windows服务器的共享目录,然后复制到Windows平台:
mount -t cifs -o username='admin',password='password' 192.168.10.52:/ftp_share /media/cifs
cd /media/cifs
cp -r /oracle/orabak/orcl ./
3.目标端数据库恢复
3.1.在目标机器上使用dbca创建一个数据库,使用和源数据库相同的SID:
dbca
创建完成后删除该数据库的相应数据文件:
sqlplus "/as sysdba"
SQL> shutdown immediate
del orcl/datafile
del database/spfile
C:\Users\Administrator>net start oracleserviceorcl
请求的服务已经启动。
3.2.恢复参数文件:
--使用RMAN启动数据库到nomount状态下:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ --此处报错,错误信息如下:
+ RMAN> startup nomount;
+
+ --启动失败: ORA-01078: failure in processing system parameters
+ LRM-00109: ???????????????? 'D:\APP\ADMINISTRATOR\PRODUCT\11.2.0\DBHOME_1\DATABASE\INITORCL.ORA'
+
+ --在没有参数文件的情况下启动 Oracle 实例以检索 spfile
+ RMAN-00571: ===========================================================
+ RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
+ RMAN-00571: ===========================================================
+ RMAN-03002: startup 命令 (在 10/29/2019 16:56:15 上) 失败
+ RMAN-04014: 启动失败: ORA-04031: unable to allocate 1048608 bytes of shared memory ("shared pool","unknown object","sga heap(1,0)","row cache")
+
+ --这个错误,这是因为数据库的BUG,解决方法如下:
+ set ORA_RMAN_SGA_TARGET=350
+
+ --再次在RMAN里启动数据库到nomount状态下成功,然后尝试恢复spfile:
+ RMAN> restore spfile from 'd:\orcl\data\back_8_1_20191027_ORCL';
+ 通道 ORA_DISK_1: 从 AUTOBACKUP 还原 SPFILE 已完成
+ 完成 restore 于 29-10月-19
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3.3.修改参数文件中相应的RAC信息后,用新pfile启动数据库:
--先根据之前恢复出来的spfile创建一个pfile,然后再修改:
SQL> create pfile from spfile;
--这是改完之后的pfile文件:
*.audit_file_dest='D:\app\Administrator\admin\orcl\adump'
*.audit_trail='db'
*.cluster_database=false
*.compatible='11.2.0.0.0'
*.control_files='D:\app\oradata\orcl\control01.ctl','D:\app\Administrator\fast_recovery_area\orcl\control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='orcl'
*.db_recovery_file_dest_size=8589934592
*.log_archive_format='%t_%s_%r.dbf'
*.memory_target=3300917248
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='exclusive'
--修改pfile后,再用pfile将数据库启动到nomount状态下:
SQL> shutdown immediate
SQL> startup nomount pfile='D:\app\Administrator\product\11.2.0\dbhome_1\database\INITorcl.ORA'
3.4.恢复控制文件
--使用以下命令恢复控制文件:
RMAN> restore controlfile from 'd:\orcl\data\back_8_1_20191027_ORCL';
输出文件名=D:\APP\ORADATA\ORCL\CONTROL01.CTL
输出文件名=D:\APP\ADMINISTRATOR\FAST_RECOVERY_AREA\ORCL\CONTROL02.CTL
完成 restore 于 29-10月-19
--改变数据库的状态到mount状态:
RMAN> alter database mount;
数据库已装载
释放的通道: ORA_DISK_1
3.5.修改原数据库的数据文件、重做日志、临时文件的路径:
--查看原数据库文件路径信息:
SQL> col name format a50;
SQL> col file# format 999999;
SQL> set linesize 120;
SQL> select file#,name from v$datafile;
FILE# NAME
------- --------------------------------------------
1 +DATA/orcl/datafile/system.256.893622071
2 +DATA/orcl/datafile/sysaux.257.893622071
3 +DATA/orcl/datafile/undotbs1.258.893622073
4 +DATA/orcl/datafile/users.259.893622073
5 +DATA/orcl/datafile/undotbs2.264.893622239
SQL> select member from v$logfile;
MEMBER
----------------------------------------------
+DATA/orcl/onlinelog/group_2.262.893622155
+FRA/orcl/onlinelog/group_2.258.893622157
+DATA/orcl/onlinelog/group_1.261.893622153
+FRA/orcl/onlinelog/group_1.257.893622155
+DATA/orcl/onlinelog/group_3.265.893622295
+FRA/orcl/onlinelog/group_3.259.893622295
+DATA/orcl/onlinelog/group_4.266.893622297
+FRA/orcl/onlinelog/group_4.260.893622297
已选择8行。
SQL> select name from v$tempfile;
NAME
----------------------------------------------
+DATA/orcl/tempfile/temp.263.893622161
--以新命名的路径恢复数据文件:
run{
set until sequence 57 thread 1;
set newname for datafile 1 to 'D:\app\oradata\orcl\system01.dbf';
set newname for datafile 2 to 'D:\app\oradata\orcl\sysaux01.dbf';
set newname for datafile 3 to 'D:\app\oradata\orcl\undotbs1.dbf';
set newname for datafile 4 to 'D:\app\oradata\orcl\users01.dbf';
set newname for datafile 5 to 'D:\app\oradata\orcl\undotbs02.dbf';
set newname for tempfile 1 to 'D:\app\oradata\orcl\temp01.dbf';
restore database from 'D:\orcl\data\back_7_1_20191027_ORCL';
switch datafile all;
}
--此处报错,错误信息如下:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
启动 restore 于 30-10月-19
使用目标数据库控制文件替代恢复目录
分配的通道: ORA_DISK_1
通道 ORA_DISK_1: SID=96 设备类型=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: restore 命令 (在 10/30/2019 09:34:37 上) 失败
RMAN-06509: 只有 SPFILE 或控制文件才能从 AUTOBACKUP 还原
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Google查了一下,大致确认是数据在不同OS下存储的格式问题,RMAN的备份,是无法直接在异构OS平台下直接使用的;
在做了一些尝试,无法解决这个问题,最后还是放弃了直接使用RMAN备份,进行跨平台恢复的方法了;
Oracle 数据库
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。