Overall physical migration of Oracle databases on Linux platforms
Overall physical migration of databases on Linux platforms
Requirement: machine A is no longer in use. You need to migrate the Oracle of machine A to machine B.
I have previously written articles with similar requirements:
This article aims to use more automated and universal integrated scripts to achieve the overall migration of databases on the same platform.
1. Machine A operations
2. Machine B operations
Machine A operations
0. System Version:
[Root @ DB-A tmp] # uname-
Linux DB-A 2.6.32-358. el6.x86 _ 64 #1 SMP Tue Jan 29 11:47:41 EST 2013 x86_64 x86_64 x86_64 GNU/Linux
[Root @ DB-A tmp] # cat/etc/issue
Red Hat Enterprise Linux Server release 6.4 (Santiago)
Kernel \ r on an \ m
1. Current information of database
Select status from v $ instance union all
Select open_mode from v $ database union all
Select * from v $ version where rownum = 1;
2. Confirm the location of the parameter file and Control File
Show parameter pfile
Show parameter control_files
Here, you need to create a pfile based on the current spfile, which will be used later.
Create pfile from spfile;
3. Location of data files, temporary files, and redo log files
Set linesize 140 pagesize 100
Select name from v $ datafile union all
Select name from v $ tempfile union all
Select member from v $ logfile;
4. Close the database cleanly:
Shutdown immediate;
5. Confirm the ORACLE software directory and package it to machine B.
Echo $ ORACLE_BASE
/Ora/app/oracle
Tar-zcvf/tmp/oracle.tar.gz/ora/app/oracle
Copy the packaged Oracle software directory and all parameter files, control files, data files, temporary files, and redo log files to the B server.
Machine B operation
0. System Version:
[Root @ DB-B irnop] # uname-
Linux DB-B 2.6.32-431. el6.x86 _ 64 #1 SMP Sun Nov 10 22:19:54 EST 2013 x86_64 x86_64 x86_64 GNU/Linux
[Root @ DB-B irnop] # cat/etc/issue
Red Hat Enterprise Linux Server release 6.5 (Santiago)
Kernel \ r on an \ m
1. Install dependency packages and adjust system parameters
. Refer:
2. Decompress ORACLE_HOME to the software installation directory planned on machine B:/u01/app/oracle
Tar zxvf oracle.tar.gz
Unzip the decompressed oracle directory to/u01/app.
3. Modify the parameter file pfile and start the database to nomount
Modify the memory usage value of the database based on the actual situation of machine B, and confirm that the path written in the parameter file exists.
Startup nomount pfile = '$ ORACLE_HOME/dbs/initirnop. ora'
SQL> startup nomount pfile = '$ ORACLE_HOME/dbs/initirnop. ora'
ORACLE instance started.
Total System Global Area 2.3717E + 10 bytes
Fixed Size 2239176 bytes
Variable Size1.3153E + 10 bytes
Database Buffers 1.0536E + 10 bytes
Redo Buffers 25612288 bytes
4. Start to mount
SQL> alter database mount;
Database altered.
5. data files, temporary files, and log file rename redirection
Set linesize 140 pagesize 100
Select 'alter database rename file ''' | name | ''' to ''/XXX' | name | '''; 'from v $ datafile union all
Select 'alter database rename file ''' | name | ''' to ''/XXX' | name | '''; 'from v $ tempfile union all
Select 'alter database rename file ''' | member | ''' to ''/XXX' | member | '''; 'from v $ logfile;
Replace old_name with new_name based on actual conditions.
Old_name:/xxx/oradata
New_name:/new/oradata
Then execute the redirection SQL to check whether the current path is correctly modified:
Select name from v $ datafile union all
Select name from v $ tempfile union all
Select member from v $ logfile;
Modify system directory permissions:
Chown-R oracle: oinstall/new/oradata
6. Open the database:
SQL> alter database open;