win->linux
1.单机到单机迁移(尽量减少停机时间)
主库/win | 备库/linux | |
---|---|---|
ip | 192.168.5.104 | 192.168.5.150 |
监听 | 动态/静态 | 静态 |
omf | 启用 | 启用 |
db_recovery | 启用 | 启用 |
db_name | orcl | orcl |
db_unique_name | orcl | orcl |
数据库版本 | 19c | 19c |
system | windows | linux |
准备工作
目标库windows 11G
1.设置数据库归档
shutdown immediate;
startup mount;
alter database archivelog ;
alter database open;
SQL> archive log list
数据库日志模式 存档模式
自动存档 启用
存档终点 USE_DB_RECOVERY_FILE_DEST
最早的联机日志序列 6
下一个存档日志序列 8
当前日志序列 8
SQL>
2.设置初始化参数
—注意windows路径需要大写
alter system set db_file_name_convert='/opt/oracle/oradata/orcl','D:\APP\ADMINISTRATOR\ORADATA\ORCL' scope=spfile;
alter system set log_file_name_convert='/opt/oracle/oradata/orcl','D:\APP\ADMINISTRATOR\ORADATA\ORCL','/opt/oracle/fast_recovery_area/ORCL/onlinelog','D:\APP\ADMINISTRATOR\ORADATA\ORCL\ONLINELOG' scope=spfile;
备库配置
1.设置初始化参数
*.audit_file_dest='/opt/oracle/admin/ORCL/adump' *.compatible='12.2.0'
*.control_files='/opt/oracle/oradata/ORCL/controlfile/control01.ctl','/opt/oracle/fast_recovery_area/ORCL/controlfile/control02.ctl'#Restore Controlfile
*.db_name='ORCL'
*.db_recovery_file_dest='/opt/oracle/fast_recovery_area/'
*.db_recovery_file_dest_size=20g
*.db_unique_name='ORCL'
*.pga_aggregate_target=850m
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=2600m
2.检查目录
mkdir -p /opt/oracle/admin/ORCL/adump
3.创建spfile
create spfile from pfile;
startup nomount;
备份集迁移恢复
1.windows 创建备份集
RMAN> backup database include current controlfil format 'd:\backup\%U' ;
2.恢复控制文件
restore controlfile from '/home/oracle/backup/09VMM5Q6_1_1';
3.启动数据库到mount
shutdown immediate;
startup mount;
4.注册备份集
catalog start with '/home/oracle/backup/';
5.恢复数据文件
RMAN>
run{
set newname for database to '/home/oracle/oradata/ORCL/%U';
restore database;
switch datafile all;
}
executing command: SET NEWNAME
Starting restore at 08-FEB-21
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /home/oracle/oradata/ORCL/data_D-ORCL_TS-SYSTEM_FNO-1
channel ORA_DISK_1: restoring datafile 00002 to /home/oracle/oradata/ORCL/data_D-ORCL_TS-SYSAUX_FNO-2
channel ORA_DISK_1: restoring datafile 00003 to /home/oracle/oradata/ORCL/data_D-ORCL_TS-UNDOTBS1_FNO-3
channel ORA_DISK_1: restoring datafile 00004 to /home/oracle/oradata/ORCL/data_D-ORCL_TS-USERS_FNO-4
channel ORA_DISK_1: restoring datafile 00005 to /home/oracle/oradata/ORCL/data_D-ORCL_TS-EXAMPLE_FNO-5
channel ORA_DISK_1: reading from backup piece /home/oracle/backup/06VMM2L0_1_1
channel ORA_DISK_1: piece handle=/home/oracle/backup/06VMM2L0_1_1 tag=TAG20210208T135440
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:15
Finished restore at 08-FEB-21
datafile 1 switched to datafile copy
input datafile copy RECID=7 STAMP=1063981009 file name=/home/oracle/oradata/ORCL/data_D-ORCL_TS-SYSTEM_FNO-1
datafile 2 switched to datafile copy
input datafile copy RECID=8 STAMP=1063981009 file name=/home/oracle/oradata/ORCL/data_D-ORCL_TS-SYSAUX_FNO-2
datafile 3 switched to datafile copy
input datafile copy RECID=9 STAMP=1063981009 file name=/home/oracle/oradata/ORCL/data_D-ORCL_TS-UNDOTBS1_FNO-3
datafile 4 switched to datafile copy
input datafile copy RECID=10 STAMP=1063981009 file name=/home/oracle/oradata/ORCL/data_D-ORCL_TS-USERS_FNO-4
datafile 5 switched to datafile copy
input datafile copy RECID=11 STAMP=1063981009 file name=/home/oracle/oradata/ORCL/data_D-ORCL_TS-EXAMPLE_FNO-5
RMAN>
6.打开数据库
alter database open;