码迷,mamicode.com
首页 > 数据库 > 详细

ORACLE 12C 跨平台迁移(windows迁移linux)

时间:2020-12-16 11:43:51      阅读:5      评论:0      收藏:0      [点我收藏+]

标签:转换   operation   mac os   ibm   内部数据   variable   previous   dba   version   

源数据库置于readonly状态

 1 SQL> conn sys/oracle_4U@windb as sysdba
 2 已连接到空闲例程。
 3 SQL> startup mount
 4 ORACLE 例程已经启动。
 5 
 6 Total System Global Area 1728053248 bytes
 7 Fixed Size                  3046512 bytes
 8 Variable Size            1023411088 bytes
 9 Database Buffers          687865856 bytes
10 Redo Buffers               13729792 bytes
11 数据库装载完毕。
12 SQL> alter database open read only;
13 
14 数据库已更改。

确定ENDIAN序列

 

 1 SQL> select  * from v$transportable_platform order by platform_id;
 2  
 3 PLATFORM_ID PLATFORM_NAME                                                                    ENDIAN_FORMAT
 4 ----------- -------------------------------------------------------------------------------- --------------
 5           1 Solaris[tm] OE (32-bit)                                                          Big
 6           2 Solaris[tm] OE (64-bit)                                                          Big
 7           3 HP-UX (64-bit)                                                                   Big
 8           4 HP-UX IA (64-bit)                                                                Big
 9           5 HP Tru64 UNIX                                                                    Little
10           6 AIX-Based Systems (64-bit)                                                       Big
11           7 Microsoft Windows IA (32-bit)                                                    Little
12           8 Microsoft Windows IA (64-bit)                                                    Little
13           9 IBM zSeries Based Linux                                                          Big
14          10 Linux IA (32-bit)                                                                Little
15          11 Linux IA (64-bit)                                                                Little
16          12 Microsoft Windows x86 64-bit                                                     Little
17          13 Linux x86 64-bit                                                                 Little
18          15 HP Open VMS                                                                      Little
19          16 Apple Mac OS                                                                     Big
20          17 Solaris Operating System (x86)                                                   Little
21          18 IBM Power Based Linux                                                            Big
22          19 HP IA Open VMS                                                                   Little
23          20 Solaris Operating System (x86-64)                                                Little
24          21 Apple Mac OS (x86-64)                                                            Little
25  
26 20 rows selected

 

使用RMAN工具进行CONVERT DATABASE

 

 1 RMAN> convert database to platform Linux IA (64-bit) format c:\data\%U;
 2 
 3 启动 conversion at source 于 03-12月-20
 4 使用目标数据库控制文件替代恢复目录
 5 分配的通道: ORA_DISK_1
 6 通道 ORA_DISK_1: SID=242 设备类型=DISK
 7 
 8 在数据库中找到外部表 SYS.OPATCH_XML_INV
 9 
10 在数据库中找到目录 SYS.ORACLE_HOME
11 在数据库中找到目录 SYS.ORACLE_BASE
12 在数据库中找到目录 SYS.OPATCH_LOG_DIR
13 在数据库中找到目录 SYS.OPATCH_SCRIPT_DIR
14 在数据库中找到目录 SYS.OPATCH_INST_DIR
15 在数据库中找到目录 SYS.DATA_PUMP_DIR
16 在数据库中找到目录 SYS.XSDDIR
17 在数据库中找到目录 SYS.XMLDIR
18 在数据库中找到目录 SYS.ORACLECLRDIR
19 在数据库中找到目录 SYS.ORACLE_OCM_CONFIG_DIR
20 在数据库中找到目录 SYS.ORACLE_OCM_CONFIG_DIR2
21 
22 在口令文件中找到用户 SYS (具有 SYSDBA and SYSOPER 权限)
23 在口令文件中找到用户 SYSDG (具有 SYSDG 权限)
24 在口令文件中找到用户 SYSBACKUP (具有 SYSBACKUP 权限)
25 在口令文件中找到用户 SYSKM (具有 SYSKM 权限)
26 通道 ORA_DISK_1: 启动数据文件转换
27 输入数据文件: 文件号=00001 名称=C:\APP\APPLE\ORADATA\WINDB\DATAFILE\O1_MF_SYSTEM_HVNQY99M_.DBF
28 已转换的数据文件 = C:\DATA\DATA_D-WINDB_I-1976086287_TS-SYSTEM_FNO-1_01VH655M
29 通道 ORA_DISK_1: 数据文件转换完毕, 经过时间: 00:00:16
30 通道 ORA_DISK_1: 启动数据文件转换
31 输入数据文件: 文件号=00003 名称=C:\APP\APPLE\ORADATA\WINDB\DATAFILE\O1_MF_SYSAUX_HVNQWVR9_.DBF
32 已转换的数据文件 = C:\DATA\DATA_D-WINDB_I-1976086287_TS-SYSAUX_FNO-3_02VH6566
33 通道 ORA_DISK_1: 数据文件转换完毕, 经过时间: 00:08:33
34 通道 ORA_DISK_1: 启动数据文件转换
35 输入数据文件: 文件号=00005 名称=C:\APP\APPLE\ORADATA\WINDB\DATAFILE\O1_MF_UNDOTBS1_HVNR01X2_.DBF
36 已转换的数据文件 = C:\DATA\DATA_D-WINDB_I-1976086287_TS-UNDOTBS1_FNO-5_03VH65M7
37 通道 ORA_DISK_1: 数据文件转换完毕, 经过时间: 00:00:22
38 通道 ORA_DISK_1: 启动数据文件转换
39 输入数据文件: 文件号=00006 名称=C:\APP\APPLE\ORADATA\WINDB\DATAFILE\O1_MF_USERS_HVNR00T4_.DBF
40 已转换的数据文件 = C:\DATA\DATA_D-WINDB_I-1976086287_TS-USERS_FNO-6_04VH65MT
41 通道 ORA_DISK_1: 数据文件转换完毕, 经过时间: 00:00:01
42 编辑 init.ora 文件 C:\DATA\INIT_00VH655L_1_0.ORA。此 PFILE 将用于在目标平台上创建数据库据
43 要重新编译所有 PL/SQL 模块, 请在目标平台上运行 utlirp.sql 和 utlrp.sql
44 要更改内部数据库标识符, 请使用 DBNEWID 实用程序
45 完成 conversion at source 于 03-12月-20

 

文件迁移及处理

编辑参数文件(initorcl2)及创建控制文件脚本(createctl.sql)

 

db_recovery_file_dest    = ‘/u01/app/oracle/fast_recovery_area‘
db_recovery_file_dest_size= 6731857920
audit_file_dest          = ‘/u01/app/oracle/admin/orcl2/adump‘
db_name                  = ‘windb‘
memory_target = 2G
undo_tablespace          = ‘UNDOTBS1‘
control_files =‘/u01/app/oracle/oradata/orcl2/control01.ctl‘,‘/u01/app/oracle/oradata/orcl2/control02.ctl‘,‘/u01/app/oracle/oradata/orcl2/control03.ctl‘
processes                = 300
db_block_size            = 8192
compatible               = ‘12.1.0.2.0‘
open_cursors             = 300

 

CREATE CONTROLFILE REUSE SET DATABASE "windb" RESETLOGS  NOARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 8
    MAXLOGHISTORY 292
LOGFILE
  GROUP 1 /u01/app/oracle/oradata/orcl2/redo01.log SIZE 500M BLOCKSIZE 512,
  GROUP 2 /u01/app/oracle/oradata/orcl2/redo02.log SIZE 500M BLOCKSIZE 512,
  GROUP 3 /u01/app/oracle/oradata/orcl2/redo03.log SIZE 500M BLOCKSIZE 512
DATAFILE
  /u01/app/oracle/oradata/orcl2/system01.dbf,
  /u01/app/oracle/oradata/orcl2/sysaux01.dbf,
  /u01/app/oracle/oradata/orcl2/undotbs1.dbf,
  /u01/app/oracle/oradata/orcl2/users01.dbf
CHARACTER SET ZHS16GBK
;

启动实例到nomount状态

 

 

1 SQL> startup nomount
2 ORACLE instance started.
3 
4 Total System Global Area 2147483648 bytes
5 Fixed Size                  2926472 bytes
6 Variable Size            1358956664 bytes
7 Database Buffers          771751936 bytes
8 Redo Buffers               13848576 bytes

 

使用创建控制文件脚本创建控制文件,控制文件创建成功后,实例进入到mount状态

 

1 SQL> @/u01/app/oracle/oradata/orcl2/createctl.sql

 

开启数据库

 

1 SQL> alter database open resetlogs

 

重新编译数据库对象

 

1 SQL> shutdown immediate
2 SQL> startup upgrade
3 SQL> @@ ?/rdbms/admin/utlirp.sql
4 SQL> shutdown immediate
5 SQL> startup
6 SQL> @@ ?/rdbms/admin/utlrp.sql

 

数据库更名

 

 1 $ nid TARGET=sys/oracle_4U DBNAME=orcl2
 2 
 3 DBNEWID: Release 12.1.0.2.0 - Production on Thu Dec 10 13:59:42 2020
 4 
 5 Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.
 6 
 7 Connected to database WINORCL (DBID=2205384718)
 8 
 9 Connected to server version 12.1.0
10 
11 Control Files in database:
12     /u01/app/oracle/oradata/orcl2/control01.ctl
13     /u01/app/oracle/oradata/orcl2/control02.ctl
14     /u01/app/oracle/oradata/orcl2/control03.ctl
15 
16 Change database ID and database name WINORCL to ORCL2? (Y/[N]) => y
17 
18 Proceeding with operation
19 Changing database ID from 2205384718 to 1039567438
20 Changing database name from WINORCL to ORCL2
21     Control File /u01/app/oracle/oradata/orcl2/control01.ctl - modified
22     Control File /u01/app/oracle/oradata/orcl2/control02.ctl - modified
23     Control File /u01/app/oracle/oradata/orcl2/control03.ctl - modified
24     Datafile /u01/app/oracle/oradata/orcl2/system01.db - dbid changed, wrote new name
25     Datafile /u01/app/oracle/oradata/orcl2/sysaux01.db - dbid changed, wrote new name
26     Datafile /u01/app/oracle/oradata/orcl2/undotbs1.db - dbid changed, wrote new name
27     Datafile /u01/app/oracle/oradata/orcl2/users01.db - dbid changed, wrote new name
28     Datafile /u01/app/oracle/oradata/orcl2/temp01.db - dbid changed, wrote new name
29     Control File /u01/app/oracle/oradata/orcl2/control01.ctl - dbid changed, wrote new name
30     Control File /u01/app/oracle/oradata/orcl2/control02.ctl - dbid changed, wrote new name
31     Control File /u01/app/oracle/oradata/orcl2/control03.ctl - dbid changed, wrote new name
32     Instance shut down
33 
34 Database name changed to ORCL2.
35 Modify parameter file and generate a new password file before restarting.
36 Database ID for database ORCL2 changed to 1039567438.
37 All previous backups and archived redo logs for this database are unusable.
38 Database is not aware of previous backups and archived logs in Recovery Area.
39 Database has been shutdown, open database with RESETLOGS option.
40 Succesfully changed database name and ID.
41 DBNEWID - Completed succesfully.

 

ORACLE 12C 跨平台迁移(windows迁移linux)

标签:转换   operation   mac os   ibm   内部数据   variable   previous   dba   version   

原文地址:https://www.cnblogs.com/aries0228/p/14116236.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!