您的位置:首页 > 运维架构 > Linux

B.7.2 Migrating 32-Bit Linux Database to 64-Bit Linux Database

2018-02-16 21:28 543 查看
原文地址: https://docs.oracle.com/cd/E11882_01/server.112/e10839/appc_linux.htm#UNXAR337
文档中,比较有意思的是:迁移的过程,要startup upgrade 。和JVM方面的。
可能文章篇幅有限,或者侧重点不同,没有使用rman中的convert命令,而是使用recreate 控制文件来处理不同路径的问题。
以下为内容 :

B.7.2 Migrating 32-Bit Linux Database to 64-Bit Linux Database

This section covers the following topics:Migrating 32-Bit Database to 64-Bit Database With the Same Directory Structure for Data Files
Migrating 32-Bit Database to 64-Bit Database With Different Directory Structure for Data Files

B.7.2.1 Migrating 32-Bit Database to 64-Bit Database With the Same Directory Structure for Data Files

If the control file, data file, redo log files have the same structure on the target computer as in the source computer, then perform the following steps:Perform an online backup of the database before starting the migration process. Refer to Online Backup of Database With RMAN for more information.
Install Oracle Database 11g Release 2 (11.2) for 64-bit Linux in a new Oracle Database home. It is recommended that you use the same version of Oracle Database home as on the 32-bit computer.See Also:Oracle Database Installation Guide for Linux
Copy 
init.ora
, data files, control file, and the redo log files from the 32-bit Linux computer to the corresponding locations on the 64-bit Linux computer.
Edit 
init.ora
 file to include the following changes:Update the memory requirements included in the file.
Edit the control file location if necessary.
Note:Oracle recommends that you double the values of shared pool, java pool, 
sga_target
 and large pool listed in the 
init.ora
 file.
Connect to the database instance as 
SYSDBA
:SQL> CONNECT / AS SYSDBA;

Set the system to spool results to a log file for later verification of success. For example:SQL> SPOOL /tmp/utlirp.log

Start the 64-bit Oracle Database as follows:SQL> STARTUP UPGRADE pfile=init.ora;
Note:Oracle Database Upgrade Guide for more information on changing from 32-bit to 64-bit
Run the following command on the 64-bit Oracle Database, to invalidate all the PL/SQL modules:SQL> @$ORACLE_HOME/rdbms/admin/utlirp.sql

Shut down the 64-bit Oracle Database:SQL>shutdown immediate;

Start the 64-bit Oracle Database:SQL> STARTUP pfile=init.ora;

If the JServer JAVA Virtual Machine component is installed, perform the following steps after connecting as 
SYS
:begin
update obj$ set status=5 where obj#=(select obj# from obj$,javasnm$
where owner#=0 and type#=29 and short(+)=name and
nvl(longdbcs,name)='oracle/aurora/rdbms/Compiler');
commit;
declare
cursor C1 is select
'DROP JAVA DATA "' || u.name || '"."' || o.name || '"'
from obj$ o,user$ u where o.type#=56 and u.user#=o.owner#;

ddl_statement varchar2(200);
iterations number;
previous_iterations number;
loop_count number;
my_err number;
begin
previous_iterations := 10000000;
loop
-- To make sure we eventually stop, pick a max number of iterations
select count(*) into iterations from obj$ where type#=56;
exit when iterations=0 or iterations >= previous_iterations;
previous_iterations := iterations;
loop_count := 0;
open C1;
loop
begin
fetch C1 into ddl_statement;
exit when C1%NOTFOUND or loop_count > iterations;
exception when others then
my_err := sqlcode;
if my_err = -1555 then -- snapshot too old, re-execute fetch query
exit;
else
raise;
end if;
end;
initjvmaux.exec(ddl_statement);
loop_count := loop_count + 1;
end loop;
close C1;
end loop;
end;
commit;
initjvmaux.drp('delete from java$policy$shared$table');
update obj$ set status=1 where obj#=(select obj# from obj$,javasnm$
where owner#=0 and type#=29 and short(+)=name and
nvl(longdbcs,name)='oracle/aurora/rdbms/Compiler');
commit;
end;
/
create or replace java system;
/

Revalidate all the existing PL/SQL modules in the format required by the 64-bit Oracle Database:SQL>$ORACLE_HOME/rdbms/admin/utlrp.sql;

B.7.2.2 Migrating 32-Bit Database to 64-Bit Database With Different Directory Structure for Data Files

If the control file, data file, redo log files have different structure on the target computer as compared to the source computer, then perform the following steps:Perform an online backup of the database before starting the migration process. Refer to Online Backup of Database With RMAN for more information.
Install Oracle Database 11g Release 2 (11.2) for 64-bit Linux in a new Oracle Database home. It is recommended that you use the same version of Oracle Database home as on the 32-bit computer.See Also:Oracle Database Installation Guide for Linux
Edit 
init.ora
 file on the 64-bit computer to include the following changes:Update the memory requirements included in the file.
The 
init.ora
 file still contains the 32-bit control file path. You must manually update 
control_files
 parameter value to include the 64-bit control file location.
Note:Oracle recommends that you double the values of shared pool, java pool, 
sga_target
 and large pool listed in the 
init.ora
 file.
If the 64-bit target computer contains a different structure for data files, then you must re-create the control file or mount database on 64-bit computer. Refer to Re-aligning Data File Path and Name for more information.Note:Oracle recommends not to use the 
RESETLOGS
 option to re-create control files.
Set the system to spool results to a log file for later verification of success. For example:SQL> SPOOL /tmp/utlirp.log

Run the following command on the 64-bit Oracle Database, to invalidate all the PL/SQL modules:SQL> @$ORACLE_HOME/rdbms/admin/utlirp.sql

Turn off the spooling of script results to the log file:SQL> SPOOL OFF;

Shut down the 64-bit Oracle Database:SQL>shutdown immediate;

Start the 64-bit Oracle Database:SQL> STARTUP pfile=init.ora;

If the JServer JAVA Virtual Machine component is installed, perform the following steps after connecting as 
SYS
:begin
update obj$ set status=5 where obj#=(select obj# from obj$,javasnm$
where owner#=0 and type#=29 and short(+)=name and
nvl(longdbcs,name)='oracle/aurora/rdbms/Compiler');
commit;
declare
cursor C1 is select
'DROP JAVA DATA "' || u.name || '"."' || o.name || '"'
from obj$ o,user$ u where o.type#=56 and u.user#=o.owner#;

ddl_statement varchar2(200);
iterations number;
previous_iterations number;
loop_count number;
my_err number;
begin
previous_iterations := 10000000;
loop
-- To make sure we eventually stop, pick a max number of iterations
select count(*) into iterations from obj$ where type#=56;
exit when iterations=0 or iterations >= previous_iterations;
previous_iterations := iterations;
loop_count := 0;
open C1;
loop
begin
fetch C1 into ddl_statement;
exit when C1%NOTFOUND or loop_count > iterations;
exception when others then
my_err := sqlcode;
if my_err = -1555 then -- snapshot too old, re-execute fetch query
exit;
else
raise;
end if;
end;
initjvmaux.exec(ddl_statement);
loop_count := loop_count + 1;
end loop;
close C1;
end loop;
end;
commit;
initjvmaux.drp('delete from java$policy$shared$table');
update obj$ set status=1 where obj#=(select obj# from obj$,javasnm$
where owner#=0 and type#=29 and short(+)=name and
nvl(longdbcs,name)='oracle/aurora/rdbms/Compiler');
commit;
end;
/
create or replace java system;
/

Revalidate all the existing PL/SQL modules in the format required by the 64-bit Oracle Database:SQL>$ORACLE_HOME/rdbms/admin/utlrp.sql;

Re-aligning Data File Path and NameThe following are some methods to realign the data file names and path to point to the correct location:Re-creating Control File
Mounting Database on a 64-Bit Computer
Re-creating Control FilePerform the following steps to re-create the control file:Run the following command to backup the control file to trace. The trace file is located under the 
diagnostic_dest
 directory on the 32-bit Linux computer. The following command generates a trace file which contains the necessary sql to re-create the control file:SQL> alter database backup controlfile to trace;
Note:Ensure that you open the Oracle Database in the 
UPGRADE
 mode after the control file is created.
Rename the trace file generated into 
.sql
 format on the 32-bit Linux computer. For example:$ cp trace.ora control.sql
The contents of the control file are as follows, for example:Re-creating control files with 
NORESETLOGS
 option.32-bit control file with 
NORESETLOGS
 option:STARTUP NOMOUNT pfile=t_init1.ora
CREATE CONTROLFILE REUSE DATABASE "L32" NORESETLOGS NOARCHIVELOG
MAXLOGFILES 32
MAXLOGMEMBERS 2
MAXDATAFILES 32
MAXINSTANCES 1
MAXLOGHISTORY 454
LOGFILE
GROUP 1 '/ade/aime_l32/oracle/dbs/t_log1.f' SIZE 25M,
GROUP 2 '/ade/aime_l32/oracle/dbs/t_log2.f' SIZE 25M
DATAFILE
'/ade/aime_l32/oracle/dbs/t_db1.f'
'/ade/aime_l32/oracle/dbs/t_ax1.f'
'/ade/aime_l32/oracle/dbs/t_undo1.f'
CHARACTER SET AL32UTF8;
RECOVER DATABASE;
ALTER DATABASE OPEN UPGRADE;
ALTER TABLESPACE TEMP ADD TEMPFILE '/ade/aime_l32/oracle/dbs/t_tmp1.f' SIZE 41943040 REUSE AUTOEXTEND ON NEXT 8192 MAXSIZE 32767M;
Now, let us consider the modified 64-bit control file:STARTUP NOMOUNT pfile=t_init1.ora
CREATE CONTROLFILE REUSE DATABASE "L32" NORESETLOGS NOARCHIVELOG
MAXLOGFILES 32
MAXLOGMEMBERS 2
MAXDATAFILES 32
MAXINSTANCES 1
MAXLOGHISTORY 454
LOGFILE
GROUP 1 '/ade/aime_l64/oracle/dbs/t_log1.f' SIZE 25M,
GROUP 2 '/ade/aime_l64/oracle/dbs/t_log2.f' SIZE 25M
DATAFILE
'/ade/aime_l64/oracle/dbs/t_db1.f'
'/ade/aime_l64/oracle/dbs/t_ax1.f'
'/ade/aime_l64/oracle/dbs/t_undo1.f'
CHARACTER SET AL32UTF8;
RECOVER DATABASE;
ALTER DATABASE OPEN UPGRADE;
ALTER TABLESPACE TEMP ADD TEMPFILE '/ade/aime_l64/oracle/dbs/t_tmp1.f' SIZE 41943040 REUSE AUTOEXTEND ON NEXT 8192 MAXSIZE 32767M;

Re-creating control files with 
RESETLOGS
 option:32-bit control file with 
RESETLOGS
 option:STARTUP NOMOUNT pfile=t_init1.ora
CREATE CONTROLFILE REUSE DATABASE "L32" RESETLOGS NOARCHIVELOG
MAXLOGFILES 32
MAXLOGMEMBERS 2
MAXDATAFILES 32
MAXINSTANCES 1
MAXLOGHISTORY 454
LOGFILE
GROUP 1 '/ade/aime_l32/oracle/dbs/t_log1.f' SIZE 25M,
GROUP 2 '/ade/aime_l32/oracle/dbs/t_log2.f' SIZE 25M
DATAFILE
'/ade/aime_l32/oracle/dbs/t_db1.f'
'/ade/aime_l32/oracle/dbs/t_ax1.f'
'/ade/aime_l32/oracle/dbs/t_undo1.f'
CHARACTER SET AL32UTF8;
RECOVER DATABASE USING BACKUP CONTROLFILE;
ALTER DATABASE OPEN RESETLOGS UPGRADE;
ALTER TABLESPACE TEMP ADD TEMPFILE '/ade/aime_l32/oracle/dbs/t_tmp1.f' SIZE 41943040 REUSE AUTOEXTEND ON NEXT 8192 MAXSIZE 32767M;
Now, let us consider the modified 64-bit control file:STARTUP NOMOUNT pfile=t_init1.ora
CREATE CONTROLFILE REUSE DATABASE "L32" RESETLOGS NOARCHIVELOG
MAXLOGFILES 32
MAXLOGMEMBERS 2
MAXDATAFILES 32
MAXINSTANCES 1
MAXLOGHISTORY 454
LOGFILE
GROUP 1 '/ade/aime_l64/oracle/dbs/t_log1.f' SIZE 25M,
GROUP 2 '/ade/aime_l64/oracle/dbs/t_log2.f' SIZE 25M
DATAFILE
'/ade/aime_l64/oracle/dbs/t_db1.f'
'/ade/aime_l64/oracle/dbs/t_ax1.f'
'/ade/aime_l64/oracle/dbs/t_undo1.f'
CHARACTER SET AL32UTF8;
RECOVER DATABASE USING BACKUP CONTROLFILE;
ALTER DATABASE OPEN RESETLOGS UPGRADE;
ALTER TABLESPACE TEMP ADD TEMPFILE '/ade/aime_l64/oracle/dbs/t_tmp1.f' SIZE 41943040 REUSE AUTOEXTEND ON NEXT 8192 MAXSIZE 32767M;


Based on the method employed to realign the file paths to point to the correct locations, you must copy the necessary files from the source 32-bit Linux computer to the target 64-bit Linux computer:
NORESETLOGS
 option: Copy 
init.ora
, data files, re-created control files (
control.sql
), and the redo log files from the 32-bit Linux computer to the corresponding locations on the 64-bit Linux computer
RESETLOGS
 option: Copy 
init.ora
, data files, and re-created control files (
control.sql
) from the 32-bit Linux computer to the corresponding locations on the 64-bit Linux computer

Connect to the database instance as 
SYSDBA
:SQL> CONNECT / AS SYSDBA;

To change from 32-bit to 64-bit, run the following command from the Linux 64-bit Oracle Database home:sql>set echo on
sql>@control.sql

Mounting Database on a 64-Bit ComputerPerform the following steps to mount the database on a 64-bit computer:Copy 
init.ora
, data files, control file and the redo log files from the 32-bit Linux computer to the corresponding locations on the 64-bit Linux computer
Connect to the database instance as 
SYSDBA
:SQL> CONNECT / AS SYSDBA;

Start the 64-bit Oracle Database as follows:SQL> STARTUP mount pfile=init.ora;

Update all the 32-bit data file locations to include the 64-bit data file locations. For example:sql> alter database rename file '/ade/aime_l32/oracle/dbs/t_db1.f' to '/ade/aime_l64/oracle/dbs/t_db1.f'
sql> Database altered.

Update all the 32-bit log file locations to include the 64-bit log file locations. For example:sql> alter database rename file '/ade/aime_l32/oracle/dbs/t_log.f' to '/ade/aime_l64/oracle/dbs/t_log.f'
sql> Database altered.

To change from 32-bit to 64-bit, run the following command from the Linux 64-bit Oracle Database home:sql> ALTER DATABASE OPEN UPGRADE;
Note:Refer to Oracle Database Upgrade Guide for more information on changing from 32-bit to 64-bit
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: