I. Prerequisites for Migration:
1. The operating system meets the installation conditions of the Oracle database version.
2. database versions are consistent
2. operations on the source database:
1. Check whether the database is archived. If not, archive the database.
Sqlplus "/as sysdba"
SQL> archive log list;
If the database works in non-archive mode, open the archive.
In the database mount status,
1. SQL> alter system set archivelogs;
2. SQL> alter database open;
2. SQL> alter database backup controlfile to trace; -- backup the control file of the database for reconstruction on the target end.
3. SQL> shutdown immediate -- in this case, the database is clean and closed, and the SCN numbers of data are consistent.
4. Find the backup trace of the control file from the alarm log.
Find alter _ [ORACLE_SID]. log. Here is the alert_PROD.log file, which can be viewed in the system running log. The control file
Location of the Backup. shift + g to the end of the file. Go back and see "Backup controlfile written to trac ".
E file/u03/DEV/db/tech_st/11.1.0/admin/PROD_dev01/diag/rdbms/prod/PROD/trace/PROD_ora_2654332.trc"
Generally, it is in the same directory as the alarm log.
Or use
Run the show parameter diag command to view the trc storage path of the control file backup, and find the latest trc, which contains the backup information.
5. generate an SQL script for the control file.
Then, run the last startup nomount command to alter database open resetlogs, and delete the rest in the middle of the command. The results are similar to the following:
STARTUP NOMOUNT
Create controlfile set DATABASE "ERP" resetlogs archivelog -- change reuse to set here.
MAXLOGFILES 16
MAXLOGMEMBERS 2
MAXDATAFILES 30
MAXINSTANCES 1
# MAXLOGHISTORY 292
LOGFILE
GROUP 1'/u01/app/oracle/oradata/erp/redo01.log' SIZE 10 m blocksize 512,
GROUP 2'/u01/app/oracle/oradata/erp/redo02.log 'SIZE 10 m blocksize 512,
GROUP 3 '/u01/app/oracle/oradata/erp/redo03.log' SIZE 10 m blocksize 512,
GROUP 4'/u01/app/oracle/oradata/erp/redo04.log 'SIZE 10 m blocksize 512,
GROUP 5'/u01/app/oracle/flash_recovery_area/ERP/onlinelog/o1_mf_5_7wc3dk6b _. log' SIZE 100 m blocksize 512
-- STANDBY LOGFILE
DATAFILE
'/U01/app/oracle/oradata/erp/system01.dbf ',
'/U01/app/oracle/oradata/erp/sysaux. dbf ',
'/U01/app/oracle/oradata/erp/undo01.dbf ',
'/U01/app/oracle/oradata/erp/rbs01.dbf ',
'/U01/app/oracle/oradata/erp/user01.dbf'
Character set WE8ISO8859P1;
-- Recover database using backup controlfile comment out
Alter database open resetlogs;
6. Save the preceding script as a clt. SQL file.
Iii. Data and file migration
1. Copy the database init <$ ORACLE_SID>. ora to the $ ORACLE_HOME/dbs directory of the target database,
2. Copy the clt. SQL file generated in step 1 to a directory. You can just remember it.
3. Create a directory that appears in the above control file and does not exist in the target server, for example, mkdir-p/u01/app/oracle/oradata/erp
4. copy the data files in the source database to the corresponding directory on the target server. A new file is created if it does not exist. sftp or USB flash drive is supported.
Pseudocode: cp-R/u01/app/oracle/oradata/erp/*/u01/app/oracle/oradata/erp/